Class: Nineflats::Prices

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

base_url, client_app_key, client_app_key=, object_link

Constructor Details

#initialize(json) ⇒ Prices

Returns a new instance of Prices.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/nineflats-api/prices.rb', line 7

def initialize(json)
  prices = json.first[1]
  
  @currency                    = prices["currency"]
  @default_price               = prices["default_price"]
  @weekend_night_price         = prices["weekend_night_price"]
  @weekly_discount_in_percent  = prices["weekly_discount_in_percent"]
  @monthly_discount_in_percent = prices["monthly_discount_in_percent"]
  
  @seasons = prices["seasons"].collect do |season|
    Season.new(season)
  end
end

Instance Attribute Details

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#default_priceObject

Returns the value of attribute default_price.



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

def default_price
  @default_price
end

#monthly_discount_in_percentObject

Returns the value of attribute monthly_discount_in_percent.



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

def monthly_discount_in_percent
  @monthly_discount_in_percent
end

#seasonsObject

Returns the value of attribute seasons.



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

def seasons
  @seasons
end

#weekend_night_priceObject

Returns the value of attribute weekend_night_price.



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

def weekend_night_price
  @weekend_night_price
end

#weekly_discount_in_percentObject

Returns the value of attribute weekly_discount_in_percent.



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

def weekly_discount_in_percent
  @weekly_discount_in_percent
end

Class Method Details

.api_call(slug) ⇒ Object



21
22
23
# File 'lib/nineflats-api/prices.rb', line 21

def self.api_call(slug)
  base_url + "/places/#{slug}/prices?client_id=#{Nineflats::Base.client_app_key}"
end