Class: LivePaper::Link

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

Constant Summary

Constants included from HttpClient

HttpClient::AUTH_URL, HttpClient::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, #save, #update

Methods included from HttpClient

#check_response, #http_request, #request_access_token, #request_handling_auth, #send_request

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



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

def self.api_url
  "#{LP_API_HOST}/api/v1/links"
end

.item_keyObject



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

def self.item_key
  :link
end

.list_keyObject



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

def self.list_key
  :links
end

Instance Method Details

#parse(jsondata) ⇒ Object



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

def parse(jsondata)
  puts "parsing data and it is #{jsondata}"
  data = JSON.parse(jsondata, symbolize_names: true)[self.class.item_key]
  assign_attributes data
  self
end

#payoffObject



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

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

#triggerObject



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

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