Class: Whatser::Service
Instance Attribute Summary
Attributes inherited from Resource
#json
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
#api_request, api_request, client, convert_data_to_model, from_hash_to_model, #initialize, set
Class Method Details
.auth_params(params = {}) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/whatser/api/service.rb', line 22
def auth_params(params={})
{
:client_id => client.api_key,
:redirect_uri => client.redirect_uri
}.merge( params )
end
|
.connection_querystring(params = {}) ⇒ Object
18
19
20
|
# File 'lib/whatser/api/service.rb', line 18
def connection_querystring(params={})
auth_params( params ).map{|k,v| "#{CGI.escape( (k || '').to_s )}=#{CGI.escape( (v || '').to_s )}"}.join('&')
end
|
.connection_url(params = {}) ⇒ Object
10
11
12
|
# File 'lib/whatser/api/service.rb', line 10
def connection_url(params={})
"#{client.api_uri}/oauth/services/#{key}/authorize?#{connection_querystring(params)}"
end
|
.disconnection_url(params = {}) ⇒ Object
14
15
16
|
# File 'lib/whatser/api/service.rb', line 14
def disconnection_url(params={})
"#{client.api_uri}/oauth/services/#{key}/disconnect"
end
|
.key ⇒ Object
6
7
8
|
# File 'lib/whatser/api/service.rb', line 6
def key
self.name.split('::').last.downcase
end
|
Instance Method Details
#connection_url(params = {}) ⇒ Object
32
|
# File 'lib/whatser/api/service.rb', line 32
def connection_url(params={}); self.class.connection_url(params) end
|
#disconnection_url(params = {}) ⇒ Object
33
|
# File 'lib/whatser/api/service.rb', line 33
def disconnection_url(params={}); self.class.disconnection_url(params) end
|
#key ⇒ Object
30
|
# File 'lib/whatser/api/service.rb', line 30
def key; self.class.key; end
|