Module: Payoneer::Auth

Extended by:
RemoteApi
Defined in:
lib/payoneer/modules/auth.rb

Instance Method Summary collapse

Methods included from RemoteApi

delete, extended, get, post, put

Instance Method Details

#access_token(code:, client_id:, client_secret:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/payoneer/modules/auth.rb', line 16

def access_token(code:, client_id:, client_secret:)
  token(
    body: {
      grant_type: 'authorization_code',
      redirect_uri: Payoneer::Configuration.callback_url,
      code: code,
      client_id: client_id,
      client_secret: client_secret
    }
  )
end

#application_token(client_id:, client_secret:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/payoneer/modules/auth.rb', line 5

def application_token(client_id:, client_secret:)
  token(
    body: {
      grant_type: 'client_credentials',
      scope: 'read write',
      client_id: client_id,
      client_secret: client_secret
    }
  )
end

#refresh_token(refresh_token:, client_id:, client_secret:) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/payoneer/modules/auth.rb', line 28

def refresh_token(refresh_token:, client_id:, client_secret:)
  token(
    body: {
      grant_type: 'refresh_token',
      refresh_token: refresh_token,
      client_id: client_id,
      client_secret: client_secret
    }
  )
end

#revoke_token(token:, client_id:, client_secret:) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/payoneer/modules/auth.rb', line 39

def revoke_token(token:, client_id:, client_secret:)
  token(
    path: '/revoke',
    body: {
      token_type_hint: 'access_token',
      token: token,
      client_id: client_id,
      client_secret: client_secret,
    }
  )
end