class HolidayList::GoogleCalendarRequestString

GoogleCalendarRequestString: Generates the google calendar api request string

Attributes

id[R]
params[R]

Public Class Methods

new(configuration) click to toggle source
# 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
url_base() click to toggle source

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'
    
# File lib/holiday_list/google_calendar_request_string.rb, line 16
def self.url_base
  'https://www.googleapis.com'
end

Public Instance Methods

to_s() click to toggle source
# File lib/holiday_list/google_calendar_request_string.rb, line 35
def to_s
  "#{url_path}/#{id}/events?#{params}"
end
url_path() click to toggle source
# File lib/holiday_list/google_calendar_request_string.rb, line 20
def url_path
  '/calendar/v3/calendars'
end