Class: Sorenson::Services::Event

Inherits:
Base show all
Defined in:
lib/sorenson/services/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

delete_from, get_from, host, login_no_resource, parse_response, post_to, put_to, verify_account_settings

Constructor Details

#initialize(data) ⇒ 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
25
# File 'lib/sorenson/services/event.rb', line 5

def initialize(data)
  @date           = Date.parse(data['eventDate'])
  @day            = Date.parse(data['eventDay'])
  @last_modified  = Date.parse(data['dateLastModified'])
  @retreived_on   = Date.parse(data['dateRetrieved'])
  @id             = data['id']
  @account_id     = data['accountId']
  @value          = data['eventIntegerValue'] || data['eventDecimalValue'] || data['eventStringValue']
  @type           = data['eventType']
  
   # {"eventDate"=>"2009-12-17 20:31:40", 
   #  "accountId"=>"db786013-c786-4511-8a0d-73f1bacc2285", 
   #  "eventIntegerValue"=>292684, 
   #  "eventType"=>"storageAdd", 
   #  "eventDay"=>"2009-12-17", 
   #  "eventDecimalValue"=>nil, 
   #  "id"=>"80437d46-f704-4fbc-8e61-0e9467a60b05", 
   #  "dateLastModified"=>"2009-12-17 20:31:40", 
   #  "eventStringValue"=>nil, 
   #  "dateRetrieved"=>"2009-12-30 13:16:18"}
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def 
  @account_id
end

#dateObject

Returns the value of attribute date.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def date
  @date
end

#dayObject

Returns the value of attribute day.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def day
  @day
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def id
  @id
end

#last_modifiedObject

Returns the value of attribute last_modified.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def last_modified
  @last_modified
end

#retreived_onObject

Returns the value of attribute retreived_on.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def retreived_on
  @retreived_on
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def type
  @type
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/sorenson/services/event.rb', line 4

def value
  @value
end