Class: StarkInfra::IssuingCard
- Inherits:
-
Utils::Resource
- Object
- Utils::SubResource
- Utils::Resource
- StarkInfra::IssuingCard
- Defined in:
- lib/issuingcard/issuingcard.rb,
lib/issuingcard/log.rb
Overview
# IssuingCard object
The IssuingCard object displays the information of the cards created in your Workspace. Sensitive information will only be returned when the ‘expand’ parameter is used, to avoid security concerns.
## Parameters (required):
-
holder_name [string]: card holder name. ex: ‘Tony Stark’
-
holder_tax_id [string]: card holder tax ID. ex: ‘012.345.678-90’
-
holder_external_id [string] card holder unique id, generated by the user to avoid duplicated holders. ex: ‘my-entity/123’
## Parameters (optional):
-
display_name [string, default nil]: card displayed name. ex: ‘ANTHONY STARK’
-
rules [list of IssuingRule objects, default []]: [EXPANDABLE] list of card spending rules.
-
bin_id [string, default nil]: BIN ID to which the card is bound. ex: ‘53810200’
-
tags [list of strings, default []]: list of strings for tagging. ex: [‘travel’, ‘food’]
-
street_line_1 [string, default sub-issuer street line 1]: card holder main address. ex: ‘Av. Paulista, 200’
-
street_line_2 [string, default sub-issuer street line 2]: card holder address complement. ex: ‘Apto. 123’
-
district [string, default sub-issuer district]: card holder address district / neighbourhood. ex: ‘Bela Vista’
-
city [string, default sub-issuer city]: card holder address city. ex: ‘Rio de Janeiro’
-
state_code [string, default sub-issuer state code]: card holder address state. ex: ‘GO’
-
zip_code [string, default sub-issuer zip code]: card holder address zip code. ex: ‘01311-200’
## Attributes (return-only):
-
id [string]: unique id returned when IssuingCard is created. ex: ‘5656565656565656’
-
holder_id [string]: card holder unique id. ex: ‘5656565656565656’
-
type [string]: card type. ex: ‘virtual’
-
status [string]: current IssuingCard status. ex: ‘active’, ‘blocked’, ‘canceled’, ‘expired’.
-
number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: ‘123’.
-
security_code [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: ‘123’.
-
expiration [DateTime]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: DateTime.new(2032, 3, 10, 10, 30, 0, 0)
-
created [DateTime]: creation datetime for the IssuingCard. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
-
updated [DateTime]: latest update datetime for the IssuingCard. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
Defined Under Namespace
Classes: Log
Instance Attribute Summary collapse
-
#bin_id ⇒ Object
readonly
Returns the value of attribute bin_id.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#district ⇒ Object
readonly
Returns the value of attribute district.
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#holder_external_id ⇒ Object
readonly
Returns the value of attribute holder_external_id.
-
#holder_id ⇒ Object
readonly
Returns the value of attribute holder_id.
-
#holder_name ⇒ Object
readonly
Returns the value of attribute holder_name.
-
#holder_tax_id ⇒ Object
readonly
Returns the value of attribute holder_tax_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
-
#security_code ⇒ Object
readonly
Returns the value of attribute security_code.
-
#state_code ⇒ Object
readonly
Returns the value of attribute state_code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#street_line_1 ⇒ Object
readonly
Returns the value of attribute street_line_1.
-
#street_line_2 ⇒ Object
readonly
Returns the value of attribute street_line_2.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
-
#zip_code ⇒ Object
readonly
Returns the value of attribute zip_code.
Class Method Summary collapse
-
.cancel(id, user: nil) ⇒ Object
# Cancel an IssuingCard entity.
-
.create(cards:, expand: nil, user: nil) ⇒ Object
# Create IssuingCards.
-
.get(id, expand: nil, user: nil) ⇒ Object
# Retrieve a specific IssuingCard.
-
.page(cursor: nil, limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil, expand: nil, user: nil) ⇒ Object
# Retrieve paged IssuingCards.
-
.query(limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil, expand: nil, user: nil) ⇒ Object
# Retrieve IssuingCards.
- .resource ⇒ Object
-
.update(id, status: nil, display_name: nil, rules: nil, tags: nil, user: nil) ⇒ Object
# Update IssuingCard entity.
Instance Method Summary collapse
-
#initialize(holder_name:, holder_tax_id:, holder_external_id:, id: nil, holder_id: nil, type: nil, display_name: nil, status: nil, rules: nil, bin_id: nil, street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, tags: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil) ⇒ IssuingCard
constructor
A new instance of IssuingCard.
Methods inherited from Utils::SubResource
Constructor Details
#initialize(holder_name:, holder_tax_id:, holder_external_id:, id: nil, holder_id: nil, type: nil, display_name: nil, status: nil, rules: nil, bin_id: nil, street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, tags: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil) ⇒ IssuingCard
Returns a new instance of IssuingCard.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/issuingcard/issuingcard.rb', line 44 def initialize( holder_name:, holder_tax_id:, holder_external_id:, id: nil, holder_id: nil, type: nil, display_name: nil, status: nil, rules: nil, bin_id: nil, street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, tags: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil ) super(id) @holder_name = holder_name @holder_tax_id = holder_tax_id @holder_external_id = holder_external_id @holder_id = holder_id @type = type @display_name = display_name @status = status @rules = StarkInfra::IssuingRule.parse_rules(rules) @bin_id = bin_id @street_line_1 = street_line_1 @street_line_2 = street_line_2 @district = district @city = city @state_code = state_code @zip_code = zip_code @tags = @number = number @security_code = security_code expiration = nil if !expiration.nil? && expiration.include?('*') @expiration = StarkInfra::Utils::Checks.check_datetime(expiration) @created = StarkInfra::Utils::Checks.check_datetime(created) @updated = StarkInfra::Utils::Checks.check_datetime(updated) end |
Instance Attribute Details
#bin_id ⇒ Object (readonly)
Returns the value of attribute bin_id.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def bin_id @bin_id end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def city @city end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def created @created end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def display_name @display_name end |
#district ⇒ Object (readonly)
Returns the value of attribute district.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def district @district end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def expiration @expiration end |
#holder_external_id ⇒ Object (readonly)
Returns the value of attribute holder_external_id.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def holder_external_id @holder_external_id end |
#holder_id ⇒ Object (readonly)
Returns the value of attribute holder_id.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def holder_id @holder_id end |
#holder_name ⇒ Object (readonly)
Returns the value of attribute holder_name.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def holder_name @holder_name end |
#holder_tax_id ⇒ Object (readonly)
Returns the value of attribute holder_tax_id.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def holder_tax_id @holder_tax_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def id @id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def number @number end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def rules @rules end |
#security_code ⇒ Object (readonly)
Returns the value of attribute security_code.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def security_code @security_code end |
#state_code ⇒ Object (readonly)
Returns the value of attribute state_code.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def state_code @state_code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def status @status end |
#street_line_1 ⇒ Object (readonly)
Returns the value of attribute street_line_1.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def street_line_1 @street_line_1 end |
#street_line_2 ⇒ Object (readonly)
Returns the value of attribute street_line_2.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def street_line_2 @street_line_2 end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def @tags end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def type @type end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def updated @updated end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
41 42 43 |
# File 'lib/issuingcard/issuingcard.rb', line 41 def zip_code @zip_code end |
Class Method Details
.cancel(id, user: nil) ⇒ Object
# Cancel an IssuingCard entity
Cancel an IssuingCard entity previously created in the Stark Infra API
## Parameters (required):
-
id [string]: IssuingCard unique id. ex: ‘5656565656565656’
## Parameters (optional):
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
## Return:
-
canceled IssuingCard object
225 226 227 |
# File 'lib/issuingcard/issuingcard.rb', line 225 def self.cancel(id, user: nil) StarkInfra::Utils::Rest.delete_id(id: id, user: user, **resource) end |
.create(cards:, expand: nil, user: nil) ⇒ Object
# Create IssuingCards
Send a list of IssuingCard objects for creation in the Stark Infra API
## Parameters (required):
-
cards [list of IssuingCard objects]: list of IssuingCard objects to be created in the API
## Parameters (optional):
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
## Return:
-
list of IssuingCard objects with updated attributes
87 88 89 |
# File 'lib/issuingcard/issuingcard.rb', line 87 def self.create(cards:, expand: nil, user: nil) StarkInfra::Utils::Rest.post(entities: cards, expand: , user: user, **resource) end |
.get(id, expand: nil, user: nil) ⇒ Object
# Retrieve a specific IssuingCard
Receive a single IssuingCard object previously created in the Stark Infra API by its id
## Parameters (required):
-
id [string]: object unique id. ex: ‘5656565656565656’
## Parameters (optional):
-
expand [list of strings, default nil]: fields to expand information. ex: [‘rules’, ‘securityCode’, ‘number’, ‘expiration’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
## Return:
-
IssuingCard object with updated attributes
104 105 106 |
# File 'lib/issuingcard/issuingcard.rb', line 104 def self.get(id, expand: nil, user: nil) StarkInfra::Utils::Rest.get_id(id: id, expand: , user: user, **resource) end |
.page(cursor: nil, limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil, expand: nil, user: nil) ⇒ Object
# Retrieve paged IssuingCards
Receive a list of IssuingCards objects previously created in the Stark Infra API and the cursor to the next page.
## Parameters (optional):
-
cursor [string, default nil]: cursor returned on the previous page function call.
-
limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
-
ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: [‘5656565656565656’, ‘4545454545454545’]
-
after [DateTime or string, default nil] date filter for objects created only after specified date. ex: DateTime.new(2020, 3, 10)
-
before [DateTime or string, default nil] date filter for objects created only before specified date. ex: DateTime.new(2020, 3, 10)
-
status [list of strings, default nil]: filter for status of retrieved objects. ex: [‘active’, ‘blocked’, ‘canceled’, ‘expired’]
-
types [list of strings, default nil]: card type. ex: [‘virtual’]
-
holder_ids [list of strings]: card holder IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
tags [list of strings, default nil]: tags to filter retrieved objects. ex: [‘tony’, ‘stark’]
-
expand [list of strings, default []]: fields to expand information. ex: [‘rules’, ‘security_code’, ‘number’, ‘expiration’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
## Return:
-
list of IssuingCards objects with updated attributes
-
cursor to retrieve the next page of IssuingCards objects
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/issuingcard/issuingcard.rb', line 165 def self.page(cursor: nil, limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil, expand: nil, user: nil) after = StarkInfra::Utils::Checks.check_date(after) before = StarkInfra::Utils::Checks.check_date(before) StarkInfra::Utils::Rest.get_page( cursor: cursor, limit: limit, ids: ids, after: after, before: before, status: status, types: types, holder_ids: holder_ids, tags: , expand: , user: user, **resource ) end |
.query(limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil, expand: nil, user: nil) ⇒ Object
# Retrieve IssuingCards
Receive a generator of IssuingCards objects previously created in the Stark Infra API
## Parameters (optional):
-
limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
-
ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: [‘5656565656565656’, ‘4545454545454545’]
-
after [DateTime or string, default nil] date filter for objects created only after specified date. ex: DateTime.new(2020, 3, 10)
-
before [DateTime or string, default nil] date filter for objects created only before specified date. ex: DateTime.new(2020, 3, 10)
-
status [list of strings, default nil]: filter for status of retrieved objects. ex: [‘active’, ‘blocked’, ‘canceled’, ‘expired’]
-
types [list of strings, default nil]: card type. ex: [‘virtual’]
-
holder_ids [list of strings]: card holder IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
tags [list of strings, default nil]: tags to filter retrieved objects. ex: [‘tony’, ‘stark’]
-
expand [list of strings, default []]: fields to expand information. ex: [‘rules’, ‘security_code’, ‘number’, ‘expiration’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
## Return:
-
generator of IssuingCards objects with updated attributes
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/issuingcard/issuingcard.rb', line 126 def self.query(limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil, expand: nil, user: nil) after = StarkInfra::Utils::Checks.check_date(after) before = StarkInfra::Utils::Checks.check_date(before) StarkInfra::Utils::Rest.get_stream( limit: limit, ids: ids, after: after, before: before, status: status, types: types, holder_ids: holder_ids, tags: , expand: , user: user, **resource ) end |
.resource ⇒ Object
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/issuingcard/issuingcard.rb', line 229 def self.resource { resource_name: 'IssuingCard', resource_maker: proc { |json| IssuingCard.new( id: json['id'], holder_id: json['holder_id'], holder_name: json['holder_name'], holder_tax_id: json['holder_tax_id'], holder_external_id: json['holder_external_id'], type: json['type'], display_name: json['display_name'], status: json['status'], rules: json['rules'], bin_id: json['bin_id'], street_line_1: json['street_line_1'], street_line_2: json['street_line_2'], district: json['district'], city: json['city'], state_code: json['state_code'], zip_code: json['zip_code'], tags: json['tags'], number: json['number'], security_code: json['security_code'], expiration: json['expiration'], created: json['created'], updated: json['updated'] ) } } end |
.update(id, status: nil, display_name: nil, rules: nil, tags: nil, user: nil) ⇒ Object
# Update IssuingCard entity
Update an IssuingCard by passing id.
## Parameters (required):
-
id [string]: IssuingCard unique id. ex: ‘5656565656565656’
## Parameters (optional):
-
status [string, default nil]: You may block the IssuingCard by passing ‘blocked’ or activate by passing ‘active’ in the status
-
display_name [string, default nil]: card displayed name
-
rules [list of IssuingRule objects, default nil]: [EXPANDABLE] list of card spending rules.
-
tags [list of strings, default nil]: list of strings for tagging
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
target IssuingCard with updated attributes
201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/issuingcard/issuingcard.rb', line 201 def self.update(id, status: nil, display_name: nil, rules: nil, tags: nil, user: nil) StarkInfra::Utils::Rest.patch_id( id: id, status: status, display_name: display_name, rules: rules, tags: , user: user, **resource ) end |