Class: Io::Flow::V0::Models::ActionUseSdkKlarnaV1

Inherits:
Action
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Use the Klarna SDK v1 and load the widgets for payment method categories. After the decision has been made, the payment request will be updated asynchronously. x.klarnacdn.net/kp/lib/v1/index.html

Instance Attribute Summary collapse

Attributes inherited from Action

#type

Instance Method Summary collapse

Methods inherited from Action

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ActionUseSdkKlarnaV1

Returns a new instance of ActionUseSdkKlarnaV1.



25620
25621
25622
25623
25624
25625
25626
25627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25620

def initialize(incoming={})
  super(:type => Action::Types::ACTION_USE_SDK_KLARNA_V1)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:client_token, :payment_method_categories], 'ActionUseSdkKlarnaV1')
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @client_token = HttpClient::Preconditions.assert_class('client_token', opts.delete(:client_token), String)
  @payment_method_categories = HttpClient::Preconditions.assert_class('payment_method_categories', opts.delete(:payment_method_categories), Array).map { |v| HttpClient::Preconditions.assert_class('payment_method_categories', v, String) }
end

Instance Attribute Details

#client_tokenObject (readonly)

Returns the value of attribute client_token.



25618
25619
25620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25618

def client_token
  @client_token
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



25618
25619
25620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25618

def expires_at
  @expires_at
end

#payment_method_categoriesObject (readonly)

Returns the value of attribute payment_method_categories.



25618
25619
25620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25618

def payment_method_categories
  @payment_method_categories
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25633
25634
25635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25633

def copy(incoming={})
  ActionUseSdkKlarnaV1.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



25637
25638
25639
25640
25641
25642
25643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25637

def subtype_to_hash
  {
    :expires_at => expires_at,
    :client_token => client_token,
    :payment_method_categories => payment_method_categories
  }
end

#to_jsonObject



25629
25630
25631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25629

def to_json
  JSON.dump(to_hash)
end