Module: Roar::Representer::Feature::HttpVerbs

Included in:
Client
Defined in:
lib/roar/representer/feature/http_verbs.rb

Defined Under Namespace

Modules: ClassMethods

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.transport_engineObject

Returns the value of attribute transport_engine.



10
11
12
# File 'lib/roar/representer/feature/http_verbs.rb', line 10

def transport_engine
  @transport_engine
end

Instance Attribute Details

#transport_engineObject



28
29
30
# File 'lib/roar/representer/feature/http_verbs.rb', line 28

def transport_engine
  @transport_engine || HttpVerbs.transport_engine
end

Class Method Details

.included(base) ⇒ Object



12
13
14
# File 'lib/roar/representer/feature/http_verbs.rb', line 12

def included(base)
  base.extend ClassMethods
end

Instance Method Details

#delete(*args, &block) ⇒ Object



62
63
64
65
# File 'lib/roar/representer/feature/http_verbs.rb', line 62

def delete(*args, &block)
  http.delete_uri(*args, &block)
  self
end

#get(*args, &block) ⇒ Object

GETs url with format, deserializes the returned document and updates properties accordingly.



41
42
43
44
# File 'lib/roar/representer/feature/http_verbs.rb', line 41

def get(*args, &block)
  response = http.get_uri(*args, &block)
  handle_response(response)
end

#patch(*args, &block) ⇒ Object



55
56
57
58
59
60
# File 'lib/roar/representer/feature/http_verbs.rb', line 55

def patch(*args, &block)
  options  = handle_deprecated_args(serialize, *args)
  response = http.patch_uri(options, &block)
  handle_response(response)
  self
end

#post(*args, &block) ⇒ Object

Serializes the object, POSTs it to url with format, deserializes the returned document and updates properties accordingly.



34
35
36
37
38
# File 'lib/roar/representer/feature/http_verbs.rb', line 34

def post(*args, &block)
  options  = handle_deprecated_args(serialize, *args)
  response = http.post_uri(options, &block)
  handle_response(response)
end

#put(*args, &block) ⇒ Object

Serializes the object, PUTs it to url with format, deserializes the returned document and updates properties accordingly.



48
49
50
51
52
53
# File 'lib/roar/representer/feature/http_verbs.rb', line 48

def put(*args, &block)
  options  = handle_deprecated_args(serialize, *args)
  response = http.put_uri(options, &block)
  handle_response(response)
  self
end