Class: Io::Flow::V0::Clients::VirtualCardCaptures

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ VirtualCardCaptures

Returns a new instance of VirtualCardCaptures.



3896
3897
3898
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3896

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get(organization, incoming = {}) ⇒ Object

Retrieve all the virtual credit card captures that have been received for all issued cards matching selected criteria.



3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3902

def get(organization, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
    :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
    :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
    :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
  }.delete_if { |k, v| v.nil? }
  r = @client.request("/#{CGI.escape(organization)}/virtual/card/captures").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::VirtualCardCapture.new(x) }
end

#get_by_virtual_card_id(organization, virtual_card_id) ⇒ Object

Retrieve payment captures for a specific virtual credit card that has been previously issued.



3917
3918
3919
3920
3921
3922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3917

def get_by_virtual_card_id(organization, virtual_card_id)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('virtual_card_id', virtual_card_id, String)
  r = @client.request("/#{CGI.escape(organization)}/virtual/card/captures/#{CGI.escape(virtual_card_id)}").get
  r.map { |x| ::Io::Flow::V0::Models::VirtualCardCapture.new(x) }
end