Class: Nineflats::Place

Inherits:
Base
  • Object
show all
Defined in:
lib/nineflats-api/place.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client_app_key, client_app_key=, object_link

Constructor Details

#initialize(json) ⇒ Place

Returns a new instance of Place.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/nineflats-api/place.rb', line 12

def initialize(json)
  @raw_data = json
  place = json.first[1]

  @name                          = place["name"]
  @city                          = place["city"]
  @currency                      = place["currency"]
  @slug                          = place["slug"]
  @zipcode                       = place["zipcode"]
  @number_of_beds                = place["number_of_beds"]
  @number_of_bedrooms            = place["number_of_bedrooms"]
  @number_of_bathrooms           = place["number_of_bathrooms"]
  @charge_per_extra_person       = place["charge_per_extra_person"]
  @content_language              = place["content_language"]
  @minimum_nights                = place["minimum_nights"]
  @maximum_nights                = place["maximum_nights"]
  @bed_type                      = place["bed_type"]
  @size                          = place["size"]
  @house_rules                   = place["house_rules"]
  @pets_around                   = place["pets_around"]
  @bathroom_type                 = place["bathroom_type"]
  @cleaning_fee                  = place["cleaning_fee"]
  @charge_per_extra_person_limit = place["charge_per_extra_person_limit"]
  @favorites_count               = place["favorites_count"]
  @amenities_list                = place["amenities_list"]
  @featured_photo_url            = place["featured_photo_url"]
  @price                         = place["price"]
  @country                       = place["country"]
  @category                      = place["category"]
  @place_type                    = place["place_type"]
  @lat                           = place["lat"]
  @lng                           = place["lng"]
  @district                      = place["district"]
  @description                   = place["description"]

  @host = User.new({"user" => place["host"]}) if place["host"]

  @links = {}
  place['links'].each do |link|
    @links[link['rel']] = link['href']
  end
end

Instance Attribute Details

#amenities_listObject

Returns the value of attribute amenities_list.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def amenities_list
  @amenities_list
end

#bathroom_typeObject

Returns the value of attribute bathroom_type.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def bathroom_type
  @bathroom_type
end

#bed_typeObject

Returns the value of attribute bed_type.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def bed_type
  @bed_type
end

#categoryObject

Returns the value of attribute category.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def category
  @category
end

#charge_per_extra_personObject

Returns the value of attribute charge_per_extra_person.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def charge_per_extra_person
  @charge_per_extra_person
end

#charge_per_extra_person_limitObject

Returns the value of attribute charge_per_extra_person_limit.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def charge_per_extra_person_limit
  @charge_per_extra_person_limit
end

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def city
  @city
end

#cleaning_feeObject

Returns the value of attribute cleaning_fee.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def cleaning_fee
  @cleaning_fee
end

#content_languageObject

Returns the value of attribute content_language.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def content_language
  @content_language
end

#countryObject

Returns the value of attribute country.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def country
  @country
end

#currencyObject

Returns the value of attribute currency.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def description
  @description
end

#districtObject

Returns the value of attribute district.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def district
  @district
end

#favorites_countObject

Returns the value of attribute favorites_count.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def favorites_count
  @favorites_count
end

Returns the value of attribute featured_photo_url.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def featured_photo_url
  @featured_photo_url
end

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def host
  @host
end

#house_rulesObject

Returns the value of attribute house_rules.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def house_rules
  @house_rules
end

#latObject

Returns the value of attribute lat.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def lat
  @lat
end

Returns the value of attribute links.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def links
  @links
end

#lngObject

Returns the value of attribute lng.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def lng
  @lng
end

#maximum_nightsObject

Returns the value of attribute maximum_nights.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def maximum_nights
  @maximum_nights
end

#minimum_nightsObject

Returns the value of attribute minimum_nights.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def minimum_nights
  @minimum_nights
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def name
  @name
end

#number_of_bathroomsObject

Returns the value of attribute number_of_bathrooms.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def number_of_bathrooms
  @number_of_bathrooms
end

#number_of_bedroomsObject

Returns the value of attribute number_of_bedrooms.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def number_of_bedrooms
  @number_of_bedrooms
end

#number_of_bedsObject

Returns the value of attribute number_of_beds.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def number_of_beds
  @number_of_beds
end

#pets_aroundObject

Returns the value of attribute pets_around.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def pets_around
  @pets_around
end

#photosObject

Returns the value of attribute photos.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def photos
  @photos
end

#place_typeObject

Returns the value of attribute place_type.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def place_type
  @place_type
end

#priceObject

Returns the value of attribute price.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def price
  @price
end

#pricesObject

Returns the value of attribute prices.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def prices
  @prices
end

#reviewsObject

Returns the value of attribute reviews.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def reviews
  @reviews
end

#sizeObject

Returns the value of attribute size.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def size
  @size
end

#slugObject

Returns the value of attribute slug.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def slug
  @slug
end

#zipcodeObject

Returns the value of attribute zipcode.



3
4
5
# File 'lib/nineflats-api/place.rb', line 3

def zipcode
  @zipcode
end

Class Method Details

.fetch(slug, lang) ⇒ Object



60
61
62
# File 'lib/nineflats-api/place.rb', line 60

def self.fetch(slug, lang)
  Nineflats::Client.place(slug, :language => lang)
end

.search(params = {}) ⇒ Object



55
56
57
# File 'lib/nineflats-api/place.rb', line 55

def self.search(params={})
  Nineflats::Client.places(params)
end

Instance Method Details

#calendar(year, month) ⇒ Object



79
80
81
# File 'lib/nineflats-api/place.rb', line 79

def calendar(year, month)
  Nineflats::Client.place_calendar(@slug, year, month)
end