Class: Fryfro::App
- Inherits:
-
Object
- Object
- Fryfro::App
- Defined in:
- lib/fryfro/app.rb
Instance Attribute Summary collapse
-
#access_code ⇒ Object
readonly
Returns the value of attribute access_code.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
Instance Method Summary collapse
- #event(opts = {}) ⇒ Object
- #events(opts = {}) ⇒ Object
- #info ⇒ Object
-
#initialize(opts = {}) ⇒ App
constructor
A new instance of App.
- #metric(metric, opts = {}) ⇒ Object
- #raw_data(opts = {}) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ App
Returns a new instance of App.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fryfro/app.rb', line 5 def initialize(opts = {}) # Mandatory @access_code = opts[:access_code] or raise ArgumentError, 'Provide an apiAccessCode' @key = opts[:key] or raise ArgumentError, 'Provide an apiKey' # Optional @name = opts[:name] @platform = opts[:platform] @created_at = opts[:created_at] end |
Instance Attribute Details
#access_code ⇒ Object (readonly)
Returns the value of attribute access_code.
3 4 5 |
# File 'lib/fryfro/app.rb', line 3 def access_code @access_code end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/fryfro/app.rb', line 3 def created_at @created_at end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/fryfro/app.rb', line 3 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/fryfro/app.rb', line 3 def name @name end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
3 4 5 |
# File 'lib/fryfro/app.rb', line 3 def platform @platform end |
Instance Method Details
#event(opts = {}) ⇒ Object
31 32 33 34 35 |
# File 'lib/fryfro/app.rb', line 31 def event(opts = {}) raise ArgumentError, 'Provide an eventName' unless opts[:event_name] || opts['eventName'] check_required_dates(opts) EventMetrics[:event].(@access_code, @key, opts)['eventMetrics'] end |
#events(opts = {}) ⇒ Object
26 27 28 29 |
# File 'lib/fryfro/app.rb', line 26 def events(opts = {}) check_required_dates(opts) EventMetrics[:summary].(@access_code, @key, opts)['eventMetrics'] end |
#info ⇒ Object
16 17 18 |
# File 'lib/fryfro/app.rb', line 16 def info AppInfo[:get_application].(@access_code, @key)['appInfo'] end |
#metric(metric, opts = {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/fryfro/app.rb', line 20 def metric(metric, opts = {}) raise ArgumentError, 'Provide an eventName' unless metric check_required_dates(opts) AppMetrics[metric].(@access_code, @key, opts)['appMetrics'] end |
#raw_data(opts = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/fryfro/app.rb', line 37 def raw_data(opts = {}) check_params_overlap(opts) time_params?(opts) ? check_required_times(opts) : check_required_dates(opts) RawData[:events].(@access_code, @key, opts) end |