Class: Io::Flow::V0::Models::DirectDebit

Inherits:
ConfirmationDetails show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Represents an online direct debit payment.

Instance Attribute Summary collapse

Attributes inherited from ConfirmationDetails

#discriminator

Instance Method Summary collapse

Methods inherited from ConfirmationDetails

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ DirectDebit

Returns a new instance of DirectDebit.



28703
28704
28705
28706
28707
28708
28709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28703

def initialize(incoming={})
  super(:discriminator => ConfirmationDetails::Types::DIRECT_DEBIT)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:routing_number, :last4], 'DirectDebit')
  @routing_number = HttpClient::Preconditions.assert_class('routing_number', opts.delete(:routing_number), String)
  @last4 = HttpClient::Preconditions.assert_class('last4', opts.delete(:last4), String)
end

Instance Attribute Details

#last4Object (readonly)

Returns the value of attribute last4.



28701
28702
28703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28701

def last4
  @last4
end

#routing_numberObject (readonly)

Returns the value of attribute routing_number.



28701
28702
28703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28701

def routing_number
  @routing_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



28715
28716
28717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28715

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

#subtype_to_hashObject



28719
28720
28721
28722
28723
28724
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28719

def subtype_to_hash
  {
    :routing_number => routing_number,
    :last4 => last4
  }
end

#to_jsonObject



28711
28712
28713
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28711

def to_json
  JSON.dump(to_hash)
end