Class: Nineflats::Calendar

Inherits:
Base
  • Object
show all
Defined in:
lib/nineflats-api/calendar.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) ⇒ Calendar

Returns a new instance of Calendar.



5
6
7
8
9
10
11
# File 'lib/nineflats-api/calendar.rb', line 5

def initialize(json)
  calendar = json.first[1]

  @year  = calendar["year"]
  @month = calendar["month"]
  @days  = calendar["days"]
end

Instance Attribute Details

#daysObject

Returns the value of attribute days.



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

def days
  @days
end

#monthObject

Returns the value of attribute month.



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

def month
  @month
end

#yearObject

Returns the value of attribute year.



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

def year
  @year
end

Class Method Details

.api_call(slug, year, month) ⇒ Object



13
14
15
# File 'lib/nineflats-api/calendar.rb', line 13

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