starkinfra 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +125 -0
  3. data/lib/cardmethod/cardmethod.rb +56 -0
  4. data/lib/creditholmes/creditholmes.rb +160 -0
  5. data/lib/creditnote/creditnote.rb +51 -355
  6. data/lib/creditnote/invoice/description.rb +51 -0
  7. data/lib/creditnote/invoice/discount.rb +49 -0
  8. data/lib/creditnote/invoice/invoice.rb +124 -0
  9. data/lib/creditnote/log.rb +18 -19
  10. data/lib/creditnote/transfer.rb +90 -0
  11. data/lib/creditpreview/creditnotepreview.rb +85 -0
  12. data/lib/creditpreview/creditpreview.rb +77 -0
  13. data/lib/creditsigner/creditsigner.rb +57 -0
  14. data/lib/dynamicbrcode/dynamicbrcode.rb +350 -0
  15. data/lib/event/attempt.rb +5 -4
  16. data/lib/event/event.rb +11 -11
  17. data/lib/individualdocument/individualdocument.rb +165 -0
  18. data/lib/individualdocument/log.rb +125 -0
  19. data/lib/individualidentity/individualidentity.rb +193 -0
  20. data/lib/individualidentity/log.rb +124 -0
  21. data/lib/issuingbalance/issuingbalance.rb +4 -4
  22. data/lib/issuingcard/issuingcard.rb +35 -33
  23. data/lib/issuingcard/log.rb +21 -21
  24. data/lib/issuingdesign/issuingdesign.rb +138 -0
  25. data/lib/issuingembossingkit/issuingembossingkit.rb +121 -0
  26. data/lib/issuingembossingrequest/issuingembossingrequest.rb +210 -0
  27. data/lib/issuingembossingrequest/log.rb +128 -0
  28. data/lib/issuingholder/issuingholder.rb +21 -15
  29. data/lib/issuingholder/log.rb +19 -19
  30. data/lib/issuinginvoice/issuinginvoice.rb +29 -14
  31. data/lib/issuinginvoice/log.rb +18 -18
  32. data/lib/{issuingbin/issuingbin.rb → issuingproduct/issuingproduct.rb} +27 -30
  33. data/lib/issuingpurchase/issuingpurchase.rb +111 -31
  34. data/lib/issuingpurchase/log.rb +16 -16
  35. data/lib/issuingrestock/issuingrestock.rb +162 -0
  36. data/lib/issuingrestock/log.rb +127 -0
  37. data/lib/issuingrule/issuingrule.rb +64 -18
  38. data/lib/issuingstock/issuingstock.rb +138 -0
  39. data/lib/issuingstock/log.rb +130 -0
  40. data/lib/issuingtransaction/issuingtransaction.rb +12 -13
  41. data/lib/issuingwithdrawal/issuingwithdrawal.rb +12 -11
  42. data/lib/merchantcategory/merchantcategory.rb +63 -0
  43. data/lib/merchantcountry/merchantcountry.rb +59 -0
  44. data/lib/pixbalance/pixbalance.rb +5 -5
  45. data/lib/pixchargeback/log.rb +15 -15
  46. data/lib/pixchargeback/pixchargeback.rb +32 -20
  47. data/lib/pixclaim/log.rb +21 -24
  48. data/lib/pixclaim/pixclaim.rb +44 -34
  49. data/lib/pixdirector/pixdirector.rb +9 -11
  50. data/lib/pixdomain/certificate.rb +1 -1
  51. data/lib/pixdomain/pixdomain.rb +5 -5
  52. data/lib/pixinfraction/log.rb +20 -20
  53. data/lib/pixinfraction/pixinfraction.rb +23 -15
  54. data/lib/pixkey/log.rb +23 -23
  55. data/lib/pixkey/pixkey.rb +14 -12
  56. data/lib/pixrequest/log.rb +24 -20
  57. data/lib/pixrequest/pixrequest.rb +54 -21
  58. data/lib/pixreversal/log.rb +3 -3
  59. data/lib/pixreversal/pixreversal.rb +48 -21
  60. data/lib/pixstatement/pixstatement.rb +13 -8
  61. data/lib/starkinfra.rb +40 -15
  62. data/lib/staticbrcode/staticbrcode.rb +170 -0
  63. data/lib/user/project.rb +1 -1
  64. data/lib/utils/api.rb +1 -0
  65. data/lib/utils/bacenid.rb +1 -1
  66. data/lib/utils/parse.rb +7 -3
  67. data/lib/utils/request.rb +1 -1
  68. data/lib/utils/resource.rb +1 -1
  69. data/lib/utils/sub_resource.rb +21 -22
  70. data/lib/webhook/webhook.rb +11 -11
  71. metadata +29 -4
  72. data/lib/issuingauthorization/issuingauthorization.rb +0 -141
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
3
+ require_relative('issuingcard')
4
4
  require_relative('../utils/rest')
5
5
  require_relative('../utils/checks')
6
- require_relative('issuingcard')
6
+ require_relative('../utils/resource')
7
7
 
8
8
  module StarkInfra
9
9
  class IssuingCard
10
10
  # # IssuingCard::Log object
11
11
  #
12
- # Every time an IssuingCard entity is updated, a corresponding issuing card.Log is generated for the entity. This log
12
+ # Every time an IssuingCard entity is updated, a corresponding IssuingCard::Log is generated for the entity. This log
13
13
  # is never generated by the user, but it can be retrieved to check additional information on the IssuingCard.
14
14
  #
15
- # ## Attributes:
15
+ # ## Attributes (return-only):
16
16
  # - id [string]: unique id returned when the log is created. ex: '5656565656565656'
17
- # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
18
- # - type [string]: type of the IssuingCard event which triggered the log creation. ex: 'processing' or 'success'
19
17
  # - card [IssuingCard]: IssuingCard entity to which the log refers to.
18
+ # - type [string]: type of the IssuingCard event which triggered the log creation. ex: 'processing' or 'success'
19
+ # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
20
  class Log < StarkInfra::Utils::Resource
21
21
  attr_reader :id, :created, :type, :card
22
22
  def initialize(id:, created:, type:, card:)
@@ -26,9 +26,9 @@ module StarkInfra
26
26
  @created = StarkInfra::Utils::Checks.check_datetime(created)
27
27
  end
28
28
 
29
- # # Retrieve a specific Log
29
+ # # Retrieve a specific IssuingCard::Log
30
30
  #
31
- # Receive a single Log object previously created by the Stark Infra API by passing its id
31
+ # Receive a single IssuingCard::Log object previously created by the Stark Infra API by passing its id
32
32
  #
33
33
  # ## Parameters (required):
34
34
  # - id [string]: object unique id. ex: '5656565656565656'
@@ -37,26 +37,26 @@ module StarkInfra
37
37
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
38
38
  #
39
39
  # ## Return:
40
- # - Log object with updated attributes
40
+ # - IssuingCard::Log object with updated attributes
41
41
  def self.get(id, user: nil)
42
42
  StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
43
43
  end
44
44
 
45
- # # Retrieve Logs
45
+ # # Retrieve IssuingCard::Logs
46
46
  #
47
- # Receive a generator of Log objects previously created in the Stark Infra API
47
+ # Receive a generator of IssuingCard::Log objects previously created in the Stark Infra API
48
48
  #
49
49
  # ## Parameters (optional):
50
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
51
50
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
52
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
53
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
51
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
52
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
54
53
  # - types [list of strings, default nil]: filter for log event types. ex: ['blocked', 'canceled', 'created', 'expired', 'unblocked', 'updated']
55
54
  # - card_ids [list of strings, default nil]: list of IssuingCard ids to filter logs. ex: ['5656565656565656', '4545454545454545']
55
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
56
56
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
57
57
  #
58
58
  # ## Return:
59
- # - generator of Log objects with updated attributes
59
+ # - generator of IssuingCard::Log objects with updated attributes
60
60
  def self.query(limit: nil, after: nil, before: nil, types: nil, card_ids: nil, user: nil)
61
61
  after = StarkInfra::Utils::Checks.check_date(after)
62
62
  before = StarkInfra::Utils::Checks.check_date(before)
@@ -71,23 +71,23 @@ module StarkInfra
71
71
  )
72
72
  end
73
73
 
74
- # # Retrieve paged Logs
74
+ # # Retrieve paged IssuingCard::Logs
75
75
  #
76
- # Receive a list of up to 100 Log objects previously created in the Stark Infra API and the cursor to the next page.
76
+ # Receive a list of up to 100 IssuingCard::Log objects previously created in the Stark Infra API and the cursor to the next page.
77
77
  # Use this function instead of query if you want to manually page your logs.
78
78
  #
79
79
  # ## Parameters (optional):
80
80
  # - cursor [string, default nil]: cursor returned on the previous page function call
81
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
82
81
  # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
83
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
84
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
82
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
83
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
85
84
  # - types [list of strings, default nil]: filter for log event types. ex: ['blocked', 'canceled', 'created', 'expired', 'unblocked', 'updated']
86
85
  # - card_ids [list of strings, default nil]: list of IssuingCard ids to filter logs. ex: ['5656565656565656', '4545454545454545']
86
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
87
87
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
88
88
  #
89
89
  # ## Return:
90
- # - list of Log objects with updated attributes
90
+ # - list of IssuingCard::Log objects with updated attributes
91
91
  # - Cursor to retrieve the next page of Log objects
92
92
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, card_ids: nil, user: nil)
93
93
  after = StarkInfra::Utils::Checks.check_date(after)
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative('../utils/rest')
4
+ require_relative('../utils/checks')
5
+ require_relative('../utils/resource')
6
+
7
+ module StarkInfra
8
+ # # IssuingDesign object
9
+ #
10
+ # The IssuingDesign object displays information on the card and card package designs available to your Workspace.
11
+ #
12
+ # ## Attributes (return-only):
13
+ # - id [string]: unique id returned when IssuingDesign is created. ex: "5656565656565656"
14
+ # - name [string]: card or package design name. ex: "stark-plastic-dark-001"
15
+ # - embosser_ids [list of strings]: list of embosser unique ids. ex: ["5136459887542272", "5136459887542273"]
16
+ # - type [string]: card or package design type. Options: "card", "envelope"
17
+ # - updated [DateTime]: latest update datetime for the IssuingDesign. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
18
+ # - created [DateTime]: creation datetime for the IssuingDesign. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
19
+ class IssuingDesign < StarkInfra::Utils::Resource
20
+ attr_reader :id, :name, :embosser_ids, :type, :updated, :created
21
+ def initialize(
22
+ id: nil, name: nil, embosser_ids: nil, type: nil, updated: nil, created: nil
23
+ )
24
+ super(id)
25
+ @name = name
26
+ @embosser_ids = embosser_ids
27
+ @type = type
28
+ @updated = StarkInfra::Utils::Checks.check_datetime(updated)
29
+ @created = StarkInfra::Utils::Checks.check_datetime(created)
30
+ end
31
+
32
+ # # Retrieve a specific IssuingDesign
33
+ #
34
+ # Receive a single IssuingDesign object previously created in the Stark Infra API by its id
35
+ #
36
+ # ## Parameters (required):
37
+ # - id [string]: object unique id. ex: '5656565656565656'
38
+ #
39
+ # ## Parameters (optional):
40
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
41
+ #
42
+ # ## Return:
43
+ # - IssuingDesign object with updated attributes
44
+ def self.get(id, user: nil)
45
+ StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
46
+ end
47
+
48
+ # # Retrieve IssuingDesigns
49
+ #
50
+ # Receive a generator of IssuingDesigns objects previously created in the Stark Infra API
51
+ #
52
+ # ## Parameters (optional):
53
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
54
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
55
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
56
+ #
57
+ # ## Return:
58
+ # - generator of IssuingDesigns objects with updated attributes
59
+ def self.query(limit: nil, ids: nil, user: nil)
60
+ StarkInfra::Utils::Rest.get_stream(
61
+ limit: limit,
62
+ ids: ids,
63
+ user: user,
64
+ **resource
65
+ )
66
+ end
67
+
68
+ # # Retrieve paged IssuingDesigns
69
+ #
70
+ # Receive a list of up to 100 IssuingDesign objects previously created in the Stark Infra API and the cursor to the next page.
71
+ # Use this function instead of query if you want to manually page your requests.
72
+ #
73
+ # ## Parameters (optional):
74
+ # - cursor [string, default nil]: cursor returned on the previous page function call.
75
+ # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
76
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
77
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
78
+ #
79
+ # ## Return:
80
+ # - list of IssuingDesign objects with updated attributes
81
+ # - cursor to retrieve the next page of IssuingDesign objects
82
+ def self.page(cursor: nil, limit: nil, status: nil, user: nil)
83
+ StarkInfra::Utils::Rest.get_page(
84
+ cursor: cursor,
85
+ limit: limit,
86
+ status: status,
87
+ user: user,
88
+ **resource
89
+ )
90
+ end
91
+
92
+ # # Retrieve a specific IssuingDesign pdf file
93
+ #
94
+ # Receive a single IssuingDesign pdf file generated in the Stark Infra API by its id.
95
+ #
96
+ # ## Parameters (required):
97
+ # - id [string]: object unique id. ex: '5656565656565656'
98
+ #
99
+ # ## Parameters (optional):
100
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
101
+ #
102
+ # ## Return:
103
+ # - IssuingDesign pdf file
104
+ def self.pdf(id, user: nil)
105
+ StarkInfra::Utils::Rest.get_content(id: id, user: user, sub_resource_name: 'pdf', **resource)
106
+ end
107
+
108
+ def self.parse_designs(designs)
109
+ resource_maker = StarkInfra::IssuingDesign.resource[:resource_maker]
110
+ return designs if designs.nil?
111
+
112
+ parsed_designs = []
113
+ designs.each do |design|
114
+ unless design.is_a? IssuingDesign
115
+ design = StarkInfra::Utils::API.from_api_json(resource_maker, design)
116
+ end
117
+ parsed_designs << design
118
+ end
119
+ parsed_designs
120
+ end
121
+
122
+ def self.resource
123
+ {
124
+ resource_name: 'IssuingDesign',
125
+ resource_maker: proc { |json|
126
+ IssuingDesign.new(
127
+ id: json['id'],
128
+ name: json['name'],
129
+ embosser_ids: json['embosser_ids'],
130
+ type: json['type'],
131
+ updated: json['updated'],
132
+ created: json['created']
133
+ )
134
+ }
135
+ }
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative('../utils/rest')
4
+ require_relative('../utils/checks')
5
+ require_relative('../utils/resource')
6
+
7
+ module StarkInfra
8
+ # # IssuingEmbossingKit object
9
+ #
10
+ # The IssuingEmbossingKit object displays information on the embossing kits available to your Workspace.
11
+ #
12
+ # ## Attributes (return-only):
13
+ # - id [string]: unique id returned when IssuingEmbossingKit is created. ex: "5656565656565656"
14
+ # - name [string]: card or package design name. ex: "stark-plastic-dark-001"
15
+ # - designs [list of IssuingDesign objects]: list of IssuingDesign objects. ex: [IssuingDesign(), IssuingDesign()]
16
+ # - updated [DateTime]: latest update datetime for the IssuingEmbossingKit. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
17
+ # - created [DateTime]: creation datetime for the IssuingEmbossingKit. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
18
+ class IssuingEmbossingKit < StarkInfra::Utils::Resource
19
+ attr_reader :id, :name, :designs, :updated, :created
20
+ def initialize(
21
+ id: nil, name: nil, designs: nil, updated: nil, created: nil
22
+ )
23
+ super(id)
24
+ @name = name
25
+ @designs = IssuingDesign::parse_designs(designs)
26
+ @updated = StarkInfra::Utils::Checks.check_datetime(updated)
27
+ @created = StarkInfra::Utils::Checks.check_datetime(created)
28
+ end
29
+
30
+ # # Retrieve a specific IssuingEmbossingKit
31
+ #
32
+ # Receive a single IssuingEmbossingKit object previously created in the Stark Infra API by its id
33
+ #
34
+ # ## Parameters (required):
35
+ # - id [string]: object unique id. ex: '5656565656565656'
36
+ #
37
+ # ## Parameters (optional):
38
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
39
+ #
40
+ # ## Return:
41
+ # - IssuingEmbossingKit object with updated attributes
42
+ def self.get(id, user: nil)
43
+ StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
44
+ end
45
+
46
+ # # Retrieve IssuingEmbossingKits
47
+ #
48
+ # Receive a generator of IssuingEmbossingKits objects previously created in the Stark Infra API
49
+ #
50
+ # ## Parameters (optional):
51
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
52
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
53
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
54
+ # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ["created", "processing", "success", "failed"]
55
+ # - design_ids [list of string, default nil]: list of design_ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
56
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
57
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
58
+ #
59
+ # ## Return:
60
+ # - generator of IssuingEmbossingKits objects with updated attributes
61
+ def self.query(limit: nil, after: nil, before: nil, status: nil, design_ids: nil, ids: nil, user: nil)
62
+ StarkInfra::Utils::Rest.get_stream(
63
+ limit: limit,
64
+ after: after,
65
+ before: before,
66
+ status: status,
67
+ design_ids: design_ids,
68
+ ids: ids,
69
+ user: user,
70
+ **resource
71
+ )
72
+ end
73
+
74
+ # # Retrieve paged IssuingEmbossingKits
75
+ #
76
+ # Receive a list of up to 100 IssuingEmbossingKit objects previously created in the Stark Infra API and the cursor to the next page.
77
+ # Use this function instead of query if you want to manually page your requests.
78
+ #
79
+ # ## Parameters (optional):
80
+ # - cursor [string, default nil]: cursor returned on the previous page function call.
81
+ # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
82
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
83
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
84
+ # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ["created", "processing", "success", "failed"]
85
+ # - design_ids [list of string, default nil]: list of design_ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
86
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
87
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
88
+ #
89
+ # ## Return:
90
+ # - list of IssuingEmbossingKit objects with updated attributes
91
+ # - cursor to retrieve the next page of IssuingEmbossingKit objects
92
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, design_ids: nil, ids: nil, user: nil)
93
+ StarkInfra::Utils::Rest.get_page(
94
+ cursor: cursor,
95
+ limit: limit,
96
+ after: after,
97
+ before: before,
98
+ status: status,
99
+ design_ids: design_ids,
100
+ ids: ids,
101
+ user: user,
102
+ **resource
103
+ )
104
+ end
105
+
106
+ def self.resource
107
+ {
108
+ resource_name: 'IssuingEmbossingKit',
109
+ resource_maker: proc { |json|
110
+ IssuingEmbossingKit.new(
111
+ id: json['id'],
112
+ name: json['name'],
113
+ designs: json['designs'],
114
+ updated: json['updated'],
115
+ created: json['created']
116
+ )
117
+ }
118
+ }
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,210 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative('../utils/rest')
4
+ require_relative('../utils/checks')
5
+ require_relative('../utils/resource')
6
+
7
+ module StarkInfra
8
+ # # IssuingEmbossingRequest object
9
+ #
10
+ # The IssuingEmbossingRequest object displays the information of embossing requests in your Workspace.
11
+ #
12
+ # ## Parameters (required):
13
+ # - card_id [string]: id of the IssuingCard to be embossed. ex "5656565656565656"
14
+ # - kit_id [string]: card embossing kit id. ex "5656565656565656"
15
+ # - display_name_1 [string]: card displayed name. ex: "ANTHONY STARK"
16
+ # - shipping_city [string]: shipping city. ex: "NEW YORK"
17
+ # - shipping_country_code [string]: shipping country code. ex: "US"
18
+ # - shipping_district [string]: shipping district. ex: "NY"
19
+ # - shipping_state_code [string]: shipping state code. ex: "NY"
20
+ # - shipping_street_line_1 [string]: shipping main address. ex: "AVENUE OF THE AMERICAS"
21
+ # - shipping_street_line_2 [string]: shipping address complement. ex: "Apt. 6"
22
+ # - shipping_service [string]: shipping service. ex: "loggi"
23
+ # - shipping_tracking_number [string]: shipping tracking number. ex: "5656565656565656"
24
+ # - shipping_zip_code [string]: shipping zip code. ex: "12345-678"
25
+ #
26
+ # ## Parameters (optional):
27
+ # - embosser_id [string, default nil]: id of the card embosser. ex: "5656565656565656"
28
+ # - display_name_2 [string, default nil]: card displayed name. ex: "IT Services"
29
+ # - display_name_3 [string, default nil]: card displayed name. ex: "StarkBank S.A."
30
+ # - shipping_phone [string, deafult nil]: shipping phone. ex: "+5511999999999"
31
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ["card", "corporate"]
32
+ #
33
+ # ## Attributes (return-only):
34
+ # - id [string]: unique id returned when IssuingEmbossingRequest is created. ex: "5656565656565656"
35
+ # - fee [integer]: fee charged when IssuingEmbossingRequest is created. ex: 1000
36
+ # - status [string]: status of the IssuingEmbossingRequest. ex: "created", "processing", "success", "failed"
37
+ # - updated [DateTime]: latest update datetime for the IssuingEmbossingRequest. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
38
+ # - created [DateTime]: creation datetime for the IssuingEmbossingRequest. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
39
+ class IssuingEmbossingRequest < StarkInfra::Utils::Resource
40
+ attr_reader :card_id, :kit_id, :display_name_1, :shipping_city, :shipping_country_code,
41
+ :shipping_district, :shipping_state_code, :shipping_street_line_1, :shipping_street_line_2,
42
+ :shipping_service, :shipping_tracking_number, :shipping_zip_code, :embosser_id, :display_name_2,
43
+ :display_name_3, :shipping_phone, :tags, :id, :fee, :status, :created, :updated
44
+ def initialize(
45
+ card_id:, kit_id:, display_name_1:, shipping_city:,
46
+ shipping_country_code:, shipping_district:, shipping_state_code:, shipping_street_line_1:,
47
+ shipping_street_line_2:, shipping_service:, shipping_tracking_number:, shipping_zip_code:,
48
+ embosser_id: nil, display_name_2: nil, display_name_3: nil, shipping_phone: nil,
49
+ tags: nil, id: nil, fee: nil, status: nil, updated: nil, created: nil
50
+ )
51
+ super(id)
52
+ @card_id = card_id
53
+ @kit_id = kit_id
54
+ @display_name_1 = display_name_1
55
+ @shipping_city = shipping_city
56
+ @shipping_country_code = shipping_country_code
57
+ @shipping_district = shipping_district
58
+ @shipping_state_code = shipping_state_code
59
+ @shipping_street_line_1 = shipping_street_line_1
60
+ @shipping_street_line_2 = shipping_street_line_2
61
+ @shipping_service = shipping_service
62
+ @shipping_tracking_number = shipping_tracking_number
63
+ @shipping_zip_code = shipping_zip_code
64
+ @embosser_id = embosser_id
65
+ @display_name_2 = display_name_2
66
+ @display_name_3 = display_name_3
67
+ @shipping_phone = shipping_phone
68
+ @tags = tags
69
+ @fee = fee
70
+ @status = status
71
+ @created = StarkInfra::Utils::Checks.check_datetime(created)
72
+ @updated = StarkInfra::Utils::Checks.check_datetime(updated)
73
+ end
74
+
75
+ # # Create IssuingEmbossingRequests
76
+ #
77
+ # Send a list of IssuingEmbossingRequest objects for creation in the Stark Infra API
78
+ #
79
+ # ## Parameters (required):
80
+ # - requests [list of IssuingEmbossingRequest objects]: list of IssuingEmbossingRequest objects to be created in the API
81
+ #
82
+ # ## Parameters (optional):
83
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
84
+ #
85
+ # ## Return:
86
+ # - list of IssuingEmbossingRequest objects with updated attributes
87
+ def self.create(requests:, user: nil)
88
+ StarkInfra::Utils::Rest.post(entities: requests, user: user, **resource)
89
+ end
90
+
91
+ # # Retrieve a specific IssuingEmbossingRequest
92
+ #
93
+ # Receive a single IssuingEmbossingRequest object previously created in the Stark Infra API by its id
94
+ #
95
+ # ## Parameters (required):
96
+ # - id [string]: object unique id. ex: '5656565656565656'
97
+ #
98
+ # ## Parameters (optional):
99
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
100
+ #
101
+ # ## Return:
102
+ # - IssuingEmbossingRequest object with updated attributes
103
+ def self.get(id, user: nil)
104
+ StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
105
+ end
106
+
107
+ # # Retrieve IssuingEmbossingRequests
108
+ #
109
+ # Receive a generator of IssuingEmbossingRequests objects previously created in the Stark Infra API
110
+ #
111
+ # ## Parameters (optional):
112
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
113
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
114
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
115
+ # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ["created", "processing", "success", "failed"]
116
+ # - card_ids [list of string, default nil]: list of card_ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
117
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
118
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ["tony", "stark"]
119
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
120
+ #
121
+ # ## Return:
122
+ # - generator of IssuingEmbossingRequests objects with updated attributes
123
+ def self.query(
124
+ limit: nil, after: nil, before: nil, status: nil, card_ids: nil, ids: nil,
125
+ tags: nil, user: nil
126
+ )
127
+ after = StarkInfra::Utils::Checks.check_date(after)
128
+ before = StarkInfra::Utils::Checks.check_date(before)
129
+ StarkInfra::Utils::Rest.get_stream(
130
+ limit: limit,
131
+ after: after,
132
+ before: before,
133
+ status: status,
134
+ card_ids: card_ids,
135
+ ids: ids,
136
+ tags: tags,
137
+ user: user,
138
+ **resource
139
+ )
140
+ end
141
+
142
+ # # Retrieve paged IssuingEmbossingRequests
143
+ #
144
+ # Receive a list of up to 100 IssuingEmbossingRequest objects previously created in the Stark Infra API and the cursor to the next page.
145
+ # Use this function instead of query if you want to manually page your requests.
146
+ #
147
+ # ## Parameters (optional):
148
+ # - cursor [string, default nil]: cursor returned on the previous page function call.
149
+ # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
150
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
151
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
152
+ # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ["created", "processing", "success", "failed"]
153
+ # - card_ids [list of string, default nil]: list of card_ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
154
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
155
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ["tony", "stark"]
156
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
157
+ #
158
+ # ## Return:
159
+ # - list of IssuingEmbossingRequests objects with updated attributes
160
+ # - cursor to retrieve the next page of IssuingEmbossingRequests objects
161
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, card_ids: nil, ids: nil, tags: nil, user: nil)
162
+ after = StarkInfra::Utils::Checks.check_date(after)
163
+ before = StarkInfra::Utils::Checks.check_date(before)
164
+ StarkInfra::Utils::Rest.get_page(
165
+ cursor: cursor,
166
+ limit: limit,
167
+ after: after,
168
+ before: before,
169
+ status: status,
170
+ card_ids: card_ids,
171
+ ids: ids,
172
+ tags: tags,
173
+ user: user,
174
+ **resource
175
+ )
176
+ end
177
+
178
+ def self.resource
179
+ {
180
+ resource_name: 'IssuingEmbossingRequest',
181
+ resource_maker: proc { |json|
182
+ IssuingEmbossingRequest.new(
183
+ card_id: json['card_id'],
184
+ kit_id: json['kit_id'],
185
+ display_name_1: json['display_name_1'],
186
+ shipping_city: json['shipping_city'],
187
+ shipping_country_code: json['shipping_country_code'],
188
+ shipping_district: json['shipping_district'],
189
+ shipping_state_code: json['shipping_state_code'],
190
+ shipping_street_line_1: json['shipping_street_line_1'],
191
+ shipping_street_line_2: json['shipping_street_line_2'],
192
+ shipping_service: json['shipping_service'],
193
+ shipping_tracking_number: json['shipping_tracking_number'],
194
+ shipping_zip_code: json['shipping_zip_code'],
195
+ embosser_id: json['embosser_id'],
196
+ display_name_2: json['display_name_2'],
197
+ display_name_3: json['display_name_3'],
198
+ shipping_phone: json['shipping_phone'],
199
+ tags: json['tags'],
200
+ id: json['id'],
201
+ fee: json['fee'],
202
+ status: json['status'],
203
+ updated: json['updated'],
204
+ created: json['created']
205
+ )
206
+ }
207
+ }
208
+ end
209
+ end
210
+ end