flexmls_api 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/Gemfile +20 -0
  2. data/Gemfile.lock +60 -0
  3. data/LICENSE +14 -0
  4. data/README.md +128 -0
  5. data/Rakefile +78 -0
  6. data/VERSION +1 -0
  7. data/lib/flexmls_api/authentication.rb +104 -0
  8. data/lib/flexmls_api/client.rb +20 -0
  9. data/lib/flexmls_api/configuration.rb +40 -0
  10. data/lib/flexmls_api/faraday.rb +52 -0
  11. data/lib/flexmls_api/models/base.rb +76 -0
  12. data/lib/flexmls_api/models/connect_prefs.rb +10 -0
  13. data/lib/flexmls_api/models/contact.rb +25 -0
  14. data/lib/flexmls_api/models/custom_fields.rb +12 -0
  15. data/lib/flexmls_api/models/document.rb +11 -0
  16. data/lib/flexmls_api/models/idx_link.rb +45 -0
  17. data/lib/flexmls_api/models/listing.rb +110 -0
  18. data/lib/flexmls_api/models/market_statistics.rb +33 -0
  19. data/lib/flexmls_api/models/photo.rb +15 -0
  20. data/lib/flexmls_api/models/property_types.rb +7 -0
  21. data/lib/flexmls_api/models/standard_fields.rb +7 -0
  22. data/lib/flexmls_api/models/subresource.rb +13 -0
  23. data/lib/flexmls_api/models/system_info.rb +7 -0
  24. data/lib/flexmls_api/models/video.rb +16 -0
  25. data/lib/flexmls_api/models/virtual_tour.rb +18 -0
  26. data/lib/flexmls_api/models.rb +21 -0
  27. data/lib/flexmls_api/paginate.rb +87 -0
  28. data/lib/flexmls_api/request.rb +172 -0
  29. data/lib/flexmls_api/version.rb +4 -0
  30. data/lib/flexmls_api.rb +41 -0
  31. data/spec/fixtures/contacts.json +25 -0
  32. data/spec/fixtures/listing_document_index.json +19 -0
  33. data/spec/fixtures/listing_no_subresources.json +38 -0
  34. data/spec/fixtures/listing_photos_index.json +469 -0
  35. data/spec/fixtures/listing_videos_index.json +18 -0
  36. data/spec/fixtures/listing_virtual_tours_index.json +42 -0
  37. data/spec/fixtures/listing_with_documents.json +52 -0
  38. data/spec/fixtures/listing_with_photos.json +110 -0
  39. data/spec/fixtures/listing_with_supplement.json +39 -0
  40. data/spec/fixtures/listing_with_videos.json +54 -0
  41. data/spec/fixtures/listing_with_vtour.json +48 -0
  42. data/spec/fixtures/session.json +10 -0
  43. data/spec/json_helper.rb +77 -0
  44. data/spec/spec_helper.rb +78 -0
  45. data/spec/unit/flexmls_api/configuration_spec.rb +97 -0
  46. data/spec/unit/flexmls_api/faraday_spec.rb +94 -0
  47. data/spec/unit/flexmls_api/models/base_spec.rb +62 -0
  48. data/spec/unit/flexmls_api/models/connect_prefs_spec.rb +9 -0
  49. data/spec/unit/flexmls_api/models/contact_spec.rb +70 -0
  50. data/spec/unit/flexmls_api/models/document_spec.rb +39 -0
  51. data/spec/unit/flexmls_api/models/listing_spec.rb +174 -0
  52. data/spec/unit/flexmls_api/models/photo_spec.rb +59 -0
  53. data/spec/unit/flexmls_api/models/property_types_spec.rb +20 -0
  54. data/spec/unit/flexmls_api/models/standard_fields_spec.rb +42 -0
  55. data/spec/unit/flexmls_api/models/system_info_spec.rb +37 -0
  56. data/spec/unit/flexmls_api/models/video_spec.rb +43 -0
  57. data/spec/unit/flexmls_api/models/virtual_tour_spec.rb +46 -0
  58. data/spec/unit/flexmls_api/paginate_spec.rb +221 -0
  59. data/spec/unit/flexmls_api/request_spec.rb +288 -0
  60. data/spec/unit/flexmls_api_spec.rb +44 -0
  61. metadata +315 -0
@@ -0,0 +1,18 @@
1
+ {
2
+ "D":{
3
+ "Results":[{
4
+ "ResourceUri":"/v1/listings/20060813163018826257000000/videos/20110103201412297033000000",
5
+ "Name":"Ode to joy",
6
+ "Id":"20110103201412297033000000",
7
+ "Caption":"All awesome",
8
+ "ObjectHtml":"<object width='640' height='385'><param name='movie' value='http://www.youtube.com/v/xpcUxwpOQ_A?fs=1&amp;hl=en_US'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/xpcUxwpOQ_A?fs=1&amp;hl=en_US' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='640' height='385'></embed></object>"
9
+ },
10
+ {
11
+ "ResourceUri":"/v1/listings/20060813163018826257000000/videos/20110103201413206052000000",
12
+ "Name":"Ode to joy",
13
+ "Id":"20110103201413206052000000",
14
+ "Caption":"All awesome",
15
+ "ObjectHtml":"<object width='640' height='385'><param name='movie' value='http://www.youtube.com/v/tgbNymZ7vqY?fs=1&amp;hl=en_US'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/tgbNymZ7vqY?fs=1&amp;hl=en_US' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='640' height='385'></embed></object>"
16
+ }],
17
+ "Success":true
18
+ }}
@@ -0,0 +1,42 @@
1
+ {
2
+ "D": {
3
+ "Results": [
4
+ {
5
+ "Uri": "http://www.flexmls.com/",
6
+ "ResourceUri": "/v1/listings/20060712220814669202000000/virtualtours/20110105165843978012000000",
7
+ "Name": "brandedasdfasdf",
8
+ "Id": "20110105165843978012000000",
9
+ "Type": "branded"
10
+ },
11
+ {
12
+ "Uri": "http://www.flexmls.comasdf",
13
+ "ResourceUri": "/v1/listings/20060712220814669202000000/virtualtours/20110105164609987122000000",
14
+ "Name": "unbranded 1",
15
+ "Id": "20110105164609987122000000",
16
+ "Type": "unbranded"
17
+ },
18
+ {
19
+ "Uri": "http://too.many.prefs",
20
+ "ResourceUri": "/v1/listings/20060712220814669202000000/virtualtours/20110105164725304762000000",
21
+ "Name": "branded",
22
+ "Id": "20110105164725304762000000",
23
+ "Type": "branded"
24
+ },
25
+ {
26
+ "Uri": "http://www.flexmls.com/",
27
+ "ResourceUri": "/v1/listings/20060712220814669202000000/virtualtours/20110105164731217564000000",
28
+ "Name": "branded 2",
29
+ "Id": "20110105164731217564000000",
30
+ "Type": "branded"
31
+ },
32
+ {
33
+ "Uri": "http://www.flexmls.com/",
34
+ "ResourceUri": "/v1/listings/20060712220814669202000000/virtualtours/20110105164628823578000000",
35
+ "Name": "unbrandedasdfasdf",
36
+ "Id": "20110105164628823578000000",
37
+ "Type": "unbranded"
38
+ }
39
+ ],
40
+ "Success": true
41
+ }
42
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "D": {
3
+ "Results": [
4
+ {
5
+ "ResourceUri": "/v1/listings/20060725224713296297000000",
6
+ "StandardFields": {
7
+ "StreetNumber": "7298",
8
+ "Longitude": " -116.3237",
9
+ "City": "Bonners Ferry",
10
+ "ListingId": "06-9395",
11
+ "Documents": [
12
+ {
13
+ "Uri": "http://images.dev.fbsdata.com/documents/cda/20060725224801143085000000.pdf",
14
+ "ResourceUri": "/v1/listings/20060725224713296297000000/documents/20060725224801143085000000",
15
+ "Name": "Disclosure",
16
+ "Id": "20060725224801143085000000"
17
+ },
18
+ {
19
+ "Uri": "http://images.dev.fbsdata.com/documents/cda/20060725224818080340000000.pdf",
20
+ "ResourceUri": "/v1/listings/20060725224713296297000000/documents/20060725224818080340000000",
21
+ "Name": "Plat Map",
22
+ "Id": "20060725224818080340000000"
23
+ }
24
+ ],
25
+ "PublicRemarks": "Afforadable home in town close to hospital,yet quiet country like setting. Good views. Must see",
26
+ "BuildingAreaTotal": "924.0",
27
+ "YearBuilt": 1977,
28
+ "StreetName": "BIRCH",
29
+ "ListPrice": "50000.0",
30
+ "PostalCode": "83805",
31
+ "Latitude": "48.7001",
32
+ "BathsThreeQuarter": null,
33
+ "BathsFull": null,
34
+ "BathsTotal": "1.0",
35
+ "StateOrProvince": "ID",
36
+ "PropertyType": "A",
37
+ "StreetAdditionalInfo": null,
38
+ "StreetDirPrefix": null,
39
+ "BedsTotal": 3,
40
+ "StreetDirSuffix": null,
41
+ "ListingKey": "20060725224713296297000000",
42
+ "ListOfficeName": "Century 21 On The Lake",
43
+ "BathsHalf": null,
44
+ "ModificationTimestamp": "2010-11-22T20:47:21Z",
45
+ "CountyOrParish": "Boundary"
46
+ },
47
+ "Id": "20060725224713296297000000"
48
+ }
49
+ ],
50
+ "Success": true
51
+ }
52
+ }
@@ -0,0 +1,110 @@
1
+ {
2
+ "D": {
3
+ "Results": [
4
+ {
5
+ "ResourceUri": "/v1/listings/20060725224713296297000000",
6
+ "StandardFields": {
7
+ "StreetNumber": "7298",
8
+ "Longitude": " -116.3237",
9
+ "City": "Bonners Ferry",
10
+ "ListingId": "06-9395",
11
+ "PublicRemarks": "Afforadable home in town close to hospital,yet quiet country like setting. Good views. Must see",
12
+ "BuildingAreaTotal": "924.0",
13
+ "YearBuilt": 1977,
14
+ "StreetName": "BIRCH",
15
+ "ListPrice": "50000.0",
16
+ "PostalCode": "83805",
17
+ "Latitude": "48.7001",
18
+ "BathsThreeQuarter": null,
19
+ "Photos": [
20
+ {
21
+ "Uri300": "http://photos.flexmls.com/cda/20060725225010201442000000.jpg",
22
+ "ResourceUri": "/v1/listings/20060725224713296297000000/pictures/20060725225010201442000000",
23
+ "Name": "House",
24
+ "Primary": true,
25
+ "Id": "20060725225010201442000000",
26
+ "Uri800": "http://cdn.resize.flexmls.com/cda/800x600/true/20060725225010201442000000-o.jpg",
27
+ "Uri1024": "http://cdn.resize.flexmls.com/cda/1024x768/true/20060725225010201442000000-o.jpg",
28
+ "UriLarge": "http://photos.flexmls.com/cda/20060725225010201442000000-o.jpg",
29
+ "Caption": "",
30
+ "Uri1280": "http://cdn.resize.flexmls.com/cda/1280x1024/true/20060725225010201442000000-o.jpg",
31
+ "UriThumb": "http://photos.flexmls.com/cda/20060725225010201442000000-t.jpg",
32
+ "Uri640": "http://cdn.resize.flexmls.com/cda/640x480/true/20060725225010201442000000-o.jpg"
33
+ },
34
+ {
35
+ "Uri300": "http://photos.flexmls.com/cda/20060918191319441822000000.jpg",
36
+ "ResourceUri": "/v1/listings/20060725224713296297000000/pictures/20060918191319441822000000",
37
+ "Name": "kitchen",
38
+ "Primary": false,
39
+ "Id": "20060918191319441822000000",
40
+ "Uri800": "http://cdn.resize.flexmls.com/cda/800x600/true/20060918191319441822000000-o.jpg",
41
+ "Uri1024": "http://cdn.resize.flexmls.com/cda/1024x768/true/20060918191319441822000000-o.jpg",
42
+ "UriLarge": "http://photos.flexmls.com/cda/20060918191319441822000000-o.jpg",
43
+ "Caption": "",
44
+ "Uri1280": "http://cdn.resize.flexmls.com/cda/1280x1024/true/20060918191319441822000000-o.jpg",
45
+ "UriThumb": "http://photos.flexmls.com/cda/20060918191319441822000000-t.jpg" ,
46
+ "Uri640": "http://cdn.resize.flexmls.com/cda/640x480/true/20060918191319441822000000-o.jpg"
47
+ },
48
+ {
49
+ "Uri300": "http://photos.flexmls.com/cda/20060918191405154515000000.jpg",
50
+ "ResourceUri": "/v1/listings/20060725224713296297000000/pictures/20060918191405154515000000",
51
+ "Name": "kitchen 2",
52
+ "Primary": false,
53
+ "Id": "20060918191405154515000000",
54
+ "Uri800": "http://cdn.resize.flexmls.com/cda/800x600/true/20060918191405154515000000-o.jpg",
55
+ "Uri1024": "http://cdn.resize.flexmls.com/cda/1024x768/true/20060918191405154515000000-o.jpg",
56
+ "UriLarge": "http://photos.flexmls.com/cda/20060918191405154515000000-o.jpg",
57
+ "Caption": "",
58
+ "Uri1280": "http://cdn.resize.flexmls.com/cda/1280x1024/true/20060918191405154515000000-o.jpg",
59
+ "UriThumb": "http://photos.flexmls.com/cda/20060918191405154515000000-t.jpg",
60
+ "Uri640": "http://cdn.resize.flexmls.com/cda/640x480/true/20060918191405154515000000-o.jpg"
61
+ },
62
+ {
63
+ "Uri300": "http://photos.flexmls.com/cda/20060918191447082689000000.jpg",
64
+ "ResourceUri": "/v1/listings/20060725224713296297000000/pictures/20060918191447082689000000",
65
+ "Name": "living",
66
+ "Primary": false,
67
+ "Id": "20060918191447082689000000",
68
+ "Uri800": "http://cdn.resize.flexmls.com/cda/800x600/true/20060918191447082689000000-o.jpg",
69
+ "Uri1024": "http://cdn.resize.flexmls.com/cda/1024x768/true/20060918191447082689000000-o.jpg",
70
+ "UriLarge": "http://photos.flexmls.com/cda/20060918191447082689000000-o.jpg",
71
+ "Caption": "",
72
+ "Uri1280": "http://cdn.resize.flexmls.com/cda/1280x1024/true/20060918191447082689000000-o.jpg",
73
+ "UriThumb": "http://photos.flexmls.com/cda/20060918191447082689000000-t.jpg",
74
+ "Uri640": "http://cdn.resize.flexmls.com/cda/640x480/true/20060918191447082689000000-o.jpg"
75
+ },
76
+ {
77
+ "Uri300": "http://photos.flexmls.com/cda/20060918191532107457000000.jpg",
78
+ "ResourceUri": "/v1/listings/20060725224713296297000000/pictures/20060918191532107457000000",
79
+ "Name": "bath",
80
+ "Primary": false,
81
+ "Id": "20060918191532107457000000",
82
+ "Uri800": "http://cdn.resize.flexmls.com/cda/800x600/true/20060918191532107457000000-o.jpg",
83
+ "Uri1024": "http://cdn.resize.flexmls.com/cda/1024x768/true/20060918191532107457000000-o.jpg",
84
+ "UriLarge": "http://photos.flexmls.com/cda/20060918191532107457000000-o.jpg",
85
+ "Caption": "",
86
+ "Uri1280": "http://cdn.resize.flexmls.com/cda/1280x1024/true/20060918191532107457000000-o.jpg",
87
+ "UriThumb": "http://photos.flexmls.com/cda/20060918191532107457000000-t.jpg",
88
+ "Uri640": "http://cdn.resize.flexmls.com/cda/640x480/true/20060918191532107457000000-o.jpg"
89
+ }
90
+ ],
91
+ "BathsFull": null,
92
+ "BathsTotal": "1.0",
93
+ "StateOrProvince": "ID",
94
+ "PropertyType": "A",
95
+ "StreetAdditionalInfo": null,
96
+ "StreetDirPrefix": null,
97
+ "BedsTotal": 3,
98
+ "StreetDirSuffix": null,
99
+ "ListingKey": "20060725224713296297000000",
100
+ "ListOfficeName": "Century 21 On The Lake",
101
+ "BathsHalf": null,
102
+ "ModificationTimestamp": "2010-11-22T20:47:21Z",
103
+ "CountyOrParish": "Boundary"
104
+ },
105
+ "Id": "20060725224713296297000000"
106
+ }
107
+ ],
108
+ "Success": true
109
+ }
110
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "D": {
3
+ "Results": [
4
+ {
5
+ "ResourceUri": "/v1/listings/20060725224713296297000000",
6
+ "StandardFields": {
7
+ "StreetNumber": "7298",
8
+ "Longitude": "-116.3237",
9
+ "City": "Bonners Ferry",
10
+ "ListingId": "06-9395",
11
+ "PublicRemarks": "Afforadable home in town close to hospital,yet quiet country like setting. Good views. Must see",
12
+ "BuildingAreaTotal": "924.0",
13
+ "YearBuilt": 1977,
14
+ "StreetName": "BIRCH",
15
+ "Supplement": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque auctor, nisi in fringilla accumsan, odio felis sodales massa, in aliquam nulla diam non diam. Donec sit amet sollicitudin ipsum. Pellentesque et arcu ligula, id venenatis urna. Nullam varius elementum nisl, in tempus nibh molestie eget. Donec egestas lacinia ante id accumsan. Vivamus ut mauris ante. Nam mattis porttitor nisi, consectetur venenatis enim adipiscing sed. Integer eu quam risus, non ornare magna. Nam sodales arcu non diam accumsan feugiat. Nulla vitae sem quam. Vestibulum a sem risus. Vivamus tristique malesuada quam placerat tempor. Integer ornare faucibus vestibulum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus arcu lorem, blandit eu porttitor et, tempus a enim. Mauris at varius justo. Proin ut tincidunt est. ",
16
+ "ListPrice": "50000.0",
17
+ "PostalCode": "83805",
18
+ "Latitude": "48.7001",
19
+ "BathsThreeQuarter": null,
20
+ "BathsFull": null,
21
+ "BathsTotal": "1.0",
22
+ "StateOrProvince": "ID",
23
+ "PropertyType": "A",
24
+ "StreetAdditionalInfo": null,
25
+ "StreetDirPrefix": null,
26
+ "BedsTotal": 3,
27
+ "StreetDirSuffix": null,
28
+ "ListingKey": "20060725224713296297000000",
29
+ "ListOfficeName": "Century 21 On The Lake",
30
+ "BathsHalf": null,
31
+ "ModificationTimestamp": "2011-01-05T14:39:55Z",
32
+ "CountyOrParish": "Boundary"
33
+ },
34
+ "Id": "20060725224713296297000000"
35
+ }
36
+ ],
37
+ "Success": true
38
+ }
39
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "D": {
3
+ "Results": [
4
+ {
5
+ "ResourceUri": "/v1/listings/20060813163018826257000000",
6
+ "StandardFields": {
7
+ "StreetNumber": "2755",
8
+ "Longitude": "-116.7506",
9
+ "City": "Hayden",
10
+ "ListingId": "06-10376",
11
+ "PublicRemarks": "Incredible horse estate in Hayden. Over 14 acres with panoramic views. Cape Cod style residence, 4500+ sq ft w/4 bdrms, 4.5 baths. 82x60 horse barn, heated with hayloft & lg guest house. 70x160 indoor horse arean, heated, viewing area boasts large river rock fireplace & bbq area. The Ultimate in luxury living!",
12
+ "BuildingAreaTotal": "5400.0",
13
+ "YearBuilt": 1996,
14
+ "StreetName": "SPRING ROCK LN",
15
+ "ListPrice": "2950000.0",
16
+ "PostalCode": "83835",
17
+ "Videos": [
18
+ {
19
+ "ResourceUri": "/v1/listings/20060813163018826257000000/videos/20110103201412297033000000",
20
+ "Name": "Ode to joy",
21
+ "Id": "20110103201412297033000000",
22
+ "Caption": "All awesome",
23
+ "ObjectHtml": "<object width='640' height='385'><param name='movie' value='http://www.youtube.com/v/xpcUxwpOQ_A?fs=1&amp;hl=en_US'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/xpcUxwpOQ_A?fs=1&amp;hl=en_US' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='640' height='385'></embed></object>"
24
+ },
25
+ {
26
+ "ResourceUri": "/v1/listings/20060813163018826257000000/videos/20110103201413206052000000",
27
+ "Name": "Ode to joy",
28
+ "Id": "20110103201413206052000000",
29
+ "Caption": "All awesome",
30
+ "ObjectHtml": "<object width='640' height='385'><param name='movie' value='http://www.youtube.com/v/tgbNymZ7vqY?fs=1&amp;hl=en_US'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/tgbNymZ7vqY?fs=1&amp;hl=en_US' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='640' height='385'></embed></object>"
31
+ }
32
+ ],
33
+ "Latitude": "47.7959",
34
+ "BathsThreeQuarter": null,
35
+ "BathsFull": null,
36
+ "BathsTotal": "4.5",
37
+ "StateOrProvince": "ID",
38
+ "PropertyType": "A",
39
+ "StreetAdditionalInfo": null,
40
+ "StreetDirPrefix": "E",
41
+ "BedsTotal": 4,
42
+ "StreetDirSuffix": null,
43
+ "ListingKey": "20060813163018826257000000",
44
+ "ListOfficeName": "Coldwell Banker Schneidmiller Realty",
45
+ "BathsHalf": null,
46
+ "ModificationTimestamp": "2010-11-22T20:52:54Z",
47
+ "CountyOrParish": "Kootenai"
48
+ },
49
+ "Id": "20060813163018826257000000"
50
+ }
51
+ ],
52
+ "Success": true
53
+ }
54
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "D": {
3
+ "Results": [
4
+ {
5
+ "ResourceUri": "/v1/listings/20060725224713296297000000",
6
+ "StandardFields": {
7
+ "StreetNumber": "7298",
8
+ "Longitude": "-116.3237",
9
+ "City": "Bonners Ferry",
10
+ "ListingId": "06-9395",
11
+ "PublicRemarks": "Afforadable home in town close to hospital,yet quiet country like setting. Good views. Must see",
12
+ "BuildingAreaTotal": "924.0",
13
+ "YearBuilt": 1977,
14
+ "StreetName": "BIRCH",
15
+ "ListPrice": "50000.0",
16
+ "PostalCode": "83805",
17
+ "VirtualTourURLBranded": "http://www.youtube.com/watch?v=T9uuPza41Uw#t=2s",
18
+ "Latitude": "48.7001",
19
+ "BathsThreeQuarter": null,
20
+ "BathsFull": null,
21
+ "BathsTotal": "1.0",
22
+ "StateOrProvince": "ID",
23
+ "PropertyType": "A",
24
+ "StreetAdditionalInfo": null,
25
+ "StreetDirPrefix": null,
26
+ "BedsTotal": 3,
27
+ "StreetDirSuffix": null,
28
+ "ListingKey": "20060725224713296297000000",
29
+ "ListOfficeName": "Century 21 On The Lake",
30
+ "BathsHalf": null,
31
+ "ModificationTimestamp": "2011-01-05T14:54:42Z",
32
+ "VirtualTours": [
33
+ {
34
+ "Uri": "http://www.youtube.com/watch?v=T9uuPza41Uw#t=2s",
35
+ "ResourceUri": "/v1/listings/20060725224713296297000000/virtualtours/20110105205442147801000000",
36
+ "Name": "Samuel L",
37
+ "Id": "20110105205442147801000000",
38
+ "Type": "branded"
39
+ }
40
+ ],
41
+ "CountyOrParish": "Boundary"
42
+ },
43
+ "Id": "20060725224713296297000000"
44
+ }
45
+ ],
46
+ "Success": true
47
+ }
48
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "D": {
3
+ "Results": [{
4
+ "Roles": ["basic"],
5
+ "Expires": "2010-12-30T11:18:49-06:00",
6
+ "AuthToken": "c401736bf3d3f754f07c04e460e09573"
7
+ }],
8
+ "Success": true
9
+ }
10
+ }
@@ -0,0 +1,77 @@
1
+
2
+ class ListingJson
3
+ @counter = 0
4
+ def self.next_tech_id()
5
+ "#{@counter + 20110101000000000000}000000"
6
+ end
7
+ def self.next_list_id()
8
+ "06-#{@counter + 1000}"
9
+ end
10
+ def self.bump()
11
+ @counter += 1
12
+ end
13
+
14
+ def self.create
15
+ bump
16
+ json = <<-JSON
17
+ {
18
+ "ResourceUri": "/v1/listings/#{next_tech_id}",
19
+ "StandardFields": #{standard_fields},
20
+ "Id": "#{next_tech_id}"
21
+ }
22
+ JSON
23
+
24
+ end
25
+
26
+ def self.create_all(count = 1)
27
+ listings = []
28
+ count.times { listings << create }
29
+ json = listings * ","
30
+ end
31
+
32
+ private
33
+ def self.standard_fields
34
+ json = <<-JSON
35
+ {
36
+ "StreetNumber": "7298",
37
+ "Longitude": "-116.3237",
38
+ "City": "Bonners Ferry",
39
+ "ListingId": "#{next_list_id}",
40
+ "PublicRemarks": "Afforadable home in town close to hospital,yet quiet country like setting. Good views. Must see",
41
+ "BuildingAreaTotal": 924.0,
42
+ "YearBuilt": 1977,
43
+ "StreetName": "BIRCH",
44
+ "ListPrice": 50000.0,
45
+ "PostalCode": 83805,
46
+ "Latitude": "48.7001",
47
+ "BathsThreeQuarter": null,
48
+ "BathsFull": 1.0,
49
+ "BathsTotal": 1.0,
50
+ "StateOrProvince": "ID",
51
+ "PropertyType": "A",
52
+ "StreetAdditionalInfo": null,
53
+ "StreetDirPrefix": null,
54
+ "BedsTotal": 3,
55
+ "StreetDirSuffix": null,
56
+ "ListingKey": "#{next_tech_id}",
57
+ "ListOfficeName": "Century 21 On The Lake",
58
+ "BathsHalf": null,
59
+ "ModificationTimestamp": "2010-11-22T20:47:21Z",
60
+ "CountyOrParish": "Boundary"
61
+ }
62
+ JSON
63
+ end
64
+
65
+ end
66
+
67
+ def paginate_json(current_page = 1)
68
+ json = <<-JSON
69
+ "Pagination": {
70
+ "TotalRows": 38,
71
+ "PageSize": 10,
72
+ "TotalPages": 4,
73
+ "CurrentPage": #{current_page}
74
+ }
75
+ JSON
76
+ end
77
+