Class: StarkInfra::IssuingCard
- Inherits:
-
StarkCore::Utils::Resource
- Object
- StarkCore::Utils::Resource
- StarkInfra::IssuingCard
- Defined in:
- lib/issuing_card/issuing_card.rb,
lib/issuing_card/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 nil]: [EXPANDABLE] list of card spending rules.
-
product_id [string, default nil]: card product ID to which the card is bound. ex: ‘53810200’
-
tags [list of strings, default nil]: 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
-
#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.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#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, pin: nil, rules: nil, tags: nil, user: nil) ⇒ Object
# Update IssuingCard entity.
Instance Method Summary collapse
-
#initialize(holder_name:, holder_tax_id:, holder_external_id:, display_name: nil, rules: nil, product_id: nil, tags: nil, street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, id: nil, holder_id: nil, type: nil, status: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil) ⇒ IssuingCard
constructor
A new instance of IssuingCard.
Constructor Details
#initialize(holder_name:, holder_tax_id:, holder_external_id:, display_name: nil, rules: nil, product_id: nil, tags: nil, street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, id: nil, holder_id: nil, type: nil, status: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil) ⇒ IssuingCard
Returns a new instance of IssuingCard.
43 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 |
# File 'lib/issuing_card/issuing_card.rb', line 43 def initialize( holder_name: , holder_tax_id: , holder_external_id: , display_name: nil, rules: nil, product_id: nil, tags: nil, street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, id: nil, holder_id: nil, type: nil, status: 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 @display_name = display_name @rules = StarkInfra::IssuingRule.parse_rules(rules) @product_id = product_id @tags = @street_line_1 = street_line_1 @street_line_2 = street_line_2 @district = district @city = city @state_code = state_code @zip_code = zip_code @holder_id = holder_id @type = type @status = status @number = number @security_code = security_code expiration = nil if !expiration.nil? && expiration.include?('*') @expiration = StarkCore::Utils::Checks.check_datetime(expiration) @created = StarkCore::Utils::Checks.check_datetime(created) @updated = StarkCore::Utils::Checks.check_datetime(updated) end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def city @city end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def created @created end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def display_name @display_name end |
#district ⇒ Object (readonly)
Returns the value of attribute district.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def district @district end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def expiration @expiration end |
#holder_external_id ⇒ Object (readonly)
Returns the value of attribute holder_external_id.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def holder_external_id @holder_external_id end |
#holder_id ⇒ Object (readonly)
Returns the value of attribute holder_id.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def holder_id @holder_id end |
#holder_name ⇒ Object (readonly)
Returns the value of attribute holder_name.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def holder_name @holder_name end |
#holder_tax_id ⇒ Object (readonly)
Returns the value of attribute holder_tax_id.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def holder_tax_id @holder_tax_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def id @id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def number @number end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def product_id @product_id end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def rules @rules end |
#security_code ⇒ Object (readonly)
Returns the value of attribute security_code.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def security_code @security_code end |
#state_code ⇒ Object (readonly)
Returns the value of attribute state_code.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def state_code @state_code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def status @status end |
#street_line_1 ⇒ Object (readonly)
Returns the value of attribute street_line_1.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def street_line_1 @street_line_1 end |
#street_line_2 ⇒ Object (readonly)
Returns the value of attribute street_line_2.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def street_line_2 @street_line_2 end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def @tags end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def type @type end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 def updated @updated end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
40 41 42 |
# File 'lib/issuing_card/issuing_card.rb', line 40 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
226 227 228 |
# File 'lib/issuing_card/issuing_card.rb', line 226 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
85 86 87 |
# File 'lib/issuing_card/issuing_card.rb', line 85 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
102 103 104 |
# File 'lib/issuing_card/issuing_card.rb', line 102 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 up to 100 IssuingCard objects previously created in the Stark Infra API and the cursor to the next page. Use this function instead of query if you want to manually page your identities.
## 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 [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
-
before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.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, default nil]: 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 nil]: 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 IssuingCard objects with updated attributes
-
cursor to retrieve the next page of IssuingCards objects
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/issuing_card/issuing_card.rb', line 164 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 = StarkCore::Utils::Checks.check_date(after) before = StarkCore::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
-
after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
-
before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.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, default nil]: 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 nil]: fields to expand information. ex: [‘rules’, ‘security_code’, ‘number’, ‘expiration’]
-
ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: [‘5656565656565656’, ‘4545454545454545’]
-
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
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/issuing_card/issuing_card.rb', line 124 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 = StarkCore::Utils::Checks.check_date(after) before = StarkCore::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
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 260 |
# File 'lib/issuing_card/issuing_card.rb', line 230 def self.resource { resource_name: 'IssuingCard', resource_maker: proc { |json| IssuingCard.new( id: json['id'], holder_name: json['holder_name'], holder_tax_id: json['holder_tax_id'], holder_external_id: json['holder_external_id'], display_name: json['display_name'], rules: json['rules'], product_id: json['product_id'], tags: json['tags'], 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'], holder_id: json['holder_id'], type: json['type'], status: json['status'], 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, pin: 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
-
pin [string, default nil]: You may unlock your physical card by passing its PIN. This is also the PIN you use to authorize a purhcase.
-
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 212 |
# File 'lib/issuing_card/issuing_card.rb', line 201 def self.update(id, status: nil, display_name: nil, pin: nil, rules: nil, tags: nil, user: nil) StarkInfra::Utils::Rest.patch_id( id: id, status: status, pin: pin, display_name: display_name, rules: rules, tags: , user: user, **resource ) end |