class LivePaper::Link

Attributes

payoff_id[RW]
trigger_id[RW]

Public Class Methods

api_url() click to toggle source
# File lib/live_paper/link.rb, line 22
def self.api_url
  "#{LP_API_HOST}/api/v2/projects/#{$project_id}/links"
end
item_key() click to toggle source
# File lib/live_paper/link.rb, line 30
def self.item_key
  :link
end
list_key() click to toggle source
# File lib/live_paper/link.rb, line 26
def self.list_key
  :links
end

Public Instance Methods

parse(jsondata) click to toggle source
# 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
payoff() click to toggle source
# File lib/live_paper/link.rb, line 13
def payoff
  @payoff ||= LivePaper::Payoff.get @payoff_id
end
trigger() click to toggle source
# 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

Private Instance Methods

create_body() click to toggle source
# File lib/live_paper/link.rb, line 39
def create_body
  {
    link: {
      name: @name,
      triggerId: @trigger_id,
      payoffId: @payoff_id
    }
  }
end
update_body() click to toggle source
# File lib/live_paper/link.rb, line 49
def update_body
  {
    link: {
      name: @name
    }
  }
end
validate_attributes!() click to toggle source
# File lib/live_paper/link.rb, line 35
def validate_attributes!
  raise ArgumentError, 'Required Attributes needed: name, payoff_id and trigger_id.' unless all_present? [@name, @payoff_id, @trigger_id]
end