Class: AddEvent::Params
- Inherits:
-
Object
- Object
- AddEvent::Params
- Extended by:
- Forwardable
- Defined in:
- lib/add_event/params.rb
Overview
Takes in a hash of parameters and formats them for use with the AddEvent API
Constant Summary collapse
- KEYS =
Available parameters. Full docs: addthisevent.com/api/
%i(alarm all_day_event client date_format description end endext endtime location organizer organizer_email reference service start startext starttime template timezone title).freeze
- VALID_SERVICES =
%w(outlook google appleical outlookcom yahoo).freeze
- DATE_FORMAT =
'MM/DD/YYYY'.freeze
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #initialize(params) ⇒ AddEvent::Params constructor
-
#to_h ⇒ Hash
Returns a hash with only valid params for the AddEvent API.
Constructor Details
#initialize(params) ⇒ AddEvent::Params
27 28 29 |
# File 'lib/add_event/params.rb', line 27 def initialize(params) @params = OpenStruct.new(params) end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
17 18 19 |
# File 'lib/add_event/params.rb', line 17 def params @params end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash with only valid params for the AddEvent API
37 38 39 |
# File 'lib/add_event/params.rb', line 37 def to_h KEYS.each_with_object({}) { |key, output| output[key] = send(key) } end |