Class: WhenHub::Event
- Inherits:
-
Object
- Object
- WhenHub::Event
- Defined in:
- lib/whenhub/event.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
26 27 28 |
# File 'lib/whenhub/event.rb', line 26 def client @client end |
Class Method Details
.build(client, schedule, attributes) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/whenhub/event.rb', line 28 def self.build(client, schedule, attributes) new(attributes).tap do |event| event.client = client event.scheduleId = schedule.id end end |
Instance Method Details
#delete ⇒ Object
51 52 53 |
# File 'lib/whenhub/event.rb', line 51 def delete @client.delete("/api/events/#{id}") end |
#save ⇒ Object
35 36 37 38 39 40 |
# File 'lib/whenhub/event.rb', line 35 def save self.attributes = @client.post( "/api/users/me/schedules/#{scheduleId}/events", writeable_attributes ).first end |
#writeable_attributes ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/whenhub/event.rb', line 42 def writeable_attributes { when: self.when, name: name, description: description, scheduleId: scheduleId } end |