class TicketingHub::Resource

Attributes

client[RW]
id[RW]
path[RW]

Public Class Methods

new(client, values, path, id) click to toggle source
Calls superclass method
# File lib/ticketing_hub/resource.rb, line 7
def initialize(client, values, path, id)
  self.client = client; self.path = path; self.id = id
  super(values)
end

Public Instance Methods

destroy() click to toggle source
# File lib/ticketing_hub/resource.rb, line 19
def destroy
  destroy! attributes
  return true
rescue TicketingHub::UnprocessableEntity
  return false
end
destroy!() click to toggle source
# File lib/ticketing_hub/resource.rb, line 34
def destroy!
  merge! client.delete "#{path}/#{id}"
  return self
rescue TicketingHub::UnprocessableEntity => e
  merge! e.response_body
  raise e
end
update() click to toggle source
# File lib/ticketing_hub/resource.rb, line 12
def update
  update! attributes
  return true
rescue TicketingHub::UnprocessableEntity
  return false
end
update!(attributes) click to toggle source
# File lib/ticketing_hub/resource.rb, line 26
def update! attributes
  merge! client.patch("#{path}/#{id}", attributes)
  return self
rescue TicketingHub::UnprocessableEntity => e
  merge! e.response_body
  raise e
end