class Io::Flow::V0::Clients::VirtualCards
Public Class Methods
new(client)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 3848 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end
Public Instance Methods
get(organization, incoming={})
click to toggle source
Retrieve all the virtual credit cards that have been created matching selected criteria.
# File lib/flow_commerce/flow_api_v0_client.rb, line 3854 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) }), :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, 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/cards").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::VirtualCard.new(x) } end
get_by_key(organization, key)
click to toggle source
Retrieves a virtual credit card using your unique key used when creating the card. Note that the card number and cvv will not be returned by this request to maintain PCI compliance. If you have lost these details you will need to create a new card.
# File lib/flow_commerce/flow_api_v0_client.rb, line 3872 def get_by_key(organization, key) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/#{CGI.escape(organization)}/virtual/cards/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::VirtualCard.new(r) end