Module: Restify

Defined in:
lib/restify.rb,
lib/restify/link.rb,
lib/restify/client.rb,
lib/restify/adapter.rb,
lib/restify/request.rb,
lib/restify/version.rb,
lib/restify/relation.rb,
lib/restify/resource.rb,
lib/restify/response.rb,
lib/restify/relations.rb,
lib/restify/collection.rb,
lib/restify/parser/json.rb

Defined Under Namespace

Modules: Adapter, Processors, Relations, VERSION Classes: Client, ClientError, Collection, Link, Relation, Request, Resource, Response, ResponseError, ServerError

Class Method Summary collapse

Class Method Details

.adapterObject



28
29
30
# File 'lib/restify.rb', line 28

def adapter
  @adapter ||= Adapter::EM.new
end

.decode(response) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/restify.rb', line 32

def decode(response)
  decoder = decoders.find { |d| d.accept?(response) }
  if decoder
    decoder.decode(response)
  else
    UnsupportedFormatError.new \
      "Cannot decode `#{response.content_type}' response."
  end
end

.new(url) ⇒ Object



24
25
26
# File 'lib/restify.rb', line 24

def new(url)
  Client.new(url).request(:GET, nil)
end