Class: HolidayList::GoogleCalendarRequestString
- Inherits:
-
Object
- Object
- HolidayList::GoogleCalendarRequestString
- Includes:
- RequestException
- Defined in:
- lib/holiday_list/google_calendar_request_string.rb
Overview
GoogleCalendarRequestString: Generates the google calendar api request string
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
-
.url_base ⇒ Object
TODO: address these items: - make class more extensible - rename class, redundat String, and is it really a ‘Request’? - don’t think ‘to_str’ is working.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ GoogleCalendarRequestString
constructor
A new instance of GoogleCalendarRequestString.
- #to_s ⇒ Object
- #url_path ⇒ Object
Constructor Details
#initialize(configuration) ⇒ GoogleCalendarRequestString
Returns a new instance of GoogleCalendarRequestString.
26 27 28 29 30 31 32 33 |
# File 'lib/holiday_list/google_calendar_request_string.rb', line 26 def initialize(configuration) argument_error! unless configuration.configured? key = configuration.key @id = configuration.id @params = Params.new(key) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
24 25 26 |
# File 'lib/holiday_list/google_calendar_request_string.rb', line 24 def id @id end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
24 25 26 |
# File 'lib/holiday_list/google_calendar_request_string.rb', line 24 def params @params end |
Class Method Details
.url_base ⇒ Object
TODO: address these items:
-
make class more extensible
-
rename class, redundat String, and is it really a ‘Request’?
-
don’t think ‘to_str’ is working. should work like:
gcrs = GoogleCalendarRequestString.new(configuration) conn.get gcrs # '/calendar/v3/calendars/12345/events?time_min=yesterday'
16 17 18 |
# File 'lib/holiday_list/google_calendar_request_string.rb', line 16 def self.url_base 'https://www.googleapis.com' end |
Instance Method Details
#to_s ⇒ Object
35 36 37 |
# File 'lib/holiday_list/google_calendar_request_string.rb', line 35 def to_s "#{url_path}/#{id}/events?#{params}" end |
#url_path ⇒ Object
20 21 22 |
# File 'lib/holiday_list/google_calendar_request_string.rb', line 20 def url_path '/calendar/v3/calendars' end |