Module: Celery::EndpointMethods::InstanceMethods

Included in:
Order, Product
Defined in:
lib/celery/endpoint_methods.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



60
61
62
63
# File 'lib/celery/endpoint_methods.rb', line 60

def destroy
  response = HTTParty.delete("#{self.class.endpoint_path}/#{self.id}?#{self.class.options}")
  return response['status']
end

#update(attrs = {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/celery/endpoint_methods.rb', line 48

def update(attrs={})
  update_local_object(attrs)

  response = HTTParty.put(
    "#{self.class.endpoint_path}/#{self.id}?#{self.class.options}",
    body:    { self.class.object_root => attrs }.to_json,
    headers: { 'Content-Type' => 'application/json' }
  )

  return true if response[self.class.object_root]
end