Class: LivePaper::Payoff
- Inherits:
-
BaseObject
- Object
- BaseObject
- LivePaper::Payoff
- Defined in:
- lib/live_paper/payoff.rb
Constant Summary collapse
- TYPE =
{ WEB: 'WEB_PAYOFF', RICH: 'RICH_PAYOFF' }
Constants inherited from BaseObject
BaseObject::AUTH_URL, BaseObject::AUTH_VALIDATION_URL, BaseObject::LP_API_HOST
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from BaseObject
#date_created, #date_modified, #id, #link, #name
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseObject
#assign_attributes, create, #delete, #errors, get, #initialize, list, parse, #rel, request_access_token, request_project_id, rest_request, #save, #update
Constructor Details
This class inherits a constructor from LivePaper::BaseObject
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/live_paper/payoff.rb', line 5 def data @data end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/live_paper/payoff.rb', line 5 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/live_paper/payoff.rb', line 5 def url @url end |
Class Method Details
.api_url ⇒ Object
27 28 29 |
# File 'lib/live_paper/payoff.rb', line 27 def self.api_url "#{LP_API_HOST}/api/v2/projects/#{$project_id}/payoffs" end |
.item_key ⇒ Object
23 24 25 |
# File 'lib/live_paper/payoff.rb', line 23 def self.item_key :payoff end |
.list_key ⇒ Object
19 20 21 |
# File 'lib/live_paper/payoff.rb', line 19 def self.list_key :payoffs end |
Instance Method Details
#parse(data) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/live_paper/payoff.rb', line 12 def parse(data) data = JSON.parse(data, symbolize_names: true)[self.class.item_key] assign_attributes(data) send(present?(data[:richPayoff]) ? :parse_richpayoff : :parse_webpayoff, data) self end |