Class: Sorenson::ThreeSixty::AssetMetrics

Inherits:
Base
  • Object
show all
Defined in:
lib/sorenson/threesixty/asset_metrics.rb

Constant Summary

Constants inherited from Base

Base::TOKEN_SALT

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

debug=, debug?, host, #post_to, post_to, protocol, token_for, use_ssl=, use_ssl?

Constructor Details

#initialize(data) ⇒ AssetMetrics

Instance Methods



14
15
16
17
18
19
20
21
22
# File 'lib/sorenson/threesixty/asset_metrics.rb', line 14

def initialize(data)
  self.playTotal                = data['playTotal']
  self.filePlayData             = data['filePlayData']

  self.playData = {}
  data['playData'].each do |playData|
    self.playData[playData['eventDay']] = playData['plays']
  end
end

Instance Attribute Details

#filePlayDataObject

Returns the value of attribute filePlayData.



5
6
7
# File 'lib/sorenson/threesixty/asset_metrics.rb', line 5

def filePlayData
  @filePlayData
end

#playDataObject

Returns the value of attribute playData.



5
6
7
# File 'lib/sorenson/threesixty/asset_metrics.rb', line 5

def playData
  @playData
end

#playTotalObject

Returns the value of attribute playTotal.



5
6
7
# File 'lib/sorenson/threesixty/asset_metrics.rb', line 5

def playTotal
  @playTotal
end

Class Method Details

.find(account, startDate, endDate) ⇒ Object

Class Methods



8
9
10
11
# File 'lib/sorenson/threesixty/asset_metrics.rb', line 8

def self.find(, startDate, endDate)
  data = post_to("/api/getAccountDashboardMetrics?accountId=#{.id}&startDate=#{startDate}&endDate=#{endDate}")
  AssetMetrics.new(data)
end