File tree Expand file tree Collapse file tree 6 files changed +76
-1
lines changed Expand file tree Collapse file tree 6 files changed +76
-1
lines changed Original file line number Diff line number Diff line change 1+ v1.4.22
2+ - added Rule model
3+
14v1.4.21
25 - added IncompleteListing model
36
Original file line number Diff line number Diff line change 1- 1.4.21
1+ 1.4.22
Original file line number Diff line number Diff line change 3434require 'spark_api/models/portal_listing_cart'
3535require 'spark_api/models/property_types'
3636require 'spark_api/models/rental_calendar'
37+ require 'spark_api/models/rule'
3738require 'spark_api/models/saved_search'
3839require 'spark_api/models/search_template/quick_search'
3940require 'spark_api/models/shared_link'
Original file line number Diff line number Diff line change 1+ module SparkApi
2+ module Models
3+ class Rule < Base
4+
5+ self . element_name = "listings/rules"
6+
7+ def self . for_property_type ( property_type , args = { } )
8+ collect ( connection . get ( "/listings/rules/propertytypes/#{ property_type } " , args ) )
9+ end
10+
11+ end
12+ end
13+ end
14+
Original file line number Diff line number Diff line change 1+ {
2+ "D" : {
3+ "Success" : true ,
4+ "Results" : [
5+ {
6+ "Id" : 25 ,
7+ "ResourceUri" : " /v1/listings/rules/25" ,
8+ "PropertyType" : " A" ,
9+ "Domain" : " StandardFields" ,
10+ "Group" : null ,
11+ "Field" : " BathsTotal" ,
12+ "Order" : 1 ,
13+ "Action" : " SET_REQUIRED" ,
14+ "Expression" : " StandardStatus = 'Active'" ,
15+ "ModificationTimestamp" : " 2018-05-07T19:03:07Z" ,
16+ "CreatedTimestamp" : " 2017-12-20T19:00:30Z" ,
17+ "ApprovalStatus" : " Published" ,
18+ "Editable" : true ,
19+ "Status" : " Fatal"
20+ },
21+ {
22+ "Id" : 370 ,
23+ "ResourceUri" : " /v1/listings/rules/370" ,
24+ "PropertyType" : " A" ,
25+ "Domain" : " StandardFields" ,
26+ "Group" : null ,
27+ "Field" : " City" ,
28+ "Order" : 1 ,
29+ "Action" : " SET_REQUIRED" ,
30+ "Expression" : " .FALSE." ,
31+ "ModificationTimestamp" : " 2018-05-01T15:26:47Z" ,
32+ "CreatedTimestamp" : " 2018-01-24T16:01:14Z" ,
33+ "ApprovalStatus" : " Published" ,
34+ "Editable" : true ,
35+ "Status" : " Fatal"
36+ }
37+ ]
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ require './spec/spec_helper'
2+
3+ describe Rule do
4+
5+ describe 'for_property_type' do
6+
7+ on_get_it "should get documents for a listing" do
8+ stub_auth_request
9+ stub_api_get ( '/listings/rules/propertytypes/A' , 'rules/get.json' )
10+
11+ rules = Rule . for_property_type ( 'A' )
12+ rules . should be_an ( Array )
13+ rules . length . should == 2
14+ end
15+
16+ end
17+
18+ end
You can’t perform that action at this time.
0 commit comments