Module: Unit::ApiToken::Customer

Defined in:
lib/unit/models/api_token/api_token.rb,
lib/unit/models/api_token/customer/create_customer_token_request.rb,
lib/unit/models/api_token/customer/create_token_using_jwt_request.rb,
lib/unit/models/api_token/customer/create_customer_token_verification.rb

Defined Under Namespace

Classes: CreateCustomerTokenRequest, CreateCustomerTokenVerification, CreateTokenUsingJwtRequest

Class Method Summary collapse

Class Method Details

.create_customer_token(customer_id:, scope:, verification_token:, verification_code: nil, expires_in: nil, resources: nil) ⇒ UnitResponse, UnitError

Create customer token by calling Unit’s API

Parameters:

  • customer_id (String)
  • scope (Array<String>)
  • verification_token (String)
  • verification_code (String) (defaults to: nil)
    • optional

  • expires_in (Integer) (defaults to: nil)
    • optional

  • resources (Array<RestrictedResource>) (defaults to: nil)
    • optional

Returns:

See Also:



57
58
59
60
61
# File 'lib/unit/models/api_token/api_token.rb', line 57

def create_customer_token(customer_id:, scope:, verification_token:, verification_code: nil, expires_in: nil,
                          resources: nil)
  request = CreateCustomerTokenRequest.new(customer_id, scope, verification_token, verification_code, expires_in, resources)
  Unit::Resource::ApiTokenResource.create_customer_token(request)
end

.create_customer_token_verification(customer_id:, channel:, phone: nil, app_hash: nil, language: nil) ⇒ UnitResponse, UnitError

Create customer token verification by calling Unit’s API

Parameters:

  • customer_id (String)
  • channel (String)
  • phone (Phone) (defaults to: nil)
    • optional

  • app_hash (String) (defaults to: nil)
    • optional

  • language (String) (defaults to: nil)
    • optional

Returns:

See Also:



82
83
84
85
# File 'lib/unit/models/api_token/api_token.rb', line 82

def create_customer_token_verification(customer_id:, channel:, phone: nil, app_hash: nil, language: nil)
  request = CreateCustomerTokenVerification.new(customer_id, channel, phone, app_hash, language)
  Unit::Resource::ApiTokenResource.create_token_verification(request)
end

.create_customer_token_with_jwt(customer_id:, scope:, jwt_token: nil) ⇒ UnitResponse, UnitError

Create customer token using JWT by calling Unit’s API

Parameters:

  • customer_id (String)
  • scope (Array<String>)
  • jwt_token (String) (defaults to: nil)
    • optional

Returns:

See Also:



69
70
71
72
# File 'lib/unit/models/api_token/api_token.rb', line 69

def create_customer_token_with_jwt(customer_id:, scope:, jwt_token: nil)
  request = CreateTokenUsingJwtRequest.new(customer_id, scope, jwt_token)
  Unit::Resource::ApiTokenResource.create_customer_token(request)
end