Class: Oceanarium::Event
- Inherits:
-
Object
- Object
- Oceanarium::Event
- Defined in:
- lib/oceanarium/resources/event.rb
Instance Attribute Summary collapse
-
#action_status ⇒ Object
Returns the value of attribute action_status.
-
#droplet_id ⇒ Object
Returns the value of attribute droplet_id.
-
#event_type_id ⇒ Object
Returns the value of attribute event_type_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#percentage ⇒ Object
Returns the value of attribute percentage.
Class Method Summary collapse
-
.find(id) ⇒ Object
Core API.
Instance Method Summary collapse
-
#initialize(option, api_key, client_id) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(option, api_key, client_id) ⇒ Event
Returns a new instance of Event.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/oceanarium/resources/event.rb', line 5 def initialize(option, api_key, client_id) if api_key.nil? || client_id.nil? raise 'No API key/client ID!' else if option.is_a?(Hash) @object = option else @object = Oceanarium::Event.find(option) end if @object.nil? self.id = nil else self.id = @object['id'] self.action_status = @object['action_status'] self.droplet_id = @object['droplet_id'] self.event_type_id = @object['event_type_id'] self.percentage = @object['percentage'] end end end |
Instance Attribute Details
#action_status ⇒ Object
Returns the value of attribute action_status.
3 4 5 |
# File 'lib/oceanarium/resources/event.rb', line 3 def action_status @action_status end |
#droplet_id ⇒ Object
Returns the value of attribute droplet_id.
3 4 5 |
# File 'lib/oceanarium/resources/event.rb', line 3 def droplet_id @droplet_id end |
#event_type_id ⇒ Object
Returns the value of attribute event_type_id.
3 4 5 |
# File 'lib/oceanarium/resources/event.rb', line 3 def event_type_id @event_type_id end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/oceanarium/resources/event.rb', line 3 def id @id end |
#percentage ⇒ Object
Returns the value of attribute percentage.
3 4 5 |
# File 'lib/oceanarium/resources/event.rb', line 3 def percentage @percentage end |
Class Method Details
.find(id) ⇒ Object
Core API
28 29 30 31 32 33 34 |
# File 'lib/oceanarium/resources/event.rb', line 28 def self.find(id) @request = Oceanarium::Request.new @get = @request.get("/events/#{id}/") if @get.parsed_response['status'] == 'OK' @get.parsed_response['event'] end end |