Class: StarkInfra::IssuingProduct

Inherits:
StarkCore::Utils::Resource
  • Object
show all
Defined in:
lib/issuingproduct/issuingproduct.rb

Overview

# IssuingProduct object

The IssuingProduct object displays information of registered card products to your Workspace. They represent a group of cards that begin with the same numbers (id) and offer the same product to end customers.

## Attributes (return-only):

  • id [string]: unique card product number (BIN) registered within the card network. ex: ‘53810200’

  • network [string]: card network flag. ex: ‘mastercard’

  • funding_type [string]: type of funding used for payment. ex: ‘credit’, ‘debit’

  • holder_type [string]: holder type. ex: ‘business’, ‘individual’

  • code [string]: internal code from card flag informing the product. ex: ‘MRW’, ‘MCO’, ‘MWB’, ‘MCS’

  • created [DateTime]: creation datetime for the IssuingProduct. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, network: nil, funding_type: nil, holder_type: nil, code: nil, created: nil) ⇒ IssuingProduct

Returns a new instance of IssuingProduct.



21
22
23
24
25
26
27
28
# File 'lib/issuingproduct/issuingproduct.rb', line 21

def initialize(id: nil, network: nil, funding_type: nil, holder_type: nil, code: nil, created: nil)
  super(id)
  @network = network
  @funding_type = funding_type
  @holder_type = holder_type
  @code = code
  @created = StarkCore::Utils::Checks.check_datetime(created)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



20
21
22
# File 'lib/issuingproduct/issuingproduct.rb', line 20

def code
  @code
end

#createdObject (readonly)

Returns the value of attribute created.



20
21
22
# File 'lib/issuingproduct/issuingproduct.rb', line 20

def created
  @created
end

#funding_typeObject (readonly)

Returns the value of attribute funding_type.



20
21
22
# File 'lib/issuingproduct/issuingproduct.rb', line 20

def funding_type
  @funding_type
end

#holder_typeObject (readonly)

Returns the value of attribute holder_type.



20
21
22
# File 'lib/issuingproduct/issuingproduct.rb', line 20

def holder_type
  @holder_type
end

#idObject (readonly)

Returns the value of attribute id.



20
21
22
# File 'lib/issuingproduct/issuingproduct.rb', line 20

def id
  @id
end

#networkObject (readonly)

Returns the value of attribute network.



20
21
22
# File 'lib/issuingproduct/issuingproduct.rb', line 20

def network
  @network
end

Class Method Details

.page(cursor: nil, limit: nil, user: nil) ⇒ Object

# Retrieve paged IssuingProducts

Receive a list of up to 100 IssuingProduct objects previously registered to your workspace 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

  • user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call

## Return:

  • list of IssuingProduct objects with updated attributes

  • cursor to retrieve the next page of IssuingProduct objects



60
61
62
63
64
65
66
67
# File 'lib/issuingproduct/issuingproduct.rb', line 60

def self.page(cursor: nil, limit: nil, user: nil)
  StarkInfra::Utils::Rest.get_page(
    cursor: cursor,
    limit: limit,
    user: user,
    **resource
  )
end

.query(limit: nil, user: nil) ⇒ Object

# Retrieve IssuingProducts

Receive a generator of IssuingProduct objects previously registered in the Stark Infra API

## Parameters (optional):

  • limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35

  • user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call

## Return:

  • generator of IssuingProduct objects with updated attributes



40
41
42
43
44
45
46
# File 'lib/issuingproduct/issuingproduct.rb', line 40

def self.query(limit: nil, user: nil)
  StarkInfra::Utils::Rest.get_stream(
    limit: limit,
    user: user,
    **resource
  )
end

.resourceObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/issuingproduct/issuingproduct.rb', line 69

def self.resource
  {
    resource_name: 'IssuingProduct',
    resource_maker: proc { |json|
      IssuingProduct.new(
        id: json['id'],
        network: json['network'],
        funding_type: json['funding_type'],
        holder_type: json['holder_type'],
        code: json['code'],
        created: json['created']
      )
    }
  }
end