starkinfra 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/brcodepreview/brcodepreview.rb +2 -5
 - data/lib/cardmethod/cardmethod.rb +2 -2
 - data/lib/creditholmes/creditholmes.rb +8 -11
 - data/lib/creditnote/creditnote.rb +10 -11
 - data/lib/creditnote/invoice/description.rb +3 -5
 - data/lib/creditnote/invoice/discount.rb +3 -4
 - data/lib/creditnote/invoice/invoice.rb +5 -6
 - data/lib/creditnote/log.rb +8 -9
 - data/lib/creditnote/transfer.rb +4 -5
 - data/lib/creditpreview/creditnotepreview.rb +2 -3
 - data/lib/creditpreview/creditpreview.rb +3 -4
 - data/lib/creditsigner/creditsigner.rb +3 -6
 - data/lib/dynamicbrcode/dynamicbrcode.rb +17 -19
 - data/lib/error.rb +7 -40
 - data/lib/event/attempt.rb +7 -8
 - data/lib/event/event.rb +8 -11
 - data/lib/individualdocument/individualdocument.rb +7 -8
 - data/lib/individualdocument/log.rb +8 -9
 - data/lib/individualidentity/individualidentity.rb +7 -8
 - data/lib/individualidentity/log.rb +8 -9
 - data/lib/issuingbalance/issuingbalance.rb +2 -3
 - data/lib/issuingcard/issuingcard.rb +9 -10
 - data/lib/issuingcard/log.rb +8 -9
 - data/lib/issuingdesign/issuingdesign.rb +5 -6
 - data/lib/issuingembossingkit/issuingembossingkit.rb +4 -5
 - data/lib/issuingembossingrequest/issuingembossingrequest.rb +8 -9
 - data/lib/issuingembossingrequest/log.rb +8 -9
 - data/lib/issuingholder/issuingholder.rb +9 -10
 - data/lib/issuingholder/log.rb +8 -9
 - data/lib/issuinginvoice/issuinginvoice.rb +8 -9
 - data/lib/issuinginvoice/log.rb +8 -9
 - data/lib/issuingproduct/issuingproduct.rb +3 -4
 - data/lib/issuingpurchase/issuingpurchase.rb +32 -24
 - data/lib/issuingpurchase/log.rb +8 -9
 - data/lib/issuingrestock/issuingrestock.rb +8 -9
 - data/lib/issuingrestock/log.rb +8 -9
 - data/lib/issuingrule/issuingrule.rb +6 -7
 - data/lib/issuingstock/issuingstock.rb +8 -9
 - data/lib/issuingstock/log.rb +8 -9
 - data/lib/issuingtransaction/issuingtransaction.rb +7 -8
 - data/lib/issuingwithdrawal/issuingwithdrawal.rb +8 -9
 - data/lib/merchantcategory/merchantcategory.rb +2 -2
 - data/lib/merchantcountry/merchantcountry.rb +2 -2
 - data/lib/pixbalance/pixbalance.rb +2 -3
 - data/lib/pixchargeback/log.rb +8 -9
 - data/lib/pixchargeback/pixchargeback.rb +8 -9
 - data/lib/pixclaim/log.rb +8 -9
 - data/lib/pixclaim/pixclaim.rb +8 -9
 - data/lib/pixdirector/pixdirector.rb +2 -2
 - data/lib/pixdomain/certificate.rb +2 -2
 - data/lib/pixdomain/pixdomain.rb +3 -3
 - data/lib/pixinfraction/log.rb +8 -9
 - data/lib/pixinfraction/pixinfraction.rb +8 -9
 - data/lib/pixkey/log.rb +8 -9
 - data/lib/pixkey/pixkey.rb +8 -9
 - data/lib/pixrequest/log.rb +8 -9
 - data/lib/pixrequest/pixrequest.rb +9 -10
 - data/lib/pixreversal/log.rb +7 -9
 - data/lib/pixreversal/pixreversal.rb +9 -10
 - data/lib/pixstatement/pixstatement.rb +6 -7
 - data/lib/request/request.rb +152 -0
 - data/lib/starkinfra.rb +14 -6
 - data/lib/staticbrcode/staticbrcode.rb +8 -9
 - data/lib/utils/parse.rb +23 -42
 - data/lib/utils/rest.rb +211 -110
 - data/lib/webhook/webhook.rb +2 -3
 - metadata +6 -21
 - data/lib/key.rb +0 -33
 - data/lib/user/organization.rb +0 -54
 - data/lib/user/project.rb +0 -37
 - data/lib/user/user.rb +0 -20
 - data/lib/utils/api.rb +0 -89
 - data/lib/utils/bacenid.rb +0 -19
 - data/lib/utils/cache.rb +0 -10
 - data/lib/utils/case.rb +0 -21
 - data/lib/utils/checks.rb +0 -100
 - data/lib/utils/endtoendid.rb +0 -11
 - data/lib/utils/environment.rb +0 -14
 - data/lib/utils/request.rb +0 -79
 - data/lib/utils/resource.rb +0 -13
 - data/lib/utils/returnid.rb +0 -11
 - data/lib/utils/sub_resource.rb +0 -27
 - data/lib/utils/url.rb +0 -28
 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # IssuingStock object
         
     | 
| 
         @@ -16,7 +15,7 @@ module StarkInfra 
     | 
|
| 
       16 
15 
     | 
    
         
             
              # - embosser_id [string]: Embosser unique id. ex: "5656565656565656"
         
     | 
| 
       17 
16 
     | 
    
         
             
              # - updated [DateTime]: latest update datetime for the IssuingStock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       18 
17 
     | 
    
         
             
              # - created [DateTime]: creation datetime for the IssuingStock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       19 
     | 
    
         
            -
              class IssuingStock <  
     | 
| 
      
 18 
     | 
    
         
            +
              class IssuingStock < StarkCore::Utils::Resource
         
     | 
| 
       20 
19 
     | 
    
         
             
                attr_reader :id, :balance, :design_id, :embosser_id, :updated, :created
         
     | 
| 
       21 
20 
     | 
    
         
             
                def initialize(
         
     | 
| 
       22 
21 
     | 
    
         
             
                  id: nil, balance: nil, design_id: nil, embosser_id: nil, updated: nil, created: nil 
         
     | 
| 
         @@ -25,8 +24,8 @@ module StarkInfra 
     | 
|
| 
       25 
24 
     | 
    
         
             
                  @balance = balance
         
     | 
| 
       26 
25 
     | 
    
         
             
                  @design_id = design_id
         
     | 
| 
       27 
26 
     | 
    
         
             
                  @embosser_id = embosser_id
         
     | 
| 
       28 
     | 
    
         
            -
                  @updated =  
     | 
| 
       29 
     | 
    
         
            -
                  @created =  
     | 
| 
      
 27 
     | 
    
         
            +
                  @updated = StarkCore::Utils::Checks.check_datetime(updated)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       30 
29 
     | 
    
         
             
                end
         
     | 
| 
       31 
30 
     | 
    
         | 
| 
       32 
31 
     | 
    
         
             
                # # Retrieve a specific IssuingStock
         
     | 
| 
         @@ -65,8 +64,8 @@ module StarkInfra 
     | 
|
| 
       65 
64 
     | 
    
         
             
                def self.query(
         
     | 
| 
       66 
65 
     | 
    
         
             
                  limit: nil, after: nil, before: nil, design_ids: nil, embosser_ids: nil, ids: nil, expand: nil, user: nil
         
     | 
| 
       67 
66 
     | 
    
         
             
                )
         
     | 
| 
       68 
     | 
    
         
            -
                  after =  
     | 
| 
       69 
     | 
    
         
            -
                  before =  
     | 
| 
      
 67 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       70 
69 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       71 
70 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
       72 
71 
     | 
    
         
             
                    after: after,
         
     | 
| 
         @@ -103,8 +102,8 @@ module StarkInfra 
     | 
|
| 
       103 
102 
     | 
    
         
             
                  cursor: nil, limit: nil, after: nil, before: nil, design_ids: nil, embosser_ids: nil, 
         
     | 
| 
       104 
103 
     | 
    
         
             
                  ids: nil, expand: nil, user: nil
         
     | 
| 
       105 
104 
     | 
    
         
             
                )
         
     | 
| 
       106 
     | 
    
         
            -
                  after =  
     | 
| 
       107 
     | 
    
         
            -
                  before =  
     | 
| 
      
 105 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       108 
107 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       109 
108 
     | 
    
         
             
                    cursor: cursor,
         
     | 
| 
       110 
109 
     | 
    
         
             
                    limit: limit,
         
     | 
    
        data/lib/issuingstock/log.rb
    CHANGED
    
    | 
         @@ -1,9 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('IssuingStock')
         
     | 
| 
       4 
5 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       9 
8 
     | 
    
         
             
              class IssuingStock
         
     | 
| 
         @@ -18,14 +17,14 @@ module StarkInfra 
     | 
|
| 
       18 
17 
     | 
    
         
             
                # - type [string]: type of the IssuingStock event which triggered the log creation. ex: "created", "spent", "restocked", "lost"
         
     | 
| 
       19 
18 
     | 
    
         
             
                # - count [integer]: shift in stock balance. ex: 10
         
     | 
| 
       20 
19 
     | 
    
         
             
                # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       21 
     | 
    
         
            -
                class Log <  
     | 
| 
      
 20 
     | 
    
         
            +
                class Log < StarkCore::Utils::Resource
         
     | 
| 
       22 
21 
     | 
    
         
             
                  attr_reader :id, :stock, :type, :count, :created
         
     | 
| 
       23 
22 
     | 
    
         
             
                  def initialize(id: nil, stock: nil, type: nil, count: nil, created: nil)
         
     | 
| 
       24 
23 
     | 
    
         
             
                    super(id)
         
     | 
| 
       25 
24 
     | 
    
         
             
                    @stock = stock
         
     | 
| 
       26 
25 
     | 
    
         
             
                    @type = type
         
     | 
| 
       27 
26 
     | 
    
         
             
                    @count = count
         
     | 
| 
       28 
     | 
    
         
            -
                    @created =  
     | 
| 
      
 27 
     | 
    
         
            +
                    @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       29 
28 
     | 
    
         
             
                  end
         
     | 
| 
       30 
29 
     | 
    
         | 
| 
       31 
30 
     | 
    
         
             
                  # # Retrieve a specific IssuingStock::Log
         
     | 
| 
         @@ -60,8 +59,8 @@ module StarkInfra 
     | 
|
| 
       60 
59 
     | 
    
         
             
                  # ## Return:
         
     | 
| 
       61 
60 
     | 
    
         
             
                  # - generator of IssuingStock::Log objects with updated attributes
         
     | 
| 
       62 
61 
     | 
    
         
             
                  def self.query(limit: nil, after: nil, before: nil, types: nil, stock_ids: nil, ids: nil, user: nil)
         
     | 
| 
       63 
     | 
    
         
            -
                    after =  
     | 
| 
       64 
     | 
    
         
            -
                    before =  
     | 
| 
      
 62 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       65 
64 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       66 
65 
     | 
    
         
             
                      limit: limit,
         
     | 
| 
       67 
66 
     | 
    
         
             
                      after: after,
         
     | 
| 
         @@ -95,8 +94,8 @@ module StarkInfra 
     | 
|
| 
       95 
94 
     | 
    
         
             
                  def self.page(
         
     | 
| 
       96 
95 
     | 
    
         
             
                    cursor: nil, limit: nil, after: nil, before: nil, types: nil, stock_ids: nil, ids: nil, user: nil
         
     | 
| 
       97 
96 
     | 
    
         
             
                  )
         
     | 
| 
       98 
     | 
    
         
            -
                    after =  
     | 
| 
       99 
     | 
    
         
            -
                    before =  
     | 
| 
      
 97 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       100 
99 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       101 
100 
     | 
    
         
             
                      cursor: cursor,
         
     | 
| 
       102 
101 
     | 
    
         
             
                      limit: limit,
         
     | 
| 
         @@ -117,7 +116,7 @@ module StarkInfra 
     | 
|
| 
       117 
116 
     | 
    
         
             
                      resource_maker: proc { |json|
         
     | 
| 
       118 
117 
     | 
    
         
             
                        Log.new(
         
     | 
| 
       119 
118 
     | 
    
         
             
                          id: json['id'],
         
     | 
| 
       120 
     | 
    
         
            -
                          stock:  
     | 
| 
      
 119 
     | 
    
         
            +
                          stock: StarkCore::Utils::API.from_api_json(request_maker, json['stock']),
         
     | 
| 
       121 
120 
     | 
    
         
             
                          type: json['type'],
         
     | 
| 
       122 
121 
     | 
    
         
             
                          count: json['count'],
         
     | 
| 
       123 
122 
     | 
    
         
             
                          created: json['created']
         
     | 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # IssuingTransaction object
         
     | 
| 
         @@ -17,7 +16,7 @@ module StarkInfra 
     | 
|
| 
       17 
16 
     | 
    
         
             
              # - source [string]: source of the transaction. ex: 'issuing-purchase/5656565656565656'
         
     | 
| 
       18 
17 
     | 
    
         
             
              # - tags [string]: list of strings inherited from the source resource. ex: ['tony', 'stark']
         
     | 
| 
       19 
18 
     | 
    
         
             
              # - created [DateTime]: creation datetime for the IssuingTransaction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       20 
     | 
    
         
            -
              class IssuingTransaction <  
     | 
| 
      
 19 
     | 
    
         
            +
              class IssuingTransaction < StarkCore::Utils::Resource
         
     | 
| 
       21 
20 
     | 
    
         
             
                attr_reader :id, :amount, :balance, :description, :source, :tags, :created
         
     | 
| 
       22 
21 
     | 
    
         | 
| 
       23 
22 
     | 
    
         
             
                def initialize(id: nil, amount: nil, balance: nil, description: nil, source: nil, tags: nil, created: nil)
         
     | 
| 
         @@ -27,7 +26,7 @@ module StarkInfra 
     | 
|
| 
       27 
26 
     | 
    
         
             
                  @description = description
         
     | 
| 
       28 
27 
     | 
    
         
             
                  @source = source
         
     | 
| 
       29 
28 
     | 
    
         
             
                  @tags = tags
         
     | 
| 
       30 
     | 
    
         
            -
                  @created =  
     | 
| 
      
 29 
     | 
    
         
            +
                  @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       31 
30 
     | 
    
         
             
                end
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
32 
     | 
    
         
             
                # # Retrieve a specific IssuingTransaction
         
     | 
| 
         @@ -63,8 +62,8 @@ module StarkInfra 
     | 
|
| 
       63 
62 
     | 
    
         
             
                # ## Return:
         
     | 
| 
       64 
63 
     | 
    
         
             
                # - generator of IssuingTransaction objects with updated attributes
         
     | 
| 
       65 
64 
     | 
    
         
             
                def self.query(tags: nil, external_ids: nil, after: nil, before: nil, status: nil, ids: nil, limit: nil, user: nil)
         
     | 
| 
       66 
     | 
    
         
            -
                  after =  
     | 
| 
       67 
     | 
    
         
            -
                  before =  
     | 
| 
      
 65 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       68 
67 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       69 
68 
     | 
    
         
             
                    tags: tags,
         
     | 
| 
       70 
69 
     | 
    
         
             
                    external_ids: external_ids,
         
     | 
| 
         @@ -99,8 +98,8 @@ module StarkInfra 
     | 
|
| 
       99 
98 
     | 
    
         
             
                # - cursor to retrieve the next page of IssuingTransactions objects
         
     | 
| 
       100 
99 
     | 
    
         
             
                def self.page(cursor: nil, tags: nil, external_ids: nil, after: nil, before: nil, status: nil, ids: nil, limit: nil,
         
     | 
| 
       101 
100 
     | 
    
         
             
                              user: nil)
         
     | 
| 
       102 
     | 
    
         
            -
                  after =  
     | 
| 
       103 
     | 
    
         
            -
                  before =  
     | 
| 
      
 101 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 102 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       104 
103 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       105 
104 
     | 
    
         
             
                    cursor: cursor,
         
     | 
| 
       106 
105 
     | 
    
         
             
                    tags: tags,
         
     | 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # IssuingWithdrawal object
         
     | 
| 
         @@ -23,7 +22,7 @@ module StarkInfra 
     | 
|
| 
       23 
22 
     | 
    
         
             
              # - issuing_transaction_id [string]: issuing ledger transaction ids linked to this IssuingWithdrawal
         
     | 
| 
       24 
23 
     | 
    
         
             
              # - updated [DateTime]: latest update datetime for the IssuingWithdrawal. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       25 
24 
     | 
    
         
             
              # - created [DateTime]: creation datetime for the IssuingWithdrawal. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       26 
     | 
    
         
            -
              class IssuingWithdrawal <  
     | 
| 
      
 25 
     | 
    
         
            +
              class IssuingWithdrawal < StarkCore::Utils::Resource
         
     | 
| 
       27 
26 
     | 
    
         
             
                attr_reader :amount, :external_id, :description, :tags, :id, :transaction_id, :issuing_transaction_id, :updated, :created
         
     | 
| 
       28 
27 
     | 
    
         
             
                def initialize(
         
     | 
| 
       29 
28 
     | 
    
         
             
                  amount:, external_id:, description:, tags: nil, id: nil, transaction_id: nil, issuing_transaction_id: nil,
         
     | 
| 
         @@ -36,8 +35,8 @@ module StarkInfra 
     | 
|
| 
       36 
35 
     | 
    
         
             
                  @tags = tags
         
     | 
| 
       37 
36 
     | 
    
         
             
                  @transaction_id = transaction_id
         
     | 
| 
       38 
37 
     | 
    
         
             
                  @issuing_transaction_id = issuing_transaction_id
         
     | 
| 
       39 
     | 
    
         
            -
                  @updated =  
     | 
| 
       40 
     | 
    
         
            -
                  @created =  
     | 
| 
      
 38 
     | 
    
         
            +
                  @updated = StarkCore::Utils::Checks.check_datetime(updated)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       41 
40 
     | 
    
         
             
                end
         
     | 
| 
       42 
41 
     | 
    
         | 
| 
       43 
42 
     | 
    
         
             
                # # Create an IssuingWithdrawal
         
     | 
| 
         @@ -87,8 +86,8 @@ module StarkInfra 
     | 
|
| 
       87 
86 
     | 
    
         
             
                # ## Return:
         
     | 
| 
       88 
87 
     | 
    
         
             
                # - generator of IssuingWithdrawal objects with updated attributes
         
     | 
| 
       89 
88 
     | 
    
         
             
                def self.query(limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil)
         
     | 
| 
       90 
     | 
    
         
            -
                  after =  
     | 
| 
       91 
     | 
    
         
            -
                  before =  
     | 
| 
      
 89 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       92 
91 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       93 
92 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
       94 
93 
     | 
    
         
             
                    external_ids: external_ids,
         
     | 
| 
         @@ -118,8 +117,8 @@ module StarkInfra 
     | 
|
| 
       118 
117 
     | 
    
         
             
                # - list of IssuingWithdrawal objects with updated attributes
         
     | 
| 
       119 
118 
     | 
    
         
             
                # - cursor to retrieve the next page of IssuingWithdrawal objects
         
     | 
| 
       120 
119 
     | 
    
         
             
                def self.page(cursor: nil, limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil)
         
     | 
| 
       121 
     | 
    
         
            -
                  after =  
     | 
| 
       122 
     | 
    
         
            -
                  before =  
     | 
| 
      
 120 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 121 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       123 
122 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       124 
123 
     | 
    
         
             
                    cursor: cursor,
         
     | 
| 
       125 
124 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/sub_resource')
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       7 
7 
     | 
    
         
             
              # # MerchantCategory object
         
     | 
| 
         @@ -19,7 +19,7 @@ module StarkInfra 
     | 
|
| 
       19 
19 
     | 
    
         
             
              # Attributes (return-only):
         
     | 
| 
       20 
20 
     | 
    
         
             
              # - name [string]: category's name. ex: 'Veterinary services', 'Fast food restaurants'
         
     | 
| 
       21 
21 
     | 
    
         
             
              # - number [string]: category's number. ex: '742', '5814'
         
     | 
| 
       22 
     | 
    
         
            -
              class MerchantCategory <  
     | 
| 
      
 22 
     | 
    
         
            +
              class MerchantCategory < StarkCore::Utils::SubResource
         
     | 
| 
       23 
23 
     | 
    
         
             
                attr_reader :code, :type, :name, :number
         
     | 
| 
       24 
24 
     | 
    
         
             
                def initialize(code:, type:, name: nil, number: nil)
         
     | 
| 
       25 
25 
     | 
    
         
             
                  @code = code
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/sub_resource')
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       7 
7 
     | 
    
         
             
              # # MerchantCountry object
         
     | 
| 
         @@ -15,7 +15,7 @@ module StarkInfra 
     | 
|
| 
       15 
15 
     | 
    
         
             
              # - name [string]: country's name. ex: 'Brazil'
         
     | 
| 
       16 
16 
     | 
    
         
             
              # - number [string]: country's number. ex: '076'
         
     | 
| 
       17 
17 
     | 
    
         
             
              # - short_code [string]: country's short code. ex: 'BR'
         
     | 
| 
       18 
     | 
    
         
            -
              class MerchantCountry <  
     | 
| 
      
 18 
     | 
    
         
            +
              class MerchantCountry < StarkCore::Utils::SubResource
         
     | 
| 
       19 
19 
     | 
    
         
             
                attr_reader :code, :short_code, :name, :number
         
     | 
| 
       20 
20 
     | 
    
         
             
                def initialize(code:, name: nil, number: nil, short_code: nil)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  @code = code
         
     | 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # PixBalance object
         
     | 
| 
         @@ -17,7 +16,7 @@ module StarkInfra 
     | 
|
| 
       17 
16 
     | 
    
         
             
              # - amount [integer]: current balance amount of the workspace in cents. ex: 200 (= R$ 2.00)
         
     | 
| 
       18 
17 
     | 
    
         
             
              # - currency [string]: currency of the current workspace. Expect others to be added eventually. ex: 'BRL'
         
     | 
| 
       19 
18 
     | 
    
         
             
              # - updated [DateTime]: latest update datetime for the balance. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       20 
     | 
    
         
            -
              class PixBalance <  
     | 
| 
      
 19 
     | 
    
         
            +
              class PixBalance < StarkCore::Utils::Resource
         
     | 
| 
       21 
20 
     | 
    
         
             
                attr_reader :id, :amount, :currency, :updated
         
     | 
| 
       22 
21 
     | 
    
         
             
                def initialize(id: nil, amount: nil, currency: nil, updated: nil)
         
     | 
| 
       23 
22 
     | 
    
         
             
                  super(id)
         
     | 
    
        data/lib/pixchargeback/log.rb
    CHANGED
    
    | 
         @@ -1,9 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('pixchargeback')
         
     | 
| 
       4 
5 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       9 
8 
     | 
    
         
             
              class PixChargeback
         
     | 
| 
         @@ -19,11 +18,11 @@ module StarkInfra 
     | 
|
| 
       19 
18 
     | 
    
         
             
                # - type [string]: type of the PixChargeback event which triggered the log creation. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
         
     | 
| 
       20 
19 
     | 
    
         
             
                # - errors [list of strings]: list of errors linked to this PixChargeback event.
         
     | 
| 
       21 
20 
     | 
    
         
             
                # - chargeback [PixChargeback]: PixChargeback entity to which the log refers to.
         
     | 
| 
       22 
     | 
    
         
            -
                class Log <  
     | 
| 
      
 21 
     | 
    
         
            +
                class Log < StarkCore::Utils::Resource
         
     | 
| 
       23 
22 
     | 
    
         
             
                  attr_reader :id, :created, :type, :errors, :chargeback
         
     | 
| 
       24 
23 
     | 
    
         
             
                  def initialize(id:, created:, type:, errors:, chargeback:)
         
     | 
| 
       25 
24 
     | 
    
         
             
                    super(id)
         
     | 
| 
       26 
     | 
    
         
            -
                    @created =  
     | 
| 
      
 25 
     | 
    
         
            +
                    @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       27 
26 
     | 
    
         
             
                    @type = type
         
     | 
| 
       28 
27 
     | 
    
         
             
                    @errors = errors
         
     | 
| 
       29 
28 
     | 
    
         
             
                    @chargeback = chargeback
         
     | 
| 
         @@ -61,8 +60,8 @@ module StarkInfra 
     | 
|
| 
       61 
60 
     | 
    
         
             
                  # ## Return:
         
     | 
| 
       62 
61 
     | 
    
         
             
                  # - generator of PixChargeback::Log objects with updated attributes
         
     | 
| 
       63 
62 
     | 
    
         
             
                  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, chargeback_ids: nil, user: nil)
         
     | 
| 
       64 
     | 
    
         
            -
                    after =  
     | 
| 
       65 
     | 
    
         
            -
                    before =  
     | 
| 
      
 63 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       66 
65 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       67 
66 
     | 
    
         
             
                      ids: ids,
         
     | 
| 
       68 
67 
     | 
    
         
             
                      limit: limit,
         
     | 
| 
         @@ -94,8 +93,8 @@ module StarkInfra 
     | 
|
| 
       94 
93 
     | 
    
         
             
                  # - list of PixChargeback::Log objects with updated attributes
         
     | 
| 
       95 
94 
     | 
    
         
             
                  # - cursor to retrieve the next page of Log objects
         
     | 
| 
       96 
95 
     | 
    
         
             
                  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, chargeback_ids: nil, user: nil)
         
     | 
| 
       97 
     | 
    
         
            -
                    after =  
     | 
| 
       98 
     | 
    
         
            -
                    before =  
     | 
| 
      
 96 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 97 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       99 
98 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       100 
99 
     | 
    
         
             
                      cursor: cursor,
         
     | 
| 
       101 
100 
     | 
    
         
             
                      ids: ids,
         
     | 
| 
         @@ -119,7 +118,7 @@ module StarkInfra 
     | 
|
| 
       119 
118 
     | 
    
         
             
                          created: json['created'],
         
     | 
| 
       120 
119 
     | 
    
         
             
                          type: json['type'],
         
     | 
| 
       121 
120 
     | 
    
         
             
                          errors: json['errors'],
         
     | 
| 
       122 
     | 
    
         
            -
                          chargeback:  
     | 
| 
      
 121 
     | 
    
         
            +
                          chargeback: StarkCore::Utils::API.from_api_json(chargeback_maker, json['chargeback'])
         
     | 
| 
       123 
122 
     | 
    
         
             
                        )
         
     | 
| 
       124 
123 
     | 
    
         
             
                      }
         
     | 
| 
       125 
124 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # PixChargeback object
         
     | 
| 
         @@ -36,7 +35,7 @@ module StarkInfra 
     | 
|
| 
       36 
35 
     | 
    
         
             
              # - status [string]: current PixChargeback status. Options: 'created', 'failed', 'delivered', 'closed', 'canceled'.
         
     | 
| 
       37 
36 
     | 
    
         
             
              # - created [DateTime]: creation datetime for the PixChargeback. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       38 
37 
     | 
    
         
             
              # - updated [DateTime]: latest update datetime for the PixChargeback. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       39 
     | 
    
         
            -
              class PixChargeback <  
     | 
| 
      
 38 
     | 
    
         
            +
              class PixChargeback < StarkCore::Utils::Resource
         
     | 
| 
       40 
39 
     | 
    
         
             
                attr_reader :amount, :reference_id, :reason, :description, :tags, :id, :analysis, :sender_bank_code,
         
     | 
| 
       41 
40 
     | 
    
         
             
                            :receiver_bank_code, :rejection_reason, :reversal_reference_id, :result, :flow, :status, :created, :updated
         
     | 
| 
       42 
41 
     | 
    
         
             
                def initialize(
         
     | 
| 
         @@ -58,8 +57,8 @@ module StarkInfra 
     | 
|
| 
       58 
57 
     | 
    
         
             
                  @result = result
         
     | 
| 
       59 
58 
     | 
    
         
             
                  @flow = flow
         
     | 
| 
       60 
59 
     | 
    
         
             
                  @status = status
         
     | 
| 
       61 
     | 
    
         
            -
                  @created =  
     | 
| 
       62 
     | 
    
         
            -
                  @updated =  
     | 
| 
      
 60 
     | 
    
         
            +
                  @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  @updated = StarkCore::Utils::Checks.check_datetime(updated)
         
     | 
| 
       63 
62 
     | 
    
         
             
                end
         
     | 
| 
       64 
63 
     | 
    
         | 
| 
       65 
64 
     | 
    
         
             
                # # Create PixChargebacks
         
     | 
| 
         @@ -111,8 +110,8 @@ module StarkInfra 
     | 
|
| 
       111 
110 
     | 
    
         
             
                # ## Return:
         
     | 
| 
       112 
111 
     | 
    
         
             
                # - generator of PixChargeback objects with updated attributes
         
     | 
| 
       113 
112 
     | 
    
         
             
                def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, user: nil)
         
     | 
| 
       114 
     | 
    
         
            -
                  after =  
     | 
| 
       115 
     | 
    
         
            -
                  before =  
     | 
| 
      
 113 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 114 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       116 
115 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       117 
116 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
       118 
117 
     | 
    
         
             
                    after: after,
         
     | 
| 
         @@ -146,8 +145,8 @@ module StarkInfra 
     | 
|
| 
       146 
145 
     | 
    
         
             
                # - list of PixChargeback objects with updated attributes
         
     | 
| 
       147 
146 
     | 
    
         
             
                # - cursor to retrieve the next page of PixChargeback objects
         
     | 
| 
       148 
147 
     | 
    
         
             
                def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, user: nil)
         
     | 
| 
       149 
     | 
    
         
            -
                  after =  
     | 
| 
       150 
     | 
    
         
            -
                  before =  
     | 
| 
      
 148 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 149 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       151 
150 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       152 
151 
     | 
    
         
             
                    cursor: cursor,
         
     | 
| 
       153 
152 
     | 
    
         
             
                    limit: limit,
         
     | 
    
        data/lib/pixclaim/log.rb
    CHANGED
    
    | 
         @@ -1,9 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('pixclaim')
         
     | 
| 
       4 
5 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       9 
8 
     | 
    
         
             
              class PixClaim
         
     | 
| 
         @@ -20,11 +19,11 @@ module StarkInfra 
     | 
|
| 
       20 
19 
     | 
    
         
             
                # - errors [list of strings]: list of errors linked to this PixClaim event.
         
     | 
| 
       21 
20 
     | 
    
         
             
                # - reason [string]: reason why the PixClaim was modified, resulting in the Log. Options: 'fraud', 'userRequested', 'accountClosure', 'defaultOperation', 'reconciliation'
         
     | 
| 
       22 
21 
     | 
    
         
             
                # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       23 
     | 
    
         
            -
                class Log <  
     | 
| 
      
 22 
     | 
    
         
            +
                class Log < StarkCore::Utils::Resource
         
     | 
| 
       24 
23 
     | 
    
         
             
                  attr_reader :id, :created, :type, :errors, :reason, :claim
         
     | 
| 
       25 
24 
     | 
    
         
             
                  def initialize(id:, created:, type:, errors:, reason:, claim:)
         
     | 
| 
       26 
25 
     | 
    
         
             
                    super(id)
         
     | 
| 
       27 
     | 
    
         
            -
                    @created =  
     | 
| 
      
 26 
     | 
    
         
            +
                    @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       28 
27 
     | 
    
         
             
                    @type = type
         
     | 
| 
       29 
28 
     | 
    
         
             
                    @errors = errors
         
     | 
| 
       30 
29 
     | 
    
         
             
                    @reason = reason
         
     | 
| 
         @@ -63,8 +62,8 @@ module StarkInfra 
     | 
|
| 
       63 
62 
     | 
    
         
             
                  # ## Return:
         
     | 
| 
       64 
63 
     | 
    
         
             
                  # - generator of PixClaim::Log objects with updated attributes
         
     | 
| 
       65 
64 
     | 
    
         
             
                  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, claim_ids: nil, user: nil)
         
     | 
| 
       66 
     | 
    
         
            -
                    after =  
     | 
| 
       67 
     | 
    
         
            -
                    before =  
     | 
| 
      
 65 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 66 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       68 
67 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       69 
68 
     | 
    
         
             
                      ids: ids,
         
     | 
| 
       70 
69 
     | 
    
         
             
                      limit: limit,
         
     | 
| 
         @@ -96,8 +95,8 @@ module StarkInfra 
     | 
|
| 
       96 
95 
     | 
    
         
             
                  # - list of Log objects with updated attributes
         
     | 
| 
       97 
96 
     | 
    
         
             
                  # - cursor to retrieve the next page of Log objects
         
     | 
| 
       98 
97 
     | 
    
         
             
                  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, claim_ids: nil, user: nil)
         
     | 
| 
       99 
     | 
    
         
            -
                    after =  
     | 
| 
       100 
     | 
    
         
            -
                    before =  
     | 
| 
      
 98 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 99 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       101 
100 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       102 
101 
     | 
    
         
             
                      cursor: cursor,
         
     | 
| 
       103 
102 
     | 
    
         
             
                      ids: ids,
         
     | 
| 
         @@ -122,7 +121,7 @@ module StarkInfra 
     | 
|
| 
       122 
121 
     | 
    
         
             
                          type: json['type'],
         
     | 
| 
       123 
122 
     | 
    
         
             
                          errors: json['errors'],
         
     | 
| 
       124 
123 
     | 
    
         
             
                          reason: json['reason'],
         
     | 
| 
       125 
     | 
    
         
            -
                          claim:  
     | 
| 
      
 124 
     | 
    
         
            +
                          claim: StarkCore::Utils::API.from_api_json(claim_maker, json['claim'])
         
     | 
| 
       126 
125 
     | 
    
         
             
                        )
         
     | 
| 
       127 
126 
     | 
    
         
             
                      }
         
     | 
| 
       128 
127 
     | 
    
         
             
                    }
         
     | 
    
        data/lib/pixclaim/pixclaim.rb
    CHANGED
    
    | 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # PixClaim object
         
     | 
| 
         @@ -36,7 +35,7 @@ module StarkInfra 
     | 
|
| 
       36 
35 
     | 
    
         
             
              # - claimed_bank_code [string]: bank_code of the account donating the PixClaim. ex: '20018183'.
         
     | 
| 
       37 
36 
     | 
    
         
             
              # - created [DateTime]: creation datetime for the PixClaim. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       38 
37 
     | 
    
         
             
              # - updated [DateTime]: update datetime for the PixClaim. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       39 
     | 
    
         
            -
              class PixClaim <  
     | 
| 
      
 38 
     | 
    
         
            +
              class PixClaim < StarkCore::Utils::Resource
         
     | 
| 
       40 
39 
     | 
    
         
             
                attr_reader :account_created, :account_number, :account_type, :branch_code, :name, :tax_id, :key_id,
         
     | 
| 
       41 
40 
     | 
    
         
             
                            :tags, :id, :status, :type, :key_type, :flow, :claimer_bank_code, :claimed_bank_code, :created, :updated
         
     | 
| 
       42 
41 
     | 
    
         
             
                def initialize(
         
     | 
| 
         @@ -59,8 +58,8 @@ module StarkInfra 
     | 
|
| 
       59 
58 
     | 
    
         
             
                  @flow = flow
         
     | 
| 
       60 
59 
     | 
    
         
             
                  @claimer_bank_code = claimer_bank_code
         
     | 
| 
       61 
60 
     | 
    
         
             
                  @claimed_bank_code = claimed_bank_code
         
     | 
| 
       62 
     | 
    
         
            -
                  @created =  
     | 
| 
       63 
     | 
    
         
            -
                  @updated =  
     | 
| 
      
 61 
     | 
    
         
            +
                  @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  @updated = StarkCore::Utils::Checks.check_datetime(updated)
         
     | 
| 
       64 
63 
     | 
    
         
             
                end
         
     | 
| 
       65 
64 
     | 
    
         | 
| 
       66 
65 
     | 
    
         
             
                # # Create a PixClaim object
         
     | 
| 
         @@ -119,8 +118,8 @@ module StarkInfra 
     | 
|
| 
       119 
118 
     | 
    
         
             
                  limit: nil, after: nil, before: nil, status: nil, ids: nil,
         
     | 
| 
       120 
119 
     | 
    
         
             
                  type: nil, flow: nil, tags: nil, key_type: nil, key_id: nil, user: nil
         
     | 
| 
       121 
120 
     | 
    
         
             
                )
         
     | 
| 
       122 
     | 
    
         
            -
                  after =  
     | 
| 
       123 
     | 
    
         
            -
                  before =  
     | 
| 
      
 121 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       124 
123 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       125 
124 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
       126 
125 
     | 
    
         
             
                    after: after,
         
     | 
| 
         @@ -163,8 +162,8 @@ module StarkInfra 
     | 
|
| 
       163 
162 
     | 
    
         
             
                  cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil,
         
     | 
| 
       164 
163 
     | 
    
         
             
                  type: nil, flow: nil, tags: nil, key_type: nil, key_id: nil, user: nil
         
     | 
| 
       165 
164 
     | 
    
         
             
                )
         
     | 
| 
       166 
     | 
    
         
            -
                  after =  
     | 
| 
       167 
     | 
    
         
            -
                  before =  
     | 
| 
      
 165 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 166 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       168 
167 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       169 
168 
     | 
    
         
             
                    cursor: cursor,
         
     | 
| 
       170 
169 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       7 
7 
     | 
    
         
             
              # # PixDirector object
         
     | 
| 
         @@ -24,7 +24,7 @@ module StarkInfra 
     | 
|
| 
       24 
24 
     | 
    
         
             
              #
         
     | 
| 
       25 
25 
     | 
    
         
             
              # ## Attributes (return-only):
         
     | 
| 
       26 
26 
     | 
    
         
             
              # - status [string]: current PixDirector status. ex: 'success'
         
     | 
| 
       27 
     | 
    
         
            -
              class PixDirector <  
     | 
| 
      
 27 
     | 
    
         
            +
              class PixDirector < StarkCore::Utils::SubResource
         
     | 
| 
       28 
28 
     | 
    
         
             
                attr_reader :name, :tax_id, :phone, :email, :password, :team_email, :team_phones, :status
         
     | 
| 
       29 
29 
     | 
    
         
             
                def initialize(name:, tax_id:, phone:, email:, password:, team_email:, team_phones:, status: nil)
         
     | 
| 
       30 
30 
     | 
    
         
             
                  @name = name
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       7 
7 
     | 
    
         
             
              # # PixDomain::Certificate object
         
     | 
| 
         @@ -10,7 +10,7 @@ module StarkInfra 
     | 
|
| 
       10 
10 
     | 
    
         
             
              #
         
     | 
| 
       11 
11 
     | 
    
         
             
              # ## Attributes (return-only):
         
     | 
| 
       12 
12 
     | 
    
         
             
              # - content [string]: certificate of the Pix participant in PEM format.
         
     | 
| 
       13 
     | 
    
         
            -
              class Certificate <  
     | 
| 
      
 13 
     | 
    
         
            +
              class Certificate < StarkCore::Utils::SubResource
         
     | 
| 
       14 
14 
     | 
    
         
             
                attr_reader :content
         
     | 
| 
       15 
15 
     | 
    
         
             
                def initialize(content: nil)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  @content = content
         
     | 
    
        data/lib/pixdomain/pixdomain.rb
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('certificate')
         
     | 
| 
       4 
5 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
8 
     | 
    
         
             
              # # PixDomain object
         
     | 
| 
         @@ -14,7 +14,7 @@ module StarkInfra 
     | 
|
| 
       14 
14 
     | 
    
         
             
              # ## Attributes (return-only):
         
     | 
| 
       15 
15 
     | 
    
         
             
              # - certificates [list of PixDomain::Certificate objects]: certificate information of the Pix participant.
         
     | 
| 
       16 
16 
     | 
    
         
             
              # - name [string]: current active domain (URL) of the Pix participant.
         
     | 
| 
       17 
     | 
    
         
            -
              class PixDomain <  
     | 
| 
      
 17 
     | 
    
         
            +
              class PixDomain < StarkCore::Utils::SubResource
         
     | 
| 
       18 
18 
     | 
    
         
             
                attr_reader :certificates, :name
         
     | 
| 
       19 
19 
     | 
    
         
             
                def initialize(certificates: nil, name: nil)
         
     | 
| 
       20 
20 
     | 
    
         
             
                  @certificates = certificates
         
     | 
| 
         @@ -38,7 +38,7 @@ module StarkInfra 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  certificate_maker = StarkInfra::Certificate.resource[:resource_maker]
         
     | 
| 
       39 
39 
     | 
    
         
             
                  parsed_certificates = []
         
     | 
| 
       40 
40 
     | 
    
         
             
                  certificates.each do |certificate|
         
     | 
| 
       41 
     | 
    
         
            -
                    parsed_certificates <<  
     | 
| 
      
 41 
     | 
    
         
            +
                    parsed_certificates << StarkCore::Utils::API.from_api_json(certificate_maker, certificate)
         
     | 
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         
             
                  parsed_certificates
         
     | 
| 
       44 
44 
     | 
    
         
             
                end
         
     | 
    
        data/lib/pixinfraction/log.rb
    CHANGED
    
    | 
         @@ -1,9 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('pixinfraction')
         
     | 
| 
       4 
5 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       6 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       9 
8 
     | 
    
         
             
              class PixInfraction
         
     | 
| 
         @@ -19,14 +18,14 @@ module StarkInfra 
     | 
|
| 
       19 
18 
     | 
    
         
             
                # - type [string]: type of the PixInfraction event which triggered the log creation. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
         
     | 
| 
       20 
19 
     | 
    
         
             
                # - errors [list of strings]: list of errors linked to this PixInfraction event.
         
     | 
| 
       21 
20 
     | 
    
         
             
                # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       22 
     | 
    
         
            -
                class Log <  
     | 
| 
      
 21 
     | 
    
         
            +
                class Log < StarkCore::Utils::Resource
         
     | 
| 
       23 
22 
     | 
    
         
             
                  attr_reader :id, :created, :type, :errors, :infraction
         
     | 
| 
       24 
23 
     | 
    
         
             
                  def initialize(id:, created:, type:, errors:, infraction:)
         
     | 
| 
       25 
24 
     | 
    
         
             
                    super(id)
         
     | 
| 
       26 
25 
     | 
    
         
             
                    @infraction = infraction
         
     | 
| 
       27 
26 
     | 
    
         
             
                    @type = type
         
     | 
| 
       28 
27 
     | 
    
         
             
                    @errors = errors
         
     | 
| 
       29 
     | 
    
         
            -
                    @created =  
     | 
| 
      
 28 
     | 
    
         
            +
                    @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
       30 
29 
     | 
    
         
             
                  end
         
     | 
| 
       31 
30 
     | 
    
         | 
| 
       32 
31 
     | 
    
         
             
                  # # Retrieve a specific PixInfraction::Log
         
     | 
| 
         @@ -61,8 +60,8 @@ module StarkInfra 
     | 
|
| 
       61 
60 
     | 
    
         
             
                  # ## Return:
         
     | 
| 
       62 
61 
     | 
    
         
             
                  # - list of PixInfraction::Log objects with updated attributes
         
     | 
| 
       63 
62 
     | 
    
         
             
                  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, infraction_ids: nil, user: nil)
         
     | 
| 
       64 
     | 
    
         
            -
                    after =  
     | 
| 
       65 
     | 
    
         
            -
                    before =  
     | 
| 
      
 63 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       66 
65 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       67 
66 
     | 
    
         
             
                      ids: ids,
         
     | 
| 
       68 
67 
     | 
    
         
             
                      limit: limit,
         
     | 
| 
         @@ -94,8 +93,8 @@ module StarkInfra 
     | 
|
| 
       94 
93 
     | 
    
         
             
                  # - list of PixInfraction::Log objects with updated attributes
         
     | 
| 
       95 
94 
     | 
    
         
             
                  # - Cursor to retrieve the next page of Log objects
         
     | 
| 
       96 
95 
     | 
    
         
             
                  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, infraction_ids: nil, user: nil)
         
     | 
| 
       97 
     | 
    
         
            -
                    after =  
     | 
| 
       98 
     | 
    
         
            -
                    before =  
     | 
| 
      
 96 
     | 
    
         
            +
                    after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 97 
     | 
    
         
            +
                    before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       99 
98 
     | 
    
         
             
                    StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       100 
99 
     | 
    
         
             
                      cursor: cursor,
         
     | 
| 
       101 
100 
     | 
    
         
             
                      ids: ids,
         
     | 
| 
         @@ -116,7 +115,7 @@ module StarkInfra 
     | 
|
| 
       116 
115 
     | 
    
         
             
                      resource_maker: proc { |json|
         
     | 
| 
       117 
116 
     | 
    
         
             
                        Log.new(
         
     | 
| 
       118 
117 
     | 
    
         
             
                          id: json['id'],
         
     | 
| 
       119 
     | 
    
         
            -
                          infraction:  
     | 
| 
      
 118 
     | 
    
         
            +
                          infraction: StarkCore::Utils::API.from_api_json(infraction_maker, json['infraction']),
         
     | 
| 
       120 
119 
     | 
    
         
             
                          type: json['type'],
         
     | 
| 
       121 
120 
     | 
    
         
             
                          errors: json['errors'],
         
     | 
| 
       122 
121 
     | 
    
         
             
                          created: json['created'],
         
     | 
| 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require('starkcore')
         
     | 
| 
       3 
4 
     | 
    
         
             
            require_relative('../utils/rest')
         
     | 
| 
       4 
     | 
    
         
            -
            require_relative('../utils/checks')
         
     | 
| 
       5 
     | 
    
         
            -
            require_relative('../utils/resource')
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
            module StarkInfra
         
     | 
| 
       8 
7 
     | 
    
         
             
              # # PixInfraction object
         
     | 
| 
         @@ -32,7 +31,7 @@ module StarkInfra 
     | 
|
| 
       32 
31 
     | 
    
         
             
              # - status [string]: current PixInfraction status. Options: 'created', 'failed', 'delivered', 'closed', 'canceled'.
         
     | 
| 
       33 
32 
     | 
    
         
             
              # - created [DateTime]: creation datetime for the PixInfraction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       34 
33 
     | 
    
         
             
              # - updated [DateTime]: latest update datetime for the PixInfraction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
         
     | 
| 
       35 
     | 
    
         
            -
              class PixInfraction <  
     | 
| 
      
 34 
     | 
    
         
            +
              class PixInfraction < StarkCore::Utils::Resource
         
     | 
| 
       36 
35 
     | 
    
         
             
                attr_reader :reference_id, :type, :description, :tags, :id, :credited_bank_code, :flow, :analysis,
         
     | 
| 
       37 
36 
     | 
    
         
             
                            :debited_bank_code, :reported_by, :result, :status, :created, :updated
         
     | 
| 
       38 
37 
     | 
    
         
             
                def initialize(
         
     | 
| 
         @@ -51,8 +50,8 @@ module StarkInfra 
     | 
|
| 
       51 
50 
     | 
    
         
             
                  @reported_by = reported_by
         
     | 
| 
       52 
51 
     | 
    
         
             
                  @result = result
         
     | 
| 
       53 
52 
     | 
    
         
             
                  @status = status
         
     | 
| 
       54 
     | 
    
         
            -
                  @created =  
     | 
| 
       55 
     | 
    
         
            -
                  @updated =  
     | 
| 
      
 53 
     | 
    
         
            +
                  @created = StarkCore::Utils::Checks.check_datetime(created)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  @updated = StarkCore::Utils::Checks.check_datetime(updated)
         
     | 
| 
       56 
55 
     | 
    
         
             
                end
         
     | 
| 
       57 
56 
     | 
    
         | 
| 
       58 
57 
     | 
    
         
             
                # # Create PixInfractions
         
     | 
| 
         @@ -105,8 +104,8 @@ module StarkInfra 
     | 
|
| 
       105 
104 
     | 
    
         
             
                # ## Return:
         
     | 
| 
       106 
105 
     | 
    
         
             
                # - generator of PixInfraction objects with updated attributes
         
     | 
| 
       107 
106 
     | 
    
         
             
                def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, type: nil, flow: nil, tags: nil, user: nil)
         
     | 
| 
       108 
     | 
    
         
            -
                  after =  
     | 
| 
       109 
     | 
    
         
            -
                  before =  
     | 
| 
      
 107 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       110 
109 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_stream(
         
     | 
| 
       111 
110 
     | 
    
         
             
                    limit: limit,
         
     | 
| 
       112 
111 
     | 
    
         
             
                    after: after,
         
     | 
| 
         @@ -142,8 +141,8 @@ module StarkInfra 
     | 
|
| 
       142 
141 
     | 
    
         
             
                # - list of PixInfraction objects with updated attributes
         
     | 
| 
       143 
142 
     | 
    
         
             
                # - cursor to retrieve the next page of PixInfraction objects
         
     | 
| 
       144 
143 
     | 
    
         
             
                def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, type: nil, user: nil)
         
     | 
| 
       145 
     | 
    
         
            -
                  after =  
     | 
| 
       146 
     | 
    
         
            -
                  before =  
     | 
| 
      
 144 
     | 
    
         
            +
                  after = StarkCore::Utils::Checks.check_date(after)
         
     | 
| 
      
 145 
     | 
    
         
            +
                  before = StarkCore::Utils::Checks.check_date(before)
         
     | 
| 
       147 
146 
     | 
    
         
             
                  StarkInfra::Utils::Rest.get_page(
         
     | 
| 
       148 
147 
     | 
    
         
             
                    cursor: cursor,
         
     | 
| 
       149 
148 
     | 
    
         
             
                    limit: limit,
         
     |