Sha256: b8f9722ce286d5783c1acc649011b2bba4b4ab25a8b620ce7846dbbfc37b03c3

Contents?: true

Size: 631 Bytes

Versions: 4

Compression:

Stored size: 631 Bytes

Contents

module Moip2
  class ConnectApi
    attr_reader :client

    def initialize(client)
      @client = client
    end

    def authorize_url(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

    def authorize(connect)
      Resource::Connect.new client.post(
        "/oauth/token",
        connect,
        "application/x-www-form-urlencoded",
      )
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moip2-1.3.1 lib/moip2/connect_api.rb
moip2-1.2.1 lib/moip2/connect_api.rb
moip2-1.2.0 lib/moip2/connect_api.rb
moip2-1.1.0 lib/moip2/connect_api.rb