Class: Jirafe::Resource::LegacyResource

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Model, Jirafe::ResponseParser
Defined in:
lib/jirafe/resource/legacy_resource.rb

Direct Known Subclasses

Cart

Class Method Summary collapse

Methods included from Model

#attributes, #attributes_for_change, #create, included, #initialize, #reinitialize, #update

Methods included from Jirafe::ResponseParser

included

Class Method Details

.create(resource) ⇒ Object



20
21
22
23
24
# File 'lib/jirafe/resource/legacy_resource.rb', line 20

def create(resource)
  response = post(resource_url, {:query => resource.attributes_for_change(:create)})
  check_response_for_exception(response)
  resource
end

.path(path = nil) ⇒ Object Also known as: url



10
11
12
13
# File 'lib/jirafe/resource/legacy_resource.rb', line 10

def path(path = nil)
  @path ||= path
  @path || raise(Jirafe::Error::MissingResourcePath)
end

.resource_urlObject



16
17
18
# File 'lib/jirafe/resource/legacy_resource.rb', line 16

def resource_url
  [base_uri, path].join("/")
end