Class: LivePaper::Link

Inherits:
BaseObject show all
Defined in:
lib/live_paper/link.rb

Constant Summary

Constants inherited from BaseObject

BaseObject::AUTH_URL, BaseObject::AUTH_VALIDATION_URL, BaseObject::LP_API_HOST

Instance Attribute Summary collapse

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

#payoff_idObject

Returns the value of attribute payoff_id.



5
6
7
# File 'lib/live_paper/link.rb', line 5

def payoff_id
  @payoff_id
end

#trigger_idObject

Returns the value of attribute trigger_id.



5
6
7
# File 'lib/live_paper/link.rb', line 5

def trigger_id
  @trigger_id
end

Class Method Details

.api_urlObject



22
23
24
# File 'lib/live_paper/link.rb', line 22

def self.api_url
  "#{LP_API_HOST}/api/v2/projects/#{$project_id}/links"
end

.item_keyObject



30
31
32
# File 'lib/live_paper/link.rb', line 30

def self.item_key
  :link
end

.list_keyObject



26
27
28
# File 'lib/live_paper/link.rb', line 26

def self.list_key
  :links
end

Instance Method Details

#parse(jsondata) ⇒ Object



7
8
9
10
11
# File 'lib/live_paper/link.rb', line 7

def parse(jsondata)
  data = JSON.parse(jsondata, symbolize_names: true)[self.class.item_key]
  assign_attributes data
  self
end

#payoffObject



13
14
15
# File 'lib/live_paper/link.rb', line 13

def payoff
  @payoff ||= LivePaper::Payoff.get @payoff_id
end

#triggerObject



17
18
19
20
# File 'lib/live_paper/link.rb', line 17

def trigger
  #todo: need to get the right object created here!!!
  @trigger ||= LivePaper::WmTrigger.get @trigger_id
end