-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from ryanhertz/rules
added Rule model
- Loading branch information
Showing
6 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
v1.4.22 | ||
- added Rule model | ||
|
||
v1.4.21 | ||
- added IncompleteListing model | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.21 | ||
1.4.22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module SparkApi | ||
module Models | ||
class Rule < Base | ||
|
||
self.element_name="listings/rules" | ||
|
||
def self.for_property_type(property_type, args={}) | ||
collect(connection.get("/listings/rules/propertytypes/#{property_type}", args)) | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"D": { | ||
"Success": true, | ||
"Results": [ | ||
{ | ||
"Id": 25, | ||
"ResourceUri": "/v1/listings/rules/25", | ||
"PropertyType": "A", | ||
"Domain": "StandardFields", | ||
"Group": null, | ||
"Field": "BathsTotal", | ||
"Order": 1, | ||
"Action": "SET_REQUIRED", | ||
"Expression": "StandardStatus = 'Active'", | ||
"ModificationTimestamp": "2018-05-07T19:03:07Z", | ||
"CreatedTimestamp": "2017-12-20T19:00:30Z", | ||
"ApprovalStatus": "Published", | ||
"Editable": true, | ||
"Status": "Fatal" | ||
}, | ||
{ | ||
"Id": 370, | ||
"ResourceUri": "/v1/listings/rules/370", | ||
"PropertyType": "A", | ||
"Domain": "StandardFields", | ||
"Group": null, | ||
"Field": "City", | ||
"Order": 1, | ||
"Action": "SET_REQUIRED", | ||
"Expression": ".FALSE.", | ||
"ModificationTimestamp": "2018-05-01T15:26:47Z", | ||
"CreatedTimestamp": "2018-01-24T16:01:14Z", | ||
"ApprovalStatus": "Published", | ||
"Editable": true, | ||
"Status": "Fatal" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require './spec/spec_helper' | ||
|
||
describe Rule do | ||
|
||
describe 'for_property_type' do | ||
|
||
on_get_it "should get documents for a listing" do | ||
stub_auth_request | ||
stub_api_get('/listings/rules/propertytypes/A','rules/get.json') | ||
|
||
rules = Rule.for_property_type('A') | ||
rules.should be_an(Array) | ||
rules.length.should == 2 | ||
end | ||
|
||
end | ||
|
||
end |