Class: Unit::ApiToken::Customer::CreateCustomerTokenVerification

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/api_token/customer/create_customer_token_verification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer_id, channel, phone = nil, app_hash = nil, language = nil) ⇒ CreateCustomerTokenVerification

Returns a new instance of CreateCustomerTokenVerification.

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



16
17
18
19
20
21
22
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 16

def initialize(customer_id, channel, phone = nil, app_hash = nil, language = nil)
  @customer_id = customer_id
  @channel = channel
  @phone = phone
  @app_hash = app_hash
  @language = language
end

Instance Attribute Details

#app_hashObject (readonly)

Returns the value of attribute app_hash.



9
10
11
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 9

def app_hash
  @app_hash
end

#channelObject (readonly)

Returns the value of attribute channel.



9
10
11
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 9

def channel
  @channel
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



9
10
11
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 9

def customer_id
  @customer_id
end

#languageObject (readonly)

Returns the value of attribute language.



9
10
11
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 9

def language
  @language
end

#phoneObject (readonly)

Returns the value of attribute phone.



9
10
11
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 9

def phone
  @phone
end

Instance Method Details

#to_json_apiObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/unit/models/api_token/customer/create_customer_token_verification.rb', line 24

def to_json_api
  result = { data: { type: "customerTokenVerification",
                     attributes:
                       { channel: channel,
                         phone: phone&.represent,
                         appHash: app_hash,
                         language: language } } }
  result[:data][:attributes].compact!
  result.to_json
end