nineflats-api 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "user_photo_url": "http://img3.9flats.com/users/photos/11405-1311181665/medium.jpg",
6
6
  "links": [{
7
7
  "rel": "self",
8
- "href": "http://api.9flats.com/api/v1/users/jana-k-1?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
8
+ "href": "http://api.9flats.com/api/v1/users/jana-k-1?client_id=client_app_key"
9
9
  },
10
10
  {
11
11
  "rel": "full",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  {
15
15
  "rel": "favorites",
16
- "href": "http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
16
+ "href": "http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=client_app_key"
17
17
  }]
18
18
  }
19
19
  }
@@ -0,0 +1,107 @@
1
+ {
2
+ "bookings": [
3
+ {
4
+ "booking": {
5
+ "checkin_date": "04/26/2011",
6
+ "checkout_date": "04/27/2011",
7
+ "host": {
8
+ "name":
9
+ "Lys B."
10
+ },
11
+ "links":[
12
+ {
13
+ "href": "http://www.localhost.com:3000/api/v1/users/alto-a/bookings/86f1cdc5?client_id=rdmbSMxIFeJDvQKnBvLBA8NeXQ5ijcnPMtZY0Usg",
14
+ "rel": "self"
15
+ },
16
+ {
17
+ "href": "http://www.localhost.com:3000/bookings/86f1cdc5",
18
+ "rel": "full"
19
+ }
20
+ ],
21
+ "nights": 1,
22
+ "number_of_guests": 1,
23
+ "place": {
24
+ "city": "Hamburg",
25
+ "country": "Germany",
26
+ "district": "",
27
+ "links": [
28
+ {
29
+ "href": "http://www.localhost.com:3000/api/v1/places/6-apartment-hamburg-neustadt?client_id=rdmbSMxIFeJDvQKnBvLBA8NeXQ5ijcnPMtZY0Usg",
30
+ "rel": "self"
31
+ },
32
+ {
33
+ "href": "http://www.localhost.com:3000/places/6-apartment-hamburg-neustadt",
34
+ "rel": "full"
35
+ }
36
+ ],
37
+ "name": "Unser kleines Zimmer",
38
+ "slug": "unser-kleines-zimmer",
39
+ "state": null,
40
+ "zipcode": "20355"
41
+ },
42
+ "status": "Uncompleted",
43
+ "total" :{
44
+ "currency": "EUR",
45
+ "value": 80.99
46
+ }
47
+ }
48
+ },
49
+ {
50
+ "booking": {
51
+ "checkin_date": "01/26/2011",
52
+ "checkout_date": "01/27/2011",
53
+ "host": {
54
+ "name":
55
+ "Lys B."
56
+ },
57
+ "links":[
58
+ {
59
+ "href": "http://www.localhost.com:3000/api/v1/users/alto-a/bookings/86f1cdsos?client_id=rdmbSMxIFeJDvQKnBvLBA8NeXQ5ijcnPMtZY0Usg",
60
+ "rel": "self"
61
+ },
62
+ {
63
+ "href": "http://www.localhost.com:3000/bookings/86f1cdsos",
64
+ "rel": "full"
65
+ }
66
+ ],
67
+ "nights": 1,
68
+ "number_of_guests": 1,
69
+ "place": {
70
+ "city": "Hamburg",
71
+ "country": "Germany",
72
+ "district": "",
73
+ "links": [
74
+ {
75
+ "href": "http://www.localhost.com:3000/api/v1/places/6-apartment-hamburg-neustadt?client_id=rdmbSMxIFeJDvQKnBvLBA8NeXQ5ijcnPMtZY0Usg",
76
+ "rel": "self"
77
+ },
78
+ {
79
+ "href": "http://www.localhost.com:3000/places/6-apartment-hamburg-neustadt",
80
+ "rel": "full"
81
+ }
82
+ ],
83
+ "name": "Unser kleines Zimmer",
84
+ "slug": "unser-kleines-zimmer",
85
+ "state": null,
86
+ "zipcode": "20355"
87
+ },
88
+ "status": "Uncompleted",
89
+ "total" :{
90
+ "currency": "USD",
91
+ "value": 180.99
92
+ }
93
+ }
94
+ }
95
+ ],
96
+ "links":[
97
+ {
98
+ "href": "http://www.localhost.com:3000/api/v1/users/alto-a/bookings?client_id=rdmbSMxIFeJDvQKnBvLBA8NeXQ5ijcnPMtZY0Usg",
99
+ "rel": "self"
100
+ },
101
+ {
102
+ "href": "http://www.localhost.com:3000/api/v1/users/alto-a?client_id=rdmbSMxIFeJDvQKnBvLBA8NeXQ5ijcnPMtZY0Usg",
103
+ "rel": "user"
104
+ }
105
+ ],
106
+ "total_entries": 2
107
+ }
@@ -33,7 +33,7 @@
33
33
  "place_type": "Entire place",
34
34
  "links": [{
35
35
  "rel": "self",
36
- "href": "http://www.9flats.com/api/v1/places/maison-de-charme?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
36
+ "href": "http://www.9flats.com/api/v1/places/maison-de-charme?client_id=client_app_key"
37
37
  },
38
38
  {
39
39
  "rel": "full",
@@ -41,23 +41,23 @@
41
41
  },
42
42
  {
43
43
  "rel": "photos",
44
- "href": "http://www.9flats.com/api/v1/places/maison-de-charme/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
44
+ "href": "http://www.9flats.com/api/v1/places/maison-de-charme/photos?client_id=client_app_key"
45
45
  },
46
46
  {
47
47
  "rel": "prices",
48
- "href": "http://www.9flats.com/api/v1/places/maison-de-charme/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
48
+ "href": "http://www.9flats.com/api/v1/places/maison-de-charme/prices?client_id=client_app_key"
49
49
  },
50
50
  {
51
51
  "rel": "reviews",
52
- "href": "http://www.9flats.com/api/v1/places/maison-de-charme/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
52
+ "href": "http://www.9flats.com/api/v1/places/maison-de-charme/reviews?client_id=client_app_key"
53
53
  },
54
54
  {
55
55
  "rel": "calendar: current month",
56
- "href": "http://www.9flats.com/api/v1/places/maison-de-charme/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
56
+ "href": "http://www.9flats.com/api/v1/places/maison-de-charme/calendar/2011/10?client_id=client_app_key"
57
57
  },
58
58
  {
59
59
  "rel": "calendar: next month",
60
- "href": "http://www.9flats.com/api/v1/places/maison-de-charme/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
60
+ "href": "http://www.9flats.com/api/v1/places/maison-de-charme/calendar/2011/11?client_id=client_app_key"
61
61
  }],
62
62
  "host": {
63
63
  "name": "Aline P.",
@@ -99,7 +99,7 @@
99
99
  "place_type": "Entire place",
100
100
  "links": [{
101
101
  "rel": "self",
102
- "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
102
+ "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung?client_id=client_app_key"
103
103
  },
104
104
  {
105
105
  "rel": "full",
@@ -107,23 +107,23 @@
107
107
  },
108
108
  {
109
109
  "rel": "photos",
110
- "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
110
+ "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/photos?client_id=client_app_key"
111
111
  },
112
112
  {
113
113
  "rel": "prices",
114
- "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
114
+ "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/prices?client_id=client_app_key"
115
115
  },
116
116
  {
117
117
  "rel": "reviews",
118
- "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
118
+ "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/reviews?client_id=client_app_key"
119
119
  },
120
120
  {
121
121
  "rel": "calendar: current month",
122
- "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
122
+ "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/calendar/2011/10?client_id=client_app_key"
123
123
  },
124
124
  {
125
125
  "rel": "calendar: next month",
126
- "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
126
+ "href": "http://www.9flats.com/api/v1/places/55qm-loftwohnung/calendar/2011/11?client_id=client_app_key"
127
127
  }],
128
128
  "host": {
129
129
  "name": "Johannes M.",
@@ -165,7 +165,7 @@
165
165
  "place_type": "Entire place",
166
166
  "links": [{
167
167
  "rel": "self",
168
- "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
168
+ "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae?client_id=client_app_key"
169
169
  },
170
170
  {
171
171
  "rel": "full",
@@ -173,23 +173,23 @@
173
173
  },
174
174
  {
175
175
  "rel": "photos",
176
- "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
176
+ "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/photos?client_id=client_app_key"
177
177
  },
178
178
  {
179
179
  "rel": "prices",
180
- "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
180
+ "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/prices?client_id=client_app_key"
181
181
  },
182
182
  {
183
183
  "rel": "reviews",
184
- "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
184
+ "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/reviews?client_id=client_app_key"
185
185
  },
186
186
  {
187
187
  "rel": "calendar: current month",
188
- "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
188
+ "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/calendar/2011/10?client_id=client_app_key"
189
189
  },
190
190
  {
191
191
  "rel": "calendar: next month",
192
- "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
192
+ "href": "http://www.9flats.com/api/v1/places/city-apartment-lningstrae/calendar/2011/11?client_id=client_app_key"
193
193
  }],
194
194
  "host": {
195
195
  "name": "Ulrike T.",
@@ -231,7 +231,7 @@
231
231
  "place_type": "Private room",
232
232
  "links": [{
233
233
  "rel": "self",
234
- "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
234
+ "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051?client_id=client_app_key"
235
235
  },
236
236
  {
237
237
  "rel": "full",
@@ -239,23 +239,23 @@
239
239
  },
240
240
  {
241
241
  "rel": "photos",
242
- "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
242
+ "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/photos?client_id=client_app_key"
243
243
  },
244
244
  {
245
245
  "rel": "prices",
246
- "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
246
+ "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/prices?client_id=client_app_key"
247
247
  },
248
248
  {
249
249
  "rel": "reviews",
250
- "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
250
+ "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/reviews?client_id=client_app_key"
251
251
  },
252
252
  {
253
253
  "rel": "calendar: current month",
254
- "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
254
+ "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/calendar/2011/10?client_id=client_app_key"
255
255
  },
256
256
  {
257
257
  "rel": "calendar: next month",
258
- "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
258
+ "href": "http://www.9flats.com/api/v1/places/la-tamayo-saira-1051/calendar/2011/11?client_id=client_app_key"
259
259
  }],
260
260
  "host": {
261
261
  "name": "Mar\u00eda Isabel P.",
@@ -297,7 +297,7 @@
297
297
  "place_type": "Private room",
298
298
  "links": [{
299
299
  "rel": "self",
300
- "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
300
+ "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river?client_id=client_app_key"
301
301
  },
302
302
  {
303
303
  "rel": "full",
@@ -305,23 +305,23 @@
305
305
  },
306
306
  {
307
307
  "rel": "photos",
308
- "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
308
+ "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/photos?client_id=client_app_key"
309
309
  },
310
310
  {
311
311
  "rel": "prices",
312
- "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
312
+ "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/prices?client_id=client_app_key"
313
313
  },
314
314
  {
315
315
  "rel": "reviews",
316
- "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
316
+ "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/reviews?client_id=client_app_key"
317
317
  },
318
318
  {
319
319
  "rel": "calendar: current month",
320
- "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
320
+ "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/calendar/2011/10?client_id=client_app_key"
321
321
  },
322
322
  {
323
323
  "rel": "calendar: next month",
324
- "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
324
+ "href": "http://www.9flats.com/api/v1/places/houseboat-on-amstel-river/calendar/2011/11?client_id=client_app_key"
325
325
  }],
326
326
  "host": {
327
327
  "name": "Martin V.",
@@ -363,7 +363,7 @@
363
363
  "place_type": "Entire place",
364
364
  "links": [{
365
365
  "rel": "self",
366
- "href": "http://www.9flats.com/api/v1/places/picturesque-apartment?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
366
+ "href": "http://www.9flats.com/api/v1/places/picturesque-apartment?client_id=client_app_key"
367
367
  },
368
368
  {
369
369
  "rel": "full",
@@ -371,23 +371,23 @@
371
371
  },
372
372
  {
373
373
  "rel": "photos",
374
- "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
374
+ "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/photos?client_id=client_app_key"
375
375
  },
376
376
  {
377
377
  "rel": "prices",
378
- "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
378
+ "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/prices?client_id=client_app_key"
379
379
  },
380
380
  {
381
381
  "rel": "reviews",
382
- "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
382
+ "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/reviews?client_id=client_app_key"
383
383
  },
384
384
  {
385
385
  "rel": "calendar: current month",
386
- "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
386
+ "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/calendar/2011/10?client_id=client_app_key"
387
387
  },
388
388
  {
389
389
  "rel": "calendar: next month",
390
- "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
390
+ "href": "http://www.9flats.com/api/v1/places/picturesque-apartment/calendar/2011/11?client_id=client_app_key"
391
391
  }],
392
392
  "host": {
393
393
  "name": "Clive T.",
@@ -429,7 +429,7 @@
429
429
  "place_type": "Private room",
430
430
  "links": [{
431
431
  "rel": "self",
432
- "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
432
+ "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali?client_id=client_app_key"
433
433
  },
434
434
  {
435
435
  "rel": "full",
@@ -437,23 +437,23 @@
437
437
  },
438
438
  {
439
439
  "rel": "photos",
440
- "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
440
+ "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/photos?client_id=client_app_key"
441
441
  },
442
442
  {
443
443
  "rel": "prices",
444
- "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
444
+ "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/prices?client_id=client_app_key"
445
445
  },
446
446
  {
447
447
  "rel": "reviews",
448
- "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
448
+ "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/reviews?client_id=client_app_key"
449
449
  },
450
450
  {
451
451
  "rel": "calendar: current month",
452
- "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
452
+ "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/calendar/2011/10?client_id=client_app_key"
453
453
  },
454
454
  {
455
455
  "rel": "calendar: next month",
456
- "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
456
+ "href": "http://www.9flats.com/api/v1/places/affordable-home-in-the-real-bali/calendar/2011/11?client_id=client_app_key"
457
457
  }],
458
458
  "host": {
459
459
  "name": "suzan b.",
@@ -463,10 +463,10 @@
463
463
  }],
464
464
  "links": [{
465
465
  "rel": "self",
466
- "href": "http://www.9flats.com/api/v1/users/jana-k-1/favorites?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
466
+ "href": "http://www.9flats.com/api/v1/users/jana-k-1/favorites?client_id=client_app_key"
467
467
  },
468
468
  {
469
469
  "rel": "user",
470
- "href": "http://www.9flats.com/api/v1/users/jana-k-1?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
470
+ "href": "http://www.9flats.com/api/v1/users/jana-k-1?client_id=client_app_key"
471
471
  }]
472
472
  }
@@ -2,23 +2,24 @@ require 'spec_helper'
2
2
 
3
3
  describe Nineflats::Place do
4
4
  before(:each) do
5
- Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
5
+ Nineflats::Client.connect('client_app_key', 'client_app_secret')
6
6
  FakeWeb.register_uri(:get,
7
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=#{Nineflats::Base.client_app_key}&lang=en",
7
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=client_app_key",
8
8
  :body => Fixtures.place
9
9
  )
10
- FakeWeb.register_uri(:get,
11
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/10?client_id=#{Nineflats::Base.client_app_key}",
12
- :body => Fixtures.place_calendar
13
- )
14
10
  end
15
-
11
+
16
12
  describe "calendar" do
17
13
  before(:each) do
18
14
  @place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
19
15
  end
20
16
 
21
17
  it "should add the calendar" do
18
+ FakeWeb.register_uri(:get,
19
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/10?client_id=client_app_key",
20
+ :body => Fixtures.place_calendar
21
+ )
22
+
22
23
  @place.calendar(2011, 10).year.should == 2011
23
24
  @place.calendar(2011, 10).month.should == 10
24
25
  @place.calendar(2011, 10).days["1"].should == true
@@ -28,12 +29,12 @@ describe Nineflats::Place do
28
29
  end
29
30
 
30
31
  it "should return nil when the API call fails" do
31
- FakeWeb.register_uri(:get,
32
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/10?client_id=#{Nineflats::Base.client_app_key}",
33
- :body => ''
32
+ FakeWeb.register_uri(:get,
33
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/10?client_id=client_app_key",
34
+ :body => '{"error":"You cannot access calendars in the past!"}', :status => 422
34
35
  )
35
-
36
- @place.calendar(2011, 10).should == nil
36
+
37
+ expect { @place.calendar(2011, 10) }.to raise_error(Nineflats::Error, "You cannot access calendars in the past!")
37
38
  end
38
39
  end
39
40
  end
@@ -2,17 +2,17 @@ require 'spec_helper'
2
2
 
3
3
  describe Nineflats::Place do
4
4
  before(:each) do
5
- Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
5
+ Nineflats::Client.connect('client_app_key', 'client_app_secret')
6
6
  FakeWeb.register_uri(:get,
7
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=#{Nineflats::Base.client_app_key}&lang=en",
7
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=client_app_key",
8
8
  :body => Fixtures.place
9
9
  )
10
- FakeWeb.register_uri(:get,
11
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=#{Nineflats::Base.client_app_key}",
10
+ FakeWeb.register_uri(:get,
11
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=client_app_key",
12
12
  :body => Fixtures.place_photos
13
13
  )
14
14
  end
15
-
15
+
16
16
  describe "photos" do
17
17
  before(:each) do
18
18
  @place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
@@ -20,36 +20,35 @@ describe Nineflats::Place do
20
20
 
21
21
  it "should add the photos" do
22
22
  @place.photos.length.should == 22
23
-
24
23
  @place.photos[0].title.should == "Terrace with National Pantheon view"
25
24
  @place.photos[0].caption.should == nil
26
25
  @place.photos[0].url.should == "http://img2.9flats.com/place_photos/photos/62387-1311446301/large.jpg"
27
26
  end
28
-
27
+
29
28
  it "should return an empty array when there are no photos" do
30
- FakeWeb.register_uri(:get,
31
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=#{Nineflats::Base.client_app_key}",
29
+ FakeWeb.register_uri(:get,
30
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=client_app_key",
32
31
  :body => '{"total_entries":0,"place_photos":[]}'
33
32
  )
34
-
33
+
35
34
  @place.photos.should == []
36
35
  end
37
-
36
+
38
37
  it "should return nil when the API call fails" do
39
- FakeWeb.register_uri(:get,
40
- "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=#{Nineflats::Base.client_app_key}",
41
- :body => ''
38
+ FakeWeb.register_uri(:get,
39
+ "http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=client_app_key",
40
+ :body => '{"error":"Place not found!"}', :status => 404
42
41
  )
43
-
44
- @place.photos.should == nil
42
+
43
+ expect { @place.photos }.to raise_error(Nineflats::Error, "Place not found!")
45
44
  end
46
-
45
+
47
46
  it "should cache the places" do
48
- Nineflats::Helpers.should_receive(:get_data).and_return(JSON.parse(Fixtures.place_photos))
47
+ Nineflats::Client.should_receive(:place_photos).and_return(JSON.parse(Fixtures.place_photos))
49
48
  @place.photos
50
49
 
51
- Nineflats::Helpers.should_not_receive(:get_data)
50
+ Nineflats::Client.should_not_receive(:place_photos)
52
51
  @place.photos
53
- end
52
+ end
54
53
  end
55
54
  end