Class: WEB_API::SignetMethod
Constant Summary
Constants inherited
from WebApiMethod
WebApiMethod::OK, WebApiMethod::SCHEMES, WebApiMethod::SSL, WebApiMethod::TYPES
Instance Attribute Summary
Attributes inherited from ClientMethod
#client
Attributes inherited from WebApiMethod
#base, #path, #type, #uri
Instance Method Summary
collapse
#http, #initialize
#arg_map, #args_map, #call, #escape, #headers, #http, #initialize, #kv_map, #pathquery
Instance Method Details
#fetch_protected_resource(url, headers = nil, type = 'GET', body = nil) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/web_api/signet.rb', line 9
def fetch_protected_resource(url, =nil, type='GET', body=nil)
options = {:uri => url, :method => type}
options[:body] = body if body
options[:headers] = if
parse client.fetch_protected_resource(options)
end
|
#get(args) ⇒ Object
20
21
22
23
|
# File 'lib/web_api/signet.rb', line 20
def get(args)
url = "#{uri.scheme}://#{uri.host}#{pathquery(args)}"
fetch_protected_resource(url, (args))
end
|
#parse(response) ⇒ Object
4
5
6
7
|
# File 'lib/web_api/signet.rb', line 4
def parse(response)
raise ResponseError, response.body unless OK === response.status
response.body
end
|
#post(args) ⇒ Object
16
17
18
|
# File 'lib/web_api/signet.rb', line 16
def post(args)
fetch_protected_resource(uri.to_s, (args), 'POST', data(args))
end
|