Class: PatientZero::Analytics::Twitter

Inherits:
Base
  • Object
show all
Defined in:
lib/patient_zero/analytics/twitter.rb

Instance Attribute Summary

Attributes inherited from Base

#end_date, #source_id, #start_date, #token

Instance Method Summary collapse

Methods inherited from Base

#initialize, #messages, #name, #platform

Methods included from Client

#connection, #get, included, #parse, #post, #put

Constructor Details

This class inherits a constructor from PatientZero::Analytics::Base

Instance Method Details

#engagementsObject



8
9
10
# File 'lib/patient_zero/analytics/twitter.rb', line 8

def engagements
  @engagements ||= messages.reduce(0) { |sum, message| sum + message.engagements }
end

#impressionsObject



4
5
6
# File 'lib/patient_zero/analytics/twitter.rb', line 4

def impressions
  analytical_data['total_impressions']
end

#reachObject



12
13
14
# File 'lib/patient_zero/analytics/twitter.rb', line 12

def reach
  @reach ||= (0.12 * analytical_data['followers']).round
end