File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 30
30
require 'spark_api/models/saved_search'
31
31
require 'spark_api/models/search_template/quick_search'
32
32
require 'spark_api/models/shared_listing'
33
+ require 'spark_api/models/sort'
33
34
require 'spark_api/models/standard_fields'
34
35
require 'spark_api/models/system_info'
35
36
require 'spark_api/models/tour_of_home'
Original file line number Diff line number Diff line change
1
+ module SparkApi
2
+ module Models
3
+ class Sort < Base
4
+ extend Finders
5
+
6
+ self . element_name = "/sorts"
7
+ self . prefix = "/searchtemplates"
8
+
9
+ end
10
+ end
11
+ end
Original file line number Diff line number Diff line change
1
+ {
2
+ "D" : {
3
+ "Results" : [
4
+ {
5
+ "ResourceUri" : " /v1/searchtemplates/sorts/20120717212004874996000000" ,
6
+ "Id" : " 20130717212004874996000000" ,
7
+ "Name" : " My Custom Listing Sort" ,
8
+ "OwnerId" : " 20000426173054342350000000" ,
9
+ "MlsId" : " 20000426143505724628000000" ,
10
+ "Inheritable" : true ,
11
+ "Inherited" : false ,
12
+ "Fields" : [
13
+ {
14
+ "Domain" : " StandardFields" ,
15
+ "GroupField" : null ,
16
+ "Field" : " ListPrice" ,
17
+ "SortType" : " Ascending"
18
+ },
19
+ {
20
+ "Domain" : " StandardFields" ,
21
+ "GroupField" : null ,
22
+ "Field" : " MlsStatus" ,
23
+ "SortType" : " Descending"
24
+ }
25
+ ],
26
+ "ModificationTimestamp" : " 2013-07-09T15:31:47Z"
27
+ }
28
+ ],
29
+ "Success" : true
30
+ }
31
+ }
Original file line number Diff line number Diff line change
1
+ require './spec/spec_helper'
2
+
3
+ describe Sort do
4
+ before ( :each ) do
5
+ stub_auth_request
6
+ end
7
+
8
+ it "should include the finders module" do
9
+ Sort . should respond_to ( :find )
10
+ end
11
+
12
+ it "should return sorts" do
13
+ stub_api_get ( "/searchtemplates/sorts" , 'sorts/get.json' )
14
+ sorts = Sort . find ( :all )
15
+ sorts . should be_an ( Array )
16
+ sorts . length . should eq ( 1 )
17
+ end
18
+
19
+ end
You can’t perform that action at this time.
0 commit comments