class ProcessOut::Card
Attributes
address1[R]
address2[R]
avs_check[R]
bank_name[R]
brand[R]
category[R]
city[R]
co_scheme[R]
country_code[R]
created_at[R]
cvc_check[R]
exp_month[R]
exp_year[R]
expires_soon[R]
fingerprint[R]
id[R]
iin[R]
ip_address[R]
last_4_digits[R]
metadata[R]
name[R]
preferred_scheme[R]
project[R]
project_id[R]
sandbox[R]
scheme[R]
state[R]
token[R]
token_type[R]
type[R]
zip[R]
Public Class Methods
new(client, data = {})
click to toggle source
Initializes the Card
object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
# File lib/processout/card.rb, line 197 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) self.project = data.fetch(:project, nil) self.project_id = data.fetch(:project_id, nil) self.token = data.fetch(:token, nil) self.scheme = data.fetch(:scheme, nil) self.co_scheme = data.fetch(:co_scheme, nil) self.preferred_scheme = data.fetch(:preferred_scheme, nil) self.type = data.fetch(:type, nil) self.bank_name = data.fetch(:bank_name, nil) self.brand = data.fetch(:brand, nil) self.category = data.fetch(:category, nil) self.iin = data.fetch(:iin, nil) self.last_4_digits = data.fetch(:last_4_digits, nil) self.exp_month = data.fetch(:exp_month, nil) self.exp_year = data.fetch(:exp_year, nil) self.cvc_check = data.fetch(:cvc_check, nil) self.avs_check = data.fetch(:avs_check, nil) self.name = data.fetch(:name, nil) self.address1 = data.fetch(:address1, nil) self.address2 = data.fetch(:address2, nil) self.city = data.fetch(:city, nil) self.state = data.fetch(:state, nil) self.zip = data.fetch(:zip, nil) self.country_code = data.fetch(:country_code, nil) self.ip_address = data.fetch(:ip_address, nil) self.fingerprint = data.fetch(:fingerprint, nil) self.token_type = data.fetch(:token_type, nil) self.metadata = data.fetch(:metadata, nil) self.expires_soon = data.fetch(:expires_soon, nil) self.sandbox = data.fetch(:sandbox, nil) self.created_at = data.fetch(:created_at, nil) end
Public Instance Methods
address1=(val)
click to toggle source
# File lib/processout/card.rb, line 140 def address1=(val) @address1 = val end
address2=(val)
click to toggle source
# File lib/processout/card.rb, line 144 def address2=(val) @address2 = val end
all(options = {})
click to toggle source
Get all the cards. Params:
options
-
Hash
of options
# File lib/processout/card.rb, line 425 def all(options = {}) self.prefill(options) request = Request.new(@client) path = "/cards" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new a = Array.new body = response.body for v in body['cards'] tmp = Card.new(@client) tmp.fill_with_data(v) a.push(tmp) end return_values.push(a) return_values[0] end
anonymize(options = {})
click to toggle source
Anonymize the card. Params:
options
-
Hash
of options
# File lib/processout/card.rb, line 483 def anonymize(options = {}) self.prefill(options) request = Request.new(@client) path = "/cards/" + CGI.escape(@id) + "" data = { } response = Response.new(request.delete(path, data, options)) return_values = Array.new return_values.push(response.success) return_values[0] end
avs_check=(val)
click to toggle source
# File lib/processout/card.rb, line 132 def avs_check=(val) @avs_check = val end
bank_name=(val)
click to toggle source
# File lib/processout/card.rb, line 100 def bank_name=(val) @bank_name = val end
brand=(val)
click to toggle source
# File lib/processout/card.rb, line 104 def brand=(val) @brand = val end
category=(val)
click to toggle source
# File lib/processout/card.rb, line 108 def category=(val) @category = val end
city=(val)
click to toggle source
# File lib/processout/card.rb, line 148 def city=(val) @city = val end
co_scheme=(val)
click to toggle source
# File lib/processout/card.rb, line 88 def co_scheme=(val) @co_scheme = val end
country_code=(val)
click to toggle source
# File lib/processout/card.rb, line 160 def country_code=(val) @country_code = val end
created_at=(val)
click to toggle source
# File lib/processout/card.rb, line 188 def created_at=(val) @created_at = val end
cvc_check=(val)
click to toggle source
# File lib/processout/card.rb, line 128 def cvc_check=(val) @cvc_check = val end
exp_month=(val)
click to toggle source
# File lib/processout/card.rb, line 120 def exp_month=(val) @exp_month = val end
exp_year=(val)
click to toggle source
# File lib/processout/card.rb, line 124 def exp_year=(val) @exp_year = val end
expires_soon=(val)
click to toggle source
# File lib/processout/card.rb, line 180 def expires_soon=(val) @expires_soon = val end
fill_with_data(data)
click to toggle source
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
# File lib/processout/card.rb, line 279 def fill_with_data(data) if data.nil? return self end if data.include? "id" self.id = data["id"] end if data.include? "project" self.project = data["project"] end if data.include? "project_id" self.project_id = data["project_id"] end if data.include? "token" self.token = data["token"] end if data.include? "scheme" self.scheme = data["scheme"] end if data.include? "co_scheme" self.co_scheme = data["co_scheme"] end if data.include? "preferred_scheme" self.preferred_scheme = data["preferred_scheme"] end if data.include? "type" self.type = data["type"] end if data.include? "bank_name" self.bank_name = data["bank_name"] end if data.include? "brand" self.brand = data["brand"] end if data.include? "category" self.category = data["category"] end if data.include? "iin" self.iin = data["iin"] end if data.include? "last_4_digits" self.last_4_digits = data["last_4_digits"] end if data.include? "exp_month" self.exp_month = data["exp_month"] end if data.include? "exp_year" self.exp_year = data["exp_year"] end if data.include? "cvc_check" self.cvc_check = data["cvc_check"] end if data.include? "avs_check" self.avs_check = data["avs_check"] end if data.include? "name" self.name = data["name"] end if data.include? "address1" self.address1 = data["address1"] end if data.include? "address2" self.address2 = data["address2"] end if data.include? "city" self.city = data["city"] end if data.include? "state" self.state = data["state"] end if data.include? "zip" self.zip = data["zip"] end if data.include? "country_code" self.country_code = data["country_code"] end if data.include? "ip_address" self.ip_address = data["ip_address"] end if data.include? "fingerprint" self.fingerprint = data["fingerprint"] end if data.include? "token_type" self.token_type = data["token_type"] end if data.include? "metadata" self.metadata = data["metadata"] end if data.include? "expires_soon" self.expires_soon = data["expires_soon"] end if data.include? "sandbox" self.sandbox = data["sandbox"] end if data.include? "created_at" self.created_at = data["created_at"] end self end
find(card_id, options = {})
click to toggle source
Find a card by its ID. Params:
card_id
-
ID of the card
options
-
Hash
of options
# File lib/processout/card.rb, line 456 def find(card_id, options = {}) self.prefill(options) request = Request.new(@client) path = "/cards/" + CGI.escape(card_id) + "" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new body = response.body body = body["card"] obj = Card.new(@client) return_values.push(obj.fill_with_data(body)) return_values[0] end
fingerprint=(val)
click to toggle source
# File lib/processout/card.rb, line 168 def fingerprint=(val) @fingerprint = val end
id=(val)
click to toggle source
# File lib/processout/card.rb, line 44 def id=(val) @id = val end
iin=(val)
click to toggle source
# File lib/processout/card.rb, line 112 def iin=(val) @iin = val end
ip_address=(val)
click to toggle source
# File lib/processout/card.rb, line 164 def ip_address=(val) @ip_address = val end
last_4_digits=(val)
click to toggle source
# File lib/processout/card.rb, line 116 def last_4_digits=(val) @last_4_digits = val end
metadata=(val)
click to toggle source
# File lib/processout/card.rb, line 176 def metadata=(val) @metadata = val end
name=(val)
click to toggle source
# File lib/processout/card.rb, line 136 def name=(val) @name = val end
new(data = {})
click to toggle source
Create a new Card
using the current client
# File lib/processout/card.rb, line 235 def new(data = {}) Card.new(@client, data) end
preferred_scheme=(val)
click to toggle source
# File lib/processout/card.rb, line 92 def preferred_scheme=(val) @preferred_scheme = val end
prefill(data)
click to toggle source
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
# File lib/processout/card.rb, line 383 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self.project = data.fetch(:project, self.project) self.project_id = data.fetch(:project_id, self.project_id) self.token = data.fetch(:token, self.token) self.scheme = data.fetch(:scheme, self.scheme) self.co_scheme = data.fetch(:co_scheme, self.co_scheme) self.preferred_scheme = data.fetch(:preferred_scheme, self.preferred_scheme) self.type = data.fetch(:type, self.type) self.bank_name = data.fetch(:bank_name, self.bank_name) self.brand = data.fetch(:brand, self.brand) self.category = data.fetch(:category, self.category) self.iin = data.fetch(:iin, self.iin) self.last_4_digits = data.fetch(:last_4_digits, self.last_4_digits) self.exp_month = data.fetch(:exp_month, self.exp_month) self.exp_year = data.fetch(:exp_year, self.exp_year) self.cvc_check = data.fetch(:cvc_check, self.cvc_check) self.avs_check = data.fetch(:avs_check, self.avs_check) self.name = data.fetch(:name, self.name) self.address1 = data.fetch(:address1, self.address1) self.address2 = data.fetch(:address2, self.address2) self.city = data.fetch(:city, self.city) self.state = data.fetch(:state, self.state) self.zip = data.fetch(:zip, self.zip) self.country_code = data.fetch(:country_code, self.country_code) self.ip_address = data.fetch(:ip_address, self.ip_address) self.fingerprint = data.fetch(:fingerprint, self.fingerprint) self.token_type = data.fetch(:token_type, self.token_type) self.metadata = data.fetch(:metadata, self.metadata) self.expires_soon = data.fetch(:expires_soon, self.expires_soon) self.sandbox = data.fetch(:sandbox, self.sandbox) self.created_at = data.fetch(:created_at, self.created_at) self end
project=(val)
click to toggle source
# File lib/processout/card.rb, line 48 def project=(val) if val.nil? @project = val return end if val.instance_of? Project @project = val else obj = Project.new(@client) obj.fill_with_data(val) @project = obj end end
project_id=(val)
click to toggle source
# File lib/processout/card.rb, line 64 def project_id=(val) @project_id = val end
sandbox=(val)
click to toggle source
# File lib/processout/card.rb, line 184 def sandbox=(val) @sandbox = val end
scheme=(val)
click to toggle source
# File lib/processout/card.rb, line 84 def scheme=(val) @scheme = val end
state=(val)
click to toggle source
# File lib/processout/card.rb, line 152 def state=(val) @state = val end
to_json(options)
click to toggle source
Overrides the JSON marshaller to only send the fields we want
# File lib/processout/card.rb, line 240 def to_json(options) { "id": self.id, "project": self.project, "project_id": self.project_id, "token": self.token, "scheme": self.scheme, "co_scheme": self.co_scheme, "preferred_scheme": self.preferred_scheme, "type": self.type, "bank_name": self.bank_name, "brand": self.brand, "category": self.category, "iin": self.iin, "last_4_digits": self.last_4_digits, "exp_month": self.exp_month, "exp_year": self.exp_year, "cvc_check": self.cvc_check, "avs_check": self.avs_check, "name": self.name, "address1": self.address1, "address2": self.address2, "city": self.city, "state": self.state, "zip": self.zip, "country_code": self.country_code, "ip_address": self.ip_address, "fingerprint": self.fingerprint, "token_type": self.token_type, "metadata": self.metadata, "expires_soon": self.expires_soon, "sandbox": self.sandbox, "created_at": self.created_at, }.to_json end
token=(val)
click to toggle source
# File lib/processout/card.rb, line 68 def token=(val) if val.nil? @token = val return end if val.instance_of? Token @token = val else obj = Token.new(@client) obj.fill_with_data(val) @token = obj end end
token_type=(val)
click to toggle source
# File lib/processout/card.rb, line 172 def token_type=(val) @token_type = val end
type=(val)
click to toggle source
# File lib/processout/card.rb, line 96 def type=(val) @type = val end
zip=(val)
click to toggle source
# File lib/processout/card.rb, line 156 def zip=(val) @zip = val end