nineflats-api 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nineflats-api/base.rb +4 -10
- data/lib/nineflats-api/booking.rb +27 -0
- data/lib/nineflats-api/calendar.rb +3 -7
- data/lib/nineflats-api/client.rb +9 -8
- data/lib/nineflats-api/errors.rb +1 -0
- data/lib/nineflats-api/helpers.rb +2 -0
- data/lib/nineflats-api/paginated_array.rb +1 -1
- data/lib/nineflats-api/photo.rb +1 -4
- data/lib/nineflats-api/place.rb +25 -78
- data/lib/nineflats-api/prices.rb +6 -10
- data/lib/nineflats-api/requests.rb +107 -5
- data/lib/nineflats-api/review.rb +1 -4
- data/lib/nineflats-api/user.rb +18 -22
- data/lib/nineflats-api/version.rb +1 -1
- data/spec/client_spec.rb +25 -0
- data/spec/fixtures/place.json +6 -6
- data/spec/fixtures/place_calendar.json +2 -2
- data/spec/fixtures/place_photos.json +1 -1
- data/spec/fixtures/place_prices.json +1 -1
- data/spec/fixtures/place_reviews.json +1 -1
- data/spec/fixtures/search_result.json +56 -56
- data/spec/fixtures/user.json +2 -2
- data/spec/fixtures/user_bookings.json +107 -0
- data/spec/fixtures/user_favorites.json +44 -44
- data/spec/place_calendar_spec.rb +13 -12
- data/spec/place_photos_spec.rb +19 -20
- data/spec/place_prices_spec.rb +22 -22
- data/spec/place_reviews_spec.rb +20 -21
- data/spec/place_spec.rb +14 -14
- data/spec/search_spec.rb +12 -21
- data/spec/user_spec.rb +60 -51
- metadata +17 -12
data/spec/place_prices_spec.rb
CHANGED
@@ -2,20 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Nineflats::Place do
|
4
4
|
before(:each) do
|
5
|
-
Nineflats::
|
5
|
+
Nineflats::Client.connect('client_app_key', 'client_app_secret')
|
6
6
|
FakeWeb.register_uri(:get,
|
7
|
-
"http://
|
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/prices?client_id=#{Nineflats::Base.client_app_key}",
|
12
|
-
:body => Fixtures.place_prices
|
13
|
-
)
|
14
10
|
end
|
15
|
-
|
11
|
+
|
16
12
|
describe "prices" do
|
17
13
|
before(:each) do
|
18
14
|
@place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
|
15
|
+
FakeWeb.register_uri(:get,
|
16
|
+
"http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=client_app_key",
|
17
|
+
:body => Fixtures.place_prices
|
18
|
+
)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should add the basic prices to the place" do
|
@@ -25,7 +25,7 @@ describe Nineflats::Place do
|
|
25
25
|
@place.prices.weekly_discount_in_percent.should == 5.55
|
26
26
|
@place.prices.monthly_discount_in_percent.should == 11.11
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should add the seasons" do
|
30
30
|
@place.prices.seasons.length.should == 2
|
31
31
|
@place.prices.seasons[0].from.should == "2011-09-05"
|
@@ -37,31 +37,31 @@ describe Nineflats::Place do
|
|
37
37
|
@place.prices.seasons[1].price.should == 75.0
|
38
38
|
@place.prices.seasons[1].weekend_night_price.should == 75.0
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "should return an empty seasons array when there are no seasons" do
|
42
|
-
FakeWeb.register_uri(:get,
|
43
|
-
"http://
|
42
|
+
FakeWeb.register_uri(:get,
|
43
|
+
"http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=client_app_key",
|
44
44
|
:body => '{"place_prices":{"currency":"GBP","default_price":64.71,"weekend_night_price":64.71,"weekly_discount_in_percent":null,"monthly_discount_in_percent":null,"seasons":[]}}'
|
45
45
|
)
|
46
|
-
|
46
|
+
|
47
47
|
@place.prices.seasons.should == []
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it "should return nil when the API call fails" do
|
51
|
-
FakeWeb.register_uri(:get,
|
52
|
-
"http://
|
53
|
-
:body => ''
|
51
|
+
FakeWeb.register_uri(:get,
|
52
|
+
"http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=client_app_key",
|
53
|
+
:body => '{"error":"Place not found!"}', :status => 404
|
54
54
|
)
|
55
|
-
|
56
|
-
@place.prices.
|
55
|
+
|
56
|
+
expect { @place.prices }.to raise_error(Nineflats::Error, "Place not found!")
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it "should cache the prices" do
|
60
|
-
Nineflats::
|
60
|
+
Nineflats::Client.should_receive(:place_prices).and_return(JSON.parse(Fixtures.place_prices))
|
61
61
|
@place.prices
|
62
62
|
|
63
|
-
Nineflats::
|
63
|
+
Nineflats::Client.should_not_receive(:place_prices)
|
64
64
|
@place.prices
|
65
65
|
end
|
66
66
|
end
|
67
|
-
end
|
67
|
+
end
|
data/spec/place_reviews_spec.rb
CHANGED
@@ -2,17 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Nineflats::Place do
|
4
4
|
before(:each) do
|
5
|
-
Nineflats::
|
5
|
+
Nineflats::Client.connect('client_app_key', 'client_app_secret')
|
6
6
|
FakeWeb.register_uri(:get,
|
7
|
-
"http://
|
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://
|
10
|
+
FakeWeb.register_uri(:get,
|
11
|
+
"http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=client_app_key",
|
12
12
|
:body => Fixtures.place_reviews
|
13
13
|
)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
describe "reviews" do
|
17
17
|
before(:each) do
|
18
18
|
@place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
|
@@ -20,38 +20,37 @@ describe Nineflats::Place do
|
|
20
20
|
|
21
21
|
it "should add the reviews" do
|
22
22
|
@place.reviews.length.should == 2
|
23
|
-
|
24
23
|
@place.reviews[0].user_text.should == "Jan is a really nice outgoing person. I had a great time at his place. You should ask him for that tastey Polish vodka!!"
|
25
24
|
@place.reviews[0].place_text.should == "It\'s a nice and lovely flat in a really great area of cologne. everything is in walking distance and it is great start to explore the cologne and its nightlife."
|
26
25
|
@place.reviews[0].place_stars.should == 5
|
27
26
|
@place.reviews[0].language.should == "en"
|
28
27
|
@place.reviews[1].language.should == "de"
|
29
28
|
end
|
30
|
-
|
29
|
+
|
31
30
|
it "should return an empty array when there are no reviews" do
|
32
|
-
FakeWeb.register_uri(:get,
|
33
|
-
"http://
|
31
|
+
FakeWeb.register_uri(:get,
|
32
|
+
"http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=client_app_key",
|
34
33
|
:body => '{"total_entries":0,"reviews":[]}'
|
35
34
|
)
|
36
|
-
|
35
|
+
|
37
36
|
@place.reviews.should == []
|
38
37
|
end
|
39
|
-
|
38
|
+
|
40
39
|
it "should return nil when the API call fails" do
|
41
|
-
FakeWeb.register_uri(:get,
|
42
|
-
"http://
|
43
|
-
:body => ''
|
40
|
+
FakeWeb.register_uri(:get,
|
41
|
+
"http://www.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=client_app_key",
|
42
|
+
:body => '{"error":"Place not found!"}', :status => 404
|
44
43
|
)
|
45
|
-
|
46
|
-
@place.reviews.
|
44
|
+
|
45
|
+
expect { @place.reviews }.to raise_error(Nineflats::Error, "Place not found!")
|
47
46
|
end
|
48
|
-
|
47
|
+
|
49
48
|
it "should cache the reviews" do
|
50
|
-
Nineflats::
|
49
|
+
Nineflats::Client.should_receive(:place_reviews).and_return(JSON.parse(Fixtures.place_reviews))
|
51
50
|
@place.reviews
|
52
51
|
|
53
|
-
Nineflats::
|
52
|
+
Nineflats::Client.should_not_receive(:place_reviews)
|
54
53
|
@place.reviews
|
55
|
-
end
|
54
|
+
end
|
56
55
|
end
|
57
|
-
end
|
56
|
+
end
|
data/spec/place_spec.rb
CHANGED
@@ -2,22 +2,22 @@ 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("
|
6
|
-
FakeWeb.register_uri(:get,
|
7
|
-
"http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id
|
5
|
+
Nineflats::Base.stub!(:client_app_key).and_return("client_app_key")
|
6
|
+
FakeWeb.register_uri(:get,
|
7
|
+
"http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=client_app_key&lang=en",
|
8
8
|
:body => Fixtures.place
|
9
9
|
)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
describe "fetch" do
|
13
13
|
before(:each) do
|
14
14
|
@place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should return a place" do
|
18
18
|
@place.class.should == Nineflats::Place
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should set all the attributes" do
|
22
22
|
@place.name.should == "Great river view, Colorful and Cozy"
|
23
23
|
@place.city.should == "Lisboa"
|
@@ -50,15 +50,15 @@ describe Nineflats::Place do
|
|
50
50
|
@place.place_type.should == "Entire place"
|
51
51
|
@place.description.should == "Panoramic terrace in the historic center of Lisbon, close to Subway and Airport"
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
it "should set the links" do
|
55
|
-
@place.
|
56
|
-
@place.
|
57
|
-
@place.
|
58
|
-
@place.
|
59
|
-
@place.
|
60
|
-
@place.
|
61
|
-
@place.
|
55
|
+
@place.links['self'].should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=client_app_key"
|
56
|
+
@place.links['full'].should == "http://www.9flats.com/places/apt-no-centro-histrico-de-lisboa"
|
57
|
+
@place.links['photos'].should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=client_app_key"
|
58
|
+
@place.links['prices'].should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=client_app_key"
|
59
|
+
@place.links['reviews'].should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=client_app_key"
|
60
|
+
@place.links['calendar: current month'].should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/10?client_id=client_app_key"
|
61
|
+
@place.links['calendar: next month'].should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/11?client_id=client_app_key"
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should set the host" do
|
data/spec/search_spec.rb
CHANGED
@@ -2,50 +2,41 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Nineflats::Place do
|
4
4
|
before(:each) do
|
5
|
-
Nineflats::
|
5
|
+
Nineflats::Client.connect('client_app_key', 'client_app_secret')
|
6
6
|
end
|
7
|
-
|
8
|
-
describe "search" do
|
9
|
-
it "should build the search query from the parameters" do
|
10
|
-
Nineflats::Helpers.should_receive(:get_data).with(
|
11
|
-
"http://api.9flats.com/api/v1/places?client_id=#{Nineflats::Base.client_app_key}&search[query]=Siena&search[number_of_beds]=3&search[currency]=USD"
|
12
|
-
).and_return(JSON.parse(Fixtures.search_result))
|
13
|
-
Nineflats::Place.search({:query => "Siena", :number_of_beds => 3, :currency => "USD"})
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
7
|
+
|
17
8
|
context "correct query" do
|
18
9
|
before(:each) do
|
19
|
-
FakeWeb.register_uri(:get,
|
20
|
-
"http://
|
10
|
+
FakeWeb.register_uri(:get,
|
11
|
+
"http://www.9flats.com/api/v1/places?client_id=client_app_key&search[query]=Siena&search[number_of_beds]=3&search[currency]=USD",
|
21
12
|
:body => Fixtures.search_result
|
22
13
|
)
|
23
14
|
@result = Nineflats::Place.search({:query => "Siena", :number_of_beds => 3, :currency => "USD"})
|
24
15
|
end
|
25
|
-
|
16
|
+
|
26
17
|
it "should return an array of places" do
|
27
18
|
@result.length.should == 9
|
28
19
|
@result.first.class.should == Nineflats::Place
|
29
20
|
@result.first.city.should == "Siena"
|
30
21
|
@result.first.slug.should == "splendida-villa-toscana-"
|
31
22
|
end
|
32
|
-
|
23
|
+
|
33
24
|
it "should return an array that has more information about the search result" do
|
34
25
|
@result.total_entries.should == 28
|
35
26
|
@result.total_pages.should == 4
|
36
27
|
@result.current_page.should == 1
|
37
28
|
@result.per_page.should == 9
|
38
|
-
@result.self_url.should == "http://api.9flats.com/api/v1/places?client_id
|
29
|
+
@result.self_url.should == "http://api.9flats.com/api/v1/places?client_id=client_app_key&search[amenities]=&search[bb_ne]=&search[bb_sw]=&search[currency]=USD&search[end_date]=&search[exclude_place_id]=&search[lat]=43.3186614&search[lng]=11.3305135&search[number_of_bathrooms]=0&search[number_of_bedrooms]=0&search[number_of_beds]=3&search[page]=1&search[place_type]=&search[price_max]=&search[price_min]=&search[query]=siena&search[radius]=20&search[sort_by]=top_ranking&search[start_date]=&search[woeid]="
|
39
30
|
@result.full_url.should == "http://www.9flats.com/searches?search[amenities]=&search[bb_ne]=&search[bb_sw]=&search[currency]=USD&search[end_date]=&search[exclude_place_id]=&search[lat]=43.3186614&search[lng]=11.3305135&search[number_of_bathrooms]=0&search[number_of_bedrooms]=0&search[number_of_beds]=3&search[page]=1&search[place_type]=&search[price_max]=&search[price_min]=&search[query]=siena&search[radius]=20&search[sort_by]=top_ranking&search[start_date]=&search[woeid]="
|
40
|
-
@result.next_page_url.should == "http://api.9flats.com/api/v1/places?client_id
|
31
|
+
@result.next_page_url.should == "http://api.9flats.com/api/v1/places?client_id=client_app_key&search[amenities]=&search[bb_ne]=&search[bb_sw]=&search[currency]=USD&search[end_date]=&search[exclude_place_id]=&search[lat]=43.3186614&search[lng]=11.3305135&search[number_of_bathrooms]=0&search[number_of_bedrooms]=0&search[number_of_beds]=3&search[page]=2&search[place_type]=&search[price_max]=&search[price_min]=&search[query]=siena&search[radius]=20&search[sort_by]=top_ranking&search[start_date]=&search[woeid]="
|
41
32
|
end
|
42
|
-
|
33
|
+
|
43
34
|
it "should return an array that gives access to the next page" do
|
44
|
-
FakeWeb.register_uri(:get,
|
45
|
-
"http://api.9flats.com/api/v1/places?client_id
|
35
|
+
FakeWeb.register_uri(:get,
|
36
|
+
"http://api.9flats.com/api/v1/places?client_id=client_app_key&search[amenities]=&search[bb_ne]=&search[bb_sw]=&search[currency]=USD&search[end_date]=&search[exclude_place_id]=&search[lat]=43.3186614&search[lng]=11.3305135&search[number_of_bathrooms]=0&search[number_of_bedrooms]=0&search[number_of_beds]=3&search[page]=2&search[place_type]=&search[price_max]=&search[price_min]=&search[query]=siena&search[radius]=20&search[sort_by]=top_ranking&search[start_date]=&search[woeid]=",
|
46
37
|
:body => Fixtures.search_result
|
47
38
|
)
|
48
|
-
|
39
|
+
|
49
40
|
@result.next_page.length.should == 9
|
50
41
|
@result.next_page.first.class.should == Nineflats::Place
|
51
42
|
@result.next_page.first.city.should == "Siena"
|
data/spec/user_spec.rb
CHANGED
@@ -1,78 +1,87 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Nineflats::User do
|
4
|
-
|
5
|
-
|
6
|
-
FakeWeb.register_uri(:get,
|
7
|
-
"http://api.9flats.com/api/v1/users/jana-k-1?client_id=#{Nineflats::Base.client_app_key}",
|
8
|
-
:body => Fixtures.user
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "fetch" do
|
4
|
+
|
5
|
+
describe "requesting a user" do
|
13
6
|
before(:each) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should set all the attributes" do
|
22
|
-
@user.name.should == "Jana K."
|
23
|
-
@user.slug.should == "jana-k-1"
|
24
|
-
@user.user_photo_url.should == "http://img3.9flats.com/users/photos/11405-1311181665/medium.jpg"
|
7
|
+
Nineflats::Client.connect('client_app_key', 'client_app_secret')
|
8
|
+
FakeWeb.register_uri(:get,
|
9
|
+
"http://www.9flats.com/api/v1/users/jana-k-1?client_id=client_app_key",
|
10
|
+
:body => Fixtures.user
|
11
|
+
)
|
25
12
|
end
|
26
|
-
|
27
|
-
it "should
|
28
|
-
|
29
|
-
|
30
|
-
|
13
|
+
|
14
|
+
it "should succeed" do
|
15
|
+
user = Nineflats::User.find_by_slug('jana-k-1')
|
16
|
+
user.class.should == Nineflats::User
|
17
|
+
user.name.should == 'Jana K.'
|
18
|
+
user.slug.should == "jana-k-1"
|
19
|
+
user.user_photo_url.should == "http://img3.9flats.com/users/photos/11405-1311181665/medium.jpg"
|
20
|
+
user.self_url.should == "http://api.9flats.com/api/v1/users/jana-k-1?client_id=client_app_key"
|
21
|
+
user.full_url.should == "http://www.9flats.com/users/jana-k-1"
|
22
|
+
user.favorites_url.should == "http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=client_app_key"
|
31
23
|
end
|
32
24
|
end
|
33
|
-
|
25
|
+
|
34
26
|
describe "favorites" do
|
35
27
|
before(:each) do
|
36
|
-
|
37
|
-
|
38
|
-
|
28
|
+
Nineflats::Client.connect('client_app_key', 'client_app_secret')
|
29
|
+
FakeWeb.register_uri(:get,
|
30
|
+
"http://www.9flats.com/api/v1/users/jana-k-1?client_id=client_app_key",
|
31
|
+
:body => Fixtures.user
|
39
32
|
)
|
40
|
-
@user = Nineflats::User.
|
33
|
+
@user = Nineflats::User.find_by_slug('jana-k-1')
|
41
34
|
end
|
42
|
-
|
35
|
+
|
43
36
|
it "should add the favorite places" do
|
37
|
+
FakeWeb.register_uri(:get,
|
38
|
+
"http://www.9flats.com/api/v1/users/jana-k-1/favorites?client_id=client_app_key",
|
39
|
+
:body => Fixtures.user_favorites
|
40
|
+
)
|
44
41
|
@user.favorites.length.should == 7
|
45
|
-
|
42
|
+
|
46
43
|
@user.favorites[0].class.should == Nineflats::Place
|
47
44
|
@user.favorites[0].name.should == "Maison de charme"
|
48
45
|
@user.favorites[0].city.should == "Olargues"
|
49
46
|
@user.favorites[1].slug.should == "55qm-loftwohnung"
|
50
47
|
end
|
51
|
-
|
48
|
+
|
52
49
|
it "should return an empty array when there are no favorites" do
|
53
|
-
FakeWeb.register_uri(:get,
|
54
|
-
"http://
|
50
|
+
FakeWeb.register_uri(:get,
|
51
|
+
"http://www.9flats.com/api/v1/users/jana-k-1/favorites?client_id=client_app_key",
|
55
52
|
:body => '{"places":[]}'
|
56
53
|
)
|
57
|
-
|
54
|
+
|
58
55
|
@user.favorites.should == []
|
59
56
|
end
|
60
|
-
|
61
|
-
it "should
|
62
|
-
|
63
|
-
"http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=#{Nineflats::Base.client_app_key}",
|
64
|
-
:body => ''
|
65
|
-
)
|
66
|
-
|
67
|
-
@user.favorites.should == nil
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should cache the reviews" do
|
71
|
-
Nineflats::Helpers.should_receive(:get_data).and_return(JSON.parse(Fixtures.user_favorites))
|
57
|
+
|
58
|
+
it "should cache the favorites" do
|
59
|
+
Nineflats::Client.should_receive(:user_favorites).and_return(JSON.parse(Fixtures.user_favorites))
|
72
60
|
@user.favorites
|
73
|
-
|
74
|
-
Nineflats::
|
61
|
+
|
62
|
+
Nineflats::Client.should_not_receive(:user_favorites)
|
75
63
|
@user.favorites
|
76
64
|
end
|
77
65
|
end
|
78
|
-
|
66
|
+
|
67
|
+
describe "bookings" do
|
68
|
+
before(:each) do
|
69
|
+
Nineflats::Client.connect('client_app_key', 'client_app_secret')
|
70
|
+
Nineflats::Client.client.access_token = OAuth::AccessToken.new(Nineflats::Client.consumer, 'access_token', "access_token_secret")
|
71
|
+
FakeWeb.register_uri(:get,
|
72
|
+
"http://www.9flats.com/api/v1/users/jana-k-1?client_id=client_app_key",
|
73
|
+
:body => Fixtures.user
|
74
|
+
)
|
75
|
+
@user = Nineflats::User.find_by_slug('jana-k-1')
|
76
|
+
end
|
77
|
+
|
78
|
+
it "return bookings" do
|
79
|
+
FakeWeb.register_uri(:get,
|
80
|
+
"http://www.9flats.com/api/v1/users/jana-k-1/bookings?client_id=client_app_key",
|
81
|
+
:body => Fixtures.user_bookings
|
82
|
+
)
|
83
|
+
@user.bookings.length.should == 2
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nineflats-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-07 00:00:00.000000000 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: oauth
|
18
|
-
requirement: &
|
18
|
+
requirement: &2152455640 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *2152455640
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
|
-
requirement: &
|
29
|
+
requirement: &2152454840 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 0.9.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *2152454840
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec
|
40
|
-
requirement: &
|
40
|
+
requirement: &2152439980 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *2152439980
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: fakeweb
|
51
|
-
requirement: &
|
51
|
+
requirement: &2152439360 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *2152439360
|
60
60
|
description: Let's you use the 9flats API'
|
61
61
|
email:
|
62
62
|
- lena@zeromail.org
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- Rakefile
|
72
72
|
- lib/nineflats-api.rb
|
73
73
|
- lib/nineflats-api/base.rb
|
74
|
+
- lib/nineflats-api/booking.rb
|
74
75
|
- lib/nineflats-api/calendar.rb
|
75
76
|
- lib/nineflats-api/client.rb
|
76
77
|
- lib/nineflats-api/errors.rb
|
@@ -86,6 +87,7 @@ files:
|
|
86
87
|
- lib/nineflats-api/user.rb
|
87
88
|
- lib/nineflats-api/version.rb
|
88
89
|
- nineflats-api.gemspec
|
90
|
+
- spec/client_spec.rb
|
89
91
|
- spec/fixtures.rb
|
90
92
|
- spec/fixtures/place.json
|
91
93
|
- spec/fixtures/place_calendar.json
|
@@ -94,6 +96,7 @@ files:
|
|
94
96
|
- spec/fixtures/place_reviews.json
|
95
97
|
- spec/fixtures/search_result.json
|
96
98
|
- spec/fixtures/user.json
|
99
|
+
- spec/fixtures/user_bookings.json
|
97
100
|
- spec/fixtures/user_favorites.json
|
98
101
|
- spec/place_calendar_spec.rb
|
99
102
|
- spec/place_photos_spec.rb
|
@@ -118,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
121
|
version: '0'
|
119
122
|
segments:
|
120
123
|
- 0
|
121
|
-
hash:
|
124
|
+
hash: -1190477784419182226
|
122
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
126
|
none: false
|
124
127
|
requirements:
|
@@ -127,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
130
|
version: '0'
|
128
131
|
segments:
|
129
132
|
- 0
|
130
|
-
hash:
|
133
|
+
hash: -1190477784419182226
|
131
134
|
requirements: []
|
132
135
|
rubyforge_project:
|
133
136
|
rubygems_version: 1.6.2
|
@@ -135,6 +138,7 @@ signing_key:
|
|
135
138
|
specification_version: 3
|
136
139
|
summary: 9flats API
|
137
140
|
test_files:
|
141
|
+
- spec/client_spec.rb
|
138
142
|
- spec/fixtures.rb
|
139
143
|
- spec/fixtures/place.json
|
140
144
|
- spec/fixtures/place_calendar.json
|
@@ -143,6 +147,7 @@ test_files:
|
|
143
147
|
- spec/fixtures/place_reviews.json
|
144
148
|
- spec/fixtures/search_result.json
|
145
149
|
- spec/fixtures/user.json
|
150
|
+
- spec/fixtures/user_bookings.json
|
146
151
|
- spec/fixtures/user_favorites.json
|
147
152
|
- spec/place_calendar_spec.rb
|
148
153
|
- spec/place_photos_spec.rb
|