nineflats-api 0.0.3 → 0.0.4

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.
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+
3
+ describe Nineflats::Place do
4
+ before(:each) do
5
+ Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
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",
8
+ :body => Fixtures.place
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
+ end
15
+
16
+ describe "prices" do
17
+ before(:each) do
18
+ @place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
19
+ end
20
+
21
+ it "should add the basic prices to the place" do
22
+ @place.prices.currency.should == "EUR"
23
+ @place.prices.default_price.should == 90.0
24
+ @place.prices.weekend_night_price.should == 90.0
25
+ @place.prices.weekly_discount_in_percent.should == 5.55
26
+ @place.prices.monthly_discount_in_percent.should == 11.11
27
+ end
28
+
29
+ it "should add the seasons" do
30
+ @place.prices.seasons.length.should == 2
31
+ @place.prices.seasons[0].from.should == "2011-09-05"
32
+ @place.prices.seasons[0].to.should == "2011-09-30"
33
+ @place.prices.seasons[0].price.should == 100.0
34
+ @place.prices.seasons[0].weekend_night_price.should == 110.0
35
+ @place.prices.seasons[1].from.should == "2011-10-01"
36
+ @place.prices.seasons[1].to.should == "2011-10-31"
37
+ @place.prices.seasons[1].price.should == 75.0
38
+ @place.prices.seasons[1].weekend_night_price.should == 75.0
39
+ end
40
+
41
+ it "should return an empty seasons array when there are no seasons" do
42
+ FakeWeb.register_uri(:get,
43
+ "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=#{Nineflats::Base.client_app_key}",
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
+ )
46
+
47
+ @place.prices.seasons.should == []
48
+ end
49
+
50
+ it "should return nil when the API call fails" do
51
+ FakeWeb.register_uri(:get,
52
+ "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=#{Nineflats::Base.client_app_key}",
53
+ :body => ''
54
+ )
55
+
56
+ @place.prices.should == nil
57
+ end
58
+
59
+ it "should cache the prices" do
60
+ Nineflats::Helpers.should_receive(:get_data).and_return(JSON.parse(Fixtures.place_prices))
61
+ @place.prices
62
+
63
+ Nineflats::Helpers.should_not_receive(:get_data)
64
+ @place.prices
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe Nineflats::Place do
4
+ before(:each) do
5
+ Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
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",
8
+ :body => Fixtures.place
9
+ )
10
+ FakeWeb.register_uri(:get,
11
+ "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=#{Nineflats::Base.client_app_key}",
12
+ :body => Fixtures.place_reviews
13
+ )
14
+ end
15
+
16
+ describe "reviews" do
17
+ before(:each) do
18
+ @place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
19
+ end
20
+
21
+ it "should add the reviews" do
22
+ @place.reviews.length.should == 2
23
+
24
+ @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
+ @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
+ @place.reviews[0].place_stars.should == 5
27
+ @place.reviews[0].language.should == "en"
28
+ @place.reviews[1].language.should == "de"
29
+ end
30
+
31
+ it "should return an empty array when there are no reviews" do
32
+ FakeWeb.register_uri(:get,
33
+ "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=#{Nineflats::Base.client_app_key}",
34
+ :body => '{"total_entries":0,"reviews":[]}'
35
+ )
36
+
37
+ @place.reviews.should == []
38
+ end
39
+
40
+ it "should return nil when the API call fails" do
41
+ FakeWeb.register_uri(:get,
42
+ "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=#{Nineflats::Base.client_app_key}",
43
+ :body => ''
44
+ )
45
+
46
+ @place.reviews.should == nil
47
+ end
48
+
49
+ it "should cache the reviews" do
50
+ Nineflats::Helpers.should_receive(:get_data).and_return(JSON.parse(Fixtures.place_reviews))
51
+ @place.reviews
52
+
53
+ Nineflats::Helpers.should_not_receive(:get_data)
54
+ @place.reviews
55
+ end
56
+ end
57
+ end
data/spec/place_spec.rb CHANGED
@@ -4,12 +4,8 @@ describe Nineflats::Place do
4
4
  before(:each) do
5
5
  Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
6
6
  FakeWeb.register_uri(:get,
7
- "http://api.9flats.com/api/places/apt-no-centro-histrico-de-lisboa.json?client_id=#{Nineflats::Base.client_app_key}&language=en",
8
- :body => place_fixture
9
- )
10
- FakeWeb.register_uri(:get,
11
- "http://api.9flats.com/api/places/apt-no-centro-histrico-de-lisboa/prices.json?client_id=#{Nineflats::Base.client_app_key}",
12
- :body => place_prices_fixture
7
+ "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=#{Nineflats::Base.client_app_key}&lang=en",
8
+ :body => Fixtures.place
13
9
  )
14
10
  end
15
11
 
@@ -45,18 +41,24 @@ describe Nineflats::Place do
45
41
  @place.bathroom_type.should == "Private"
46
42
  @place.cleaning_fee.should == nil
47
43
  @place.charge_per_extra_person_limit.should == 4
48
- @place.favorites_count.should == 2
49
- @place.amenities_list.should == ["Internet", "Wifi (Wireless LAN)", "TV", "Air Conditioning", "Kitchen", "Washer", "Smoking allowed", "Pets allowed", "Balcony", "Dishwasher", "Fridge/freezer", "Shower/bathtub", "Baby crib", "Panoramic view"]
50
- @place.featured_photo_url.should == "/data/place_photos/photos/62387-1311446301/medium.jpg"
44
+ @place.favorites_count.should == 5
45
+ @place.amenities_list.should == ["Internet", "Wifi (Wireless LAN)", "TV", "Air Conditioning", "Kitchen", "Washer", "Smoking allowed", "Family/Kid friendly", "Pets allowed", "Balcony", "Dishwasher", "Fridge/freezer", "Shower/bathtub", "Baby crib", "Final cleaning", "Panoramic view", "Gay friendly"]
46
+ @place.featured_photo_url.should == "http://img1.9flats.com/place_photos/photos/62387-1311446301/medium.jpg"
51
47
  @place.price.should == 90.0
52
48
  @place.country.should == "Portugal"
53
49
  @place.category.should == "Apartment"
54
50
  @place.place_type.should == "Entire place"
51
+ @place.description.should == "Panoramic terrace in the historic center of Lisbon, close to Subway and Airport"
55
52
  end
56
53
 
57
54
  it "should set the links" do
58
- @place.self_url = "http://www.9flats.com/api/places/apt-no-centro-histrico-de-lisboa?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
59
- @place.full_url = "http://www.9flats.com/places/apt-no-centro-histrico-de-lisboa"
55
+ @place.self_url.should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
56
+ @place.full_url.should == "http://www.9flats.com/places/apt-no-centro-histrico-de-lisboa"
57
+ @place.photos_url.should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/photos?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
58
+ @place.prices_url.should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/prices?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
59
+ @place.reviews_url.should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/reviews?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
60
+ @place.calendar_current_month_url.should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/10?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
61
+ @place.calendar_next_month_url.should == "http://api.9flats.com/api/v1/places/apt-no-centro-histrico-de-lisboa/calendar/2011/11?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
60
62
  end
61
63
 
62
64
  it "should set the host" do
@@ -65,30 +67,4 @@ describe Nineflats::Place do
65
67
  @place.host.slug.should == "paulo-m"
66
68
  end
67
69
  end
68
-
69
- describe "prices" do
70
- before(:each) do
71
- @place = Nineflats::Place.fetch('apt-no-centro-histrico-de-lisboa', 'en')
72
- end
73
-
74
- it "should add the basic prices to the place" do
75
- @place.prices.currency.should == "EUR"
76
- @place.prices.default_price.should == 90.0
77
- @place.prices.weekend_night_price.should == 90.0
78
- @place.prices.weekly_discount_in_percent.should == 5.55
79
- @place.prices.monthly_discount_in_percent.should == 11.11
80
- end
81
-
82
- it "should add the seasons" do
83
- @place.prices.seasons.length.should == 2
84
- @place.prices.seasons[0].from.should == "2011-09-05"
85
- @place.prices.seasons[0].to.should == "2011-09-30"
86
- @place.prices.seasons[0].price.should == 100.0
87
- @place.prices.seasons[0].weekend_night_price.should == 110.0
88
- @place.prices.seasons[1].from.should == "2011-10-01"
89
- @place.prices.seasons[1].to.should == "2011-10-31"
90
- @place.prices.seasons[1].price.should == 75.0
91
- @place.prices.seasons[1].weekend_night_price.should == 75.0
92
- end
93
- end
94
70
  end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe Nineflats::Place do
4
+ before(:each) do
5
+ Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
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
+
17
+ context "correct query" do
18
+ before(:each) do
19
+ FakeWeb.register_uri(:get,
20
+ "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",
21
+ :body => Fixtures.search_result
22
+ )
23
+ @result = Nineflats::Place.search({:query => "Siena", :number_of_beds => 3, :currency => "USD"})
24
+ end
25
+
26
+ it "should return an array of places" do
27
+ @result.length.should == 9
28
+ @result.first.class.should == Nineflats::Place
29
+ @result.first.city.should == "Siena"
30
+ @result.first.slug.should == "splendida-villa-toscana-"
31
+ end
32
+
33
+ it "should return an array that has more information about the search result" do
34
+ @result.total_entries.should == 28
35
+ @result.total_pages.should == 4
36
+ @result.current_page.should == 1
37
+ @result.per_page.should == 9
38
+ @result.self_url.should == "http://api.9flats.com/api/v1/places?client_id=#{Nineflats::Base.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
+ @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=#{Nineflats::Base.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
+ end
42
+
43
+ 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=#{Nineflats::Base.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
+ :body => Fixtures.search_result
47
+ )
48
+
49
+ @result.next_page.length.should == 9
50
+ @result.next_page.first.class.should == Nineflats::Place
51
+ @result.next_page.first.city.should == "Siena"
52
+ @result.next_page.first.slug.should == "splendida-villa-toscana-"
53
+ end
54
+ end
55
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,10 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
1
  require 'fakeweb'
4
2
  require 'nineflats-api'
5
-
6
- Dir["spec/fixtures/*.rb"].each {|f| require File.expand_path(f) }
3
+ require 'fixtures'
7
4
 
8
5
  RSpec.configure do |config|
9
6
  #
10
7
  end
8
+
9
+ # make sure no request is sent to the API
10
+ FakeWeb.allow_net_connect = false
data/spec/user_spec.rb CHANGED
@@ -4,14 +4,14 @@ describe Nineflats::User do
4
4
  before(:each) do
5
5
  Nineflats::Base.stub!(:client_app_key).and_return("WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S")
6
6
  FakeWeb.register_uri(:get,
7
- "http://api.9flats.com/api/users/jana-k-1.json?client_id=#{Nineflats::Base.client_app_key}&language=en",
8
- :body => user_fixture
7
+ "http://api.9flats.com/api/v1/users/jana-k-1?client_id=#{Nineflats::Base.client_app_key}",
8
+ :body => Fixtures.user
9
9
  )
10
10
  end
11
11
 
12
12
  describe "fetch" do
13
13
  before(:each) do
14
- @user = Nineflats::User.fetch('jana-k-1', 'en')
14
+ @user = Nineflats::User.fetch('jana-k-1')
15
15
  end
16
16
 
17
17
  it "should return a user" do
@@ -21,12 +21,58 @@ describe Nineflats::User do
21
21
  it "should set all the attributes" do
22
22
  @user.name.should == "Jana K."
23
23
  @user.slug.should == "jana-k-1"
24
- @user.user_photo_url.should == "http://img2.9flats.com/users/photos/11405-1311181665/medium.jpg"
24
+ @user.user_photo_url.should == "http://img3.9flats.com/users/photos/11405-1311181665/medium.jpg"
25
25
  end
26
26
 
27
27
  it "should set the links" do
28
- @user.self_url = "http://www.9flats.com/places/jana-k-1"
29
- @user.favorites_url = "http://www.9flats.com/places/jana-k-1/favorites"
28
+ @user.self_url.should == "http://api.9flats.com/api/v1/users/jana-k-1?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
29
+ @user.full_url.should == "http://www.9flats.com/users/jana-k-1"
30
+ @user.favorites_url.should == "http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
31
+ end
32
+ end
33
+
34
+ describe "favorites" do
35
+ before(:each) do
36
+ FakeWeb.register_uri(:get,
37
+ "http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=#{Nineflats::Base.client_app_key}",
38
+ :body => Fixtures.user_favorites
39
+ )
40
+ @user = Nineflats::User.fetch('jana-k-1')
41
+ end
42
+
43
+ it "should add the favorite places" do
44
+ @user.favorites.length.should == 7
45
+
46
+ @user.favorites[0].class.should == Nineflats::Place
47
+ @user.favorites[0].name.should == "Maison de charme"
48
+ @user.favorites[0].city.should == "Olargues"
49
+ @user.favorites[1].slug.should == "55qm-loftwohnung"
50
+ end
51
+
52
+ it "should return an empty array when there are no favorites" do
53
+ FakeWeb.register_uri(:get,
54
+ "http://api.9flats.com/api/v1/users/jana-k-1/favorites?client_id=#{Nineflats::Base.client_app_key}",
55
+ :body => '{"places":[]}'
56
+ )
57
+
58
+ @user.favorites.should == []
59
+ end
60
+
61
+ it "should return nil when the API call fails" do
62
+ FakeWeb.register_uri(:get,
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))
72
+ @user.favorites
73
+
74
+ Nineflats::Helpers.should_not_receive(:get_data)
75
+ @user.favorites
30
76
  end
31
77
  end
32
78
  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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,41 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-12 00:00:00.000000000Z
13
- dependencies: []
12
+ date: 2011-10-17 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &2156944720 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2156944720
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2156943460 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2156943460
36
+ - !ruby/object:Gem::Dependency
37
+ name: fakeweb
38
+ requirement: &2156942040 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2156942040
14
47
  description: Let's you use the 9flats API'
15
48
  email:
16
49
  - lena@zeromail.org
@@ -20,22 +53,37 @@ extra_rdoc_files: []
20
53
  files:
21
54
  - .gitignore
22
55
  - .rspec
23
- - .rvmrc
24
56
  - Gemfile
57
+ - README.md
25
58
  - Rakefile
26
59
  - lib/nineflats-api.rb
27
60
  - lib/nineflats-api/base.rb
61
+ - lib/nineflats-api/calendar.rb
28
62
  - lib/nineflats-api/helpers.rb
63
+ - lib/nineflats-api/paginated_array.rb
64
+ - lib/nineflats-api/photo.rb
29
65
  - lib/nineflats-api/place.rb
30
66
  - lib/nineflats-api/prices.rb
67
+ - lib/nineflats-api/review.rb
31
68
  - lib/nineflats-api/season.rb
32
69
  - lib/nineflats-api/user.rb
33
70
  - lib/nineflats-api/version.rb
34
71
  - nineflats-api.gemspec
35
- - spec/fixtures/place.rb
36
- - spec/fixtures/place_prices.rb
37
- - spec/fixtures/user.rb
72
+ - spec/fixtures.rb
73
+ - spec/fixtures/place.json
74
+ - spec/fixtures/place_calendar.json
75
+ - spec/fixtures/place_photos.json
76
+ - spec/fixtures/place_prices.json
77
+ - spec/fixtures/place_reviews.json
78
+ - spec/fixtures/search_result.json
79
+ - spec/fixtures/user.json
80
+ - spec/fixtures/user_favorites.json
81
+ - spec/place_calendar_spec.rb
82
+ - spec/place_photos_spec.rb
83
+ - spec/place_prices_spec.rb
84
+ - spec/place_reviews_spec.rb
38
85
  - spec/place_spec.rb
86
+ - spec/search_spec.rb
39
87
  - spec/spec_helper.rb
40
88
  - spec/user_spec.rb
41
89
  homepage: http://9flats.github.com/api_docs/index.html
@@ -50,22 +98,39 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
98
  - - ! '>='
51
99
  - !ruby/object:Gem::Version
52
100
  version: '0'
101
+ segments:
102
+ - 0
103
+ hash: -743916347208877967
53
104
  required_rubygems_version: !ruby/object:Gem::Requirement
54
105
  none: false
55
106
  requirements:
56
107
  - - ! '>='
57
108
  - !ruby/object:Gem::Version
58
109
  version: '0'
110
+ segments:
111
+ - 0
112
+ hash: -743916347208877967
59
113
  requirements: []
60
- rubyforge_project: nineflats-api
114
+ rubyforge_project:
61
115
  rubygems_version: 1.8.10
62
116
  signing_key:
63
117
  specification_version: 3
64
118
  summary: 9flats API
65
119
  test_files:
66
- - spec/fixtures/place.rb
67
- - spec/fixtures/place_prices.rb
68
- - spec/fixtures/user.rb
120
+ - spec/fixtures.rb
121
+ - spec/fixtures/place.json
122
+ - spec/fixtures/place_calendar.json
123
+ - spec/fixtures/place_photos.json
124
+ - spec/fixtures/place_prices.json
125
+ - spec/fixtures/place_reviews.json
126
+ - spec/fixtures/search_result.json
127
+ - spec/fixtures/user.json
128
+ - spec/fixtures/user_favorites.json
129
+ - spec/place_calendar_spec.rb
130
+ - spec/place_photos_spec.rb
131
+ - spec/place_prices_spec.rb
132
+ - spec/place_reviews_spec.rb
69
133
  - spec/place_spec.rb
134
+ - spec/search_spec.rb
70
135
  - spec/spec_helper.rb
71
136
  - spec/user_spec.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use --create ruby-1.9.2-p180-patched@lysbon
@@ -1,47 +0,0 @@
1
- def place_fixture
2
- '{
3
- "place": {
4
- "name": "Great river view, Colorful and Cozy",
5
- "city": "Lisboa",
6
- "slug": "apt-no-centro-histrico-de-lisboa",
7
- "zipcode": "1100-188",
8
- "number_of_beds": 4,
9
- "number_of_bedrooms": 1,
10
- "currency": "EUR",
11
- "lat": 38.7173993,
12
- "lng": -9.1204621,
13
- "district": "",
14
- "number_of_bathrooms": 1,
15
- "minimum_nights": 2,
16
- "maximum_nights": 365,
17
- "bed_type": "Real bed",
18
- "size": 70.0,
19
- "house_rules": "",
20
- "pets_around": false,
21
- "bathroom_type": "Private",
22
- "cleaning_fee": null,
23
- "charge_per_extra_person_limit": 4,
24
- "favorites_count": 2,
25
- "amenities_list": ["Internet", "Wifi (Wireless LAN)", "TV", "Air Conditioning", "Kitchen", "Washer", "Smoking allowed", "Pets allowed", "Balcony", "Dishwasher", "Fridge/freezer", "Shower/bathtub", "Baby crib", "Panoramic view"],
26
- "featured_photo_url": "/data/place_photos/photos/62387-1311446301/medium.jpg",
27
- "price": 90.0,
28
- "charge_per_extra_person": 20.0,
29
- "content_language": "en",
30
- "country": "Portugal",
31
- "category": "Apartment",
32
- "place_type": "Entire place",
33
- "links": [{
34
- "rel": "self",
35
- "href": "http://www.9flats.com/api/places/apt-no-centro-histrico-de-lisboa?client_id=WfKWrPywnEbMhlifGlrsLu2ULfvTwxrKQji5eg0S"
36
- },
37
- {
38
- "rel": "full",
39
- "href": "http://www.9flats.com/places/apt-no-centro-histrico-de-lisboa"
40
- }],
41
- "host": {
42
- "name": "Paulo M.",
43
- "slug": "paulo-m"
44
- }
45
- }
46
- }'
47
- end
@@ -1,27 +0,0 @@
1
- def place_prices_fixture
2
- '{
3
- "place_prices": {
4
- "currency": "EUR",
5
- "default_price": 90.0,
6
- "weekend_night_price": 90.0,
7
- "weekly_discount_in_percent": 5.55,
8
- "monthly_discount_in_percent": 11.11,
9
- "seasons": [{
10
- "season": {
11
- "from": "2011-09-05",
12
- "to": "2011-09-30",
13
- "price": 100.0,
14
- "weekend_night_price": 110.0
15
- }
16
- },
17
- {
18
- "season": {
19
- "from": "2011-10-01",
20
- "to": "2011-10-31",
21
- "price": 75.0,
22
- "weekend_night_price": 75.0
23
- }
24
- }]
25
- }
26
- }'
27
- end
@@ -1,17 +0,0 @@
1
- def user_fixture
2
- '{
3
- "user": {
4
- "name": "Jana K.",
5
- "slug": "jana-k-1",
6
- "user_photo_url": "http://img2.9flats.com/users/photos/11405-1311181665/medium.jpg",
7
- "links": [{
8
- "rel": "self",
9
- "href": "http://www.9flats.com/api/users/jana-k-1"
10
- },
11
- {
12
- "rel": "favorites",
13
- "href": "http://www.9flats.com/api/users/jana-k-1/favorites"
14
- }]
15
- }
16
- }'
17
- end