Class: RPCMapper::Adapters::RestfulHTTPAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/rpc_mapper/adapters/restful_http_adapter.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractAdapter

#config, #type

Instance Method Summary collapse

Methods inherited from AbstractAdapter

create, #extend_adapter, #read, register_as

Methods included from Logger

included

Constructor Details

#initialize(*args) ⇒ RestfulHTTPAdapter

Returns a new instance of RestfulHTTPAdapter.



10
11
12
13
# File 'lib/rpc_mapper/adapters/restful_http_adapter.rb', line 10

def initialize(*args)
  super
  @configuration_contexts << { :primary_key => :id }
end

Instance Attribute Details

#last_responseObject (readonly)

Returns the value of attribute last_response.



8
9
10
# File 'lib/rpc_mapper/adapters/restful_http_adapter.rb', line 8

def last_response
  @last_response
end

Instance Method Details

#delete(object) ⇒ Object



20
21
22
# File 'lib/rpc_mapper/adapters/restful_http_adapter.rb', line 20

def delete(object)
  delete_http(object)
end

#write(object) ⇒ Object



15
16
17
18
# File 'lib/rpc_mapper/adapters/restful_http_adapter.rb', line 15

def write(object)
  params = build_params_from_attributes(object)
  object.new_record? ? post_http(object, params) : put_http(object, params)
end