Class: HolidayList::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/holiday_list/params.rb

Overview

Params: Munges google calendar api request parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, time_options = {}) ⇒ Params

Returns a new instance of Params.



10
11
12
13
14
15
# File 'lib/holiday_list/params.rb', line 10

def initialize(key, time_options = {})
  @key     = key
  @options = time_options

  validate_options!
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/holiday_list/params.rb', line 8

def key
  @key
end

Instance Method Details

#params_hashObject



21
22
23
24
25
26
27
28
29
# File 'lib/holiday_list/params.rb', line 21

def params_hash
  {
    key:          key,
    orderBy:      order_by,
    singleEvents: single_events,
    timeMin:      time_min,
    timeMax:      time_max
  }
end

#to_sObject



17
18
19
# File 'lib/holiday_list/params.rb', line 17

def to_s
  params_hash.to_query
end