Sha256: 38f7025f2a6c8f6e29e523f8ed8b09168259c0b5bba9b7b6a6080381d1a6d8b4

Contents?: true

Size: 1.14 KB

Versions: 23

Compression:

Stored size: 1.14 KB

Contents

module Sorenson
  module Services
    class Event < Base
      attr_accessor :date, :account_id, :value, :type, :day, :id, :last_modified, :retreived_on
      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
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
360_services-0.0.3 lib/sorenson/services/event.rb
360_services-0.0.2 lib/sorenson/services/event.rb
360_services-0.0.1 lib/sorenson/services/event.rb