Class: Moip2::ConnectApi
- Inherits:
-
Object
- Object
- Moip2::ConnectApi
- Defined in:
- lib/moip2/connect_api.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #authorize(connect) ⇒ Object
- #authorize_url(client_id, redirect_uri, scope) ⇒ Object
-
#initialize(client) ⇒ ConnectApi
constructor
A new instance of ConnectApi.
Constructor Details
#initialize(client) ⇒ ConnectApi
Returns a new instance of ConnectApi.
5 6 7 |
# File 'lib/moip2/connect_api.rb', line 5 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/moip2/connect_api.rb', line 3 def client @client end |
Instance Method Details
#authorize(connect) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/moip2/connect_api.rb', line 22 def (connect) Resource::Connect.new client.post( "/oauth/token", connect, "application/x-www-form-urlencoded", ) end |
#authorize_url(client_id, redirect_uri, scope) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/moip2/connect_api.rb', line 9 def (client_id, redirect_uri, scope) URI::HTTPS.build( host: client.host, path: "/oauth/authorize", query: URI.encode_www_form( response_type: "code", client_id: client_id, redirect_uri: redirect_uri, scope: scope, ), ).to_s end |