Class: StarkInfra::IssuingEmbossingKit

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

Overview

# IssuingEmbossingKit object

The IssuingEmbossingKit object displays information on the embossing kits available to your Workspace.

## Attributes (return-only):

  • id [string]: unique id returned when IssuingEmbossingKit is created. ex: “5656565656565656”

  • name [string]: card or package design name. ex: “stark-plastic-dark-001”

  • designs [list of IssuingDesign objects]: list of IssuingDesign objects. ex: [IssuingDesign(), IssuingDesign()]

  • updated [DateTime]: latest update datetime for the IssuingEmbossingKit. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)

  • created [DateTime]: creation datetime for the IssuingEmbossingKit. 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, name: nil, designs: nil, updated: nil, created: nil) ⇒ IssuingEmbossingKit

Returns a new instance of IssuingEmbossingKit.



19
20
21
22
23
24
25
26
27
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 19

def initialize(
  id: nil, name: nil, designs: nil, updated: nil, created: nil
)
  super(id)
  @name = name
  @designs = IssuingDesign::parse_designs(designs)
  @updated = StarkCore::Utils::Checks.check_datetime(updated)
  @created = StarkCore::Utils::Checks.check_datetime(created)
end

Instance Attribute Details

#createdObject (readonly)

Returns the value of attribute created.



18
19
20
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 18

def created
  @created
end

#designsObject (readonly)

Returns the value of attribute designs.



18
19
20
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 18

def designs
  @designs
end

#idObject (readonly)

Returns the value of attribute id.



18
19
20
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 18

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 18

def name
  @name
end

#updatedObject (readonly)

Returns the value of attribute updated.



18
19
20
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 18

def updated
  @updated
end

Class Method Details

.get(id, user: nil) ⇒ Object

# Retrieve a specific IssuingEmbossingKit

Receive a single IssuingEmbossingKit object previously created in the Stark Infra API by its id

## Parameters (required):

  • id [string]: object 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:

  • IssuingEmbossingKit object with updated attributes



41
42
43
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 41

def self.get(id, user: nil)
  StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
end

.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, design_ids: nil, ids: nil, user: nil) ⇒ Object

# Retrieve paged IssuingEmbossingKits

Receive a list of up to 100 IssuingEmbossingKit 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 requests.

## 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

  • 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: [“created”, “processing”, “success”, “failed”]

  • design_ids [list of string, default nil]: list of design_ids to filter retrieved objects. ex: [“5656565656565656”, “4545454545454545”]

  • 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:

  • list of IssuingEmbossingKit objects with updated attributes

  • cursor to retrieve the next page of IssuingEmbossingKit objects



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 91

def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, design_ids: nil, ids: nil, user: nil)
  StarkInfra::Utils::Rest.get_page(
    cursor: cursor,
    limit: limit,
    after: after,
    before: before,
    status: status,
    design_ids: design_ids,
    ids: ids,
    user: user,
    **resource
  )
end

.query(limit: nil, after: nil, before: nil, status: nil, design_ids: nil, ids: nil, user: nil) ⇒ Object

# Retrieve IssuingEmbossingKits

Receive a generator of IssuingEmbossingKits 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: [“created”, “processing”, “success”, “failed”]

  • design_ids [list of string, default nil]: list of design_ids to filter retrieved objects. ex: [“5656565656565656”, “4545454545454545”]

  • 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 IssuingEmbossingKits objects with updated attributes



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 60

def self.query(limit: nil, after: nil, before: nil, status: nil, design_ids: nil, ids: nil, user: nil)
  StarkInfra::Utils::Rest.get_stream(
    limit: limit,
    after: after,
    before: before,
    status: status,
    design_ids: design_ids,
    ids: ids,
    user: user,
    **resource
  )
end

.resourceObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/issuing_embossing_kit/issuing_embossing_kit.rb', line 105

def self.resource
  {
    resource_name: 'IssuingEmbossingKit',
    resource_maker: proc { |json|
      IssuingEmbossingKit.new(
        id: json['id'],
        name: json['name'],
        designs: json['designs'],
        updated: json['updated'],
        created: json['created']
      )
    }
  }
end