class TicketSharing::Agreement

Attributes

response[R]

Public Class Methods

parse(json) click to toggle source
# File lib/ticket_sharing/agreement.rb, line 13
def self.parse(json)
  attributes = JsonSupport.decode(json)
  agreement = new(attributes)
  if agreement.current_actor
    agreement.current_actor = TicketSharing::Actor.new(agreement.current_actor)
  end
  agreement
end

Public Instance Methods

authentication_token() click to toggle source
# File lib/ticket_sharing/agreement.rb, line 40
def authentication_token
  "#{uuid}:#{access_key}"
end
relative_url() click to toggle source
# File lib/ticket_sharing/agreement.rb, line 36
def relative_url
  '/agreements/' + uuid.to_s
end
send_to(url) click to toggle source
# File lib/ticket_sharing/agreement.rb, line 22
def send_to(url)
  client = Client.new(url)
  @response = client.post(relative_url, self.to_json)

  @response.status
end
update_partner(url) click to toggle source
# File lib/ticket_sharing/agreement.rb, line 29
def update_partner(url)
  client = Client.new(url, authentication_token)
  @response = client.put(relative_url, self.to_json)

  @response.status
end