Class: PatientZero::Analytics::Base
- Inherits:
-
Object
- Object
- PatientZero::Analytics::Base
- Includes:
- Client
- Defined in:
- lib/patient_zero/analytics/base.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#source_id ⇒ Object
Returns the value of attribute source_id.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token:, source_id:, start_date: nil, end_date: nil) ⇒ Base
constructor
A new instance of Base.
- #messages ⇒ Object
- #name ⇒ Object
- #platform ⇒ Object
- #total_posts ⇒ Object
Methods included from Client
#connection, #get, included, #parse, #post, #put
Constructor Details
#initialize(token:, source_id:, start_date: nil, end_date: nil) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 |
# File 'lib/patient_zero/analytics/base.rb', line 8 def initialize token:, source_id:, start_date: nil, end_date: nil @token = token @source_id = source_id @end_date = end_date || Date.today.to_s @start_date = start_date || Date.today.prev_day(7).to_s end |
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
6 7 8 |
# File 'lib/patient_zero/analytics/base.rb', line 6 def end_date @end_date end |
#source_id ⇒ Object
Returns the value of attribute source_id.
6 7 8 |
# File 'lib/patient_zero/analytics/base.rb', line 6 def source_id @source_id end |
#start_date ⇒ Object
Returns the value of attribute start_date.
6 7 8 |
# File 'lib/patient_zero/analytics/base.rb', line 6 def start_date @start_date end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/patient_zero/analytics/base.rb', line 6 def token @token end |
Instance Method Details
#messages ⇒ Object
23 24 25 |
# File 'lib/patient_zero/analytics/base.rb', line 23 def analytical_data['messages'].map { || Message.for_platform ['platform'], }.compact end |
#name ⇒ Object
15 16 17 |
# File 'lib/patient_zero/analytics/base.rb', line 15 def name analytical_data['name'] end |
#platform ⇒ Object
19 20 21 |
# File 'lib/patient_zero/analytics/base.rb', line 19 def platform analytical_data['platform'] end |
#total_posts ⇒ Object
27 28 29 |
# File 'lib/patient_zero/analytics/base.rb', line 27 def total_posts .count end |