Class: Motion::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/common/http.rb,
lib/cocoa/adapter.rb,
lib/android/adapter.rb,
lib/common/http/client.rb,
lib/common/http/headers.rb,
lib/common/http/request.rb,
lib/common/http/response.rb

Defined Under Namespace

Classes: Adapter, Client, Headers, Request, Response

Class Method Summary collapse

Class Method Details

.clientObject



4
5
6
# File 'lib/common/http.rb', line 4

def client
  @client ||= Client.new
end

.delete(url, params = nil, &callback) ⇒ Object



31
32
33
# File 'lib/common/http.rb', line 31

def delete(url, params = nil, &callback)
  client.delete(url, params, &callback)
end

.get(url, params = nil, &callback) ⇒ Object

FIXME: doesn’t work on Android [:get, :post, :put, :patch, :delete].each do |method|

define_method "#{method}", do |url, params = nil, &callback|
  client.send(method, url, params, &callback)
end

end



15
16
17
# File 'lib/common/http.rb', line 15

def get(url, params = nil, &callback)
  client.get(url, params, &callback)
end

.patch(url, params = nil, &callback) ⇒ Object



27
28
29
# File 'lib/common/http.rb', line 27

def patch(url, params = nil, &callback)
  client.patch(url, params, &callback)
end

.post(url, params = nil, &callback) ⇒ Object



19
20
21
# File 'lib/common/http.rb', line 19

def post(url, params = nil, &callback)
  client.post(url, params, &callback)
end

.put(url, params = nil, &callback) ⇒ Object



23
24
25
# File 'lib/common/http.rb', line 23

def put(url, params = nil, &callback)
  client.put(url, params, &callback)
end