stellar_base-rails 0.9.4 → 0.9.5
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/app/concepts/stellar_base/withdrawal_requests/operations/create.rb +6 -0
- data/app/controllers/stellar_base/withdraw_controller.rb +1 -1
- data/app/services/stellar_base/account_subscriptions/get_operations.rb +4 -3
- data/app/services/stellar_base/deposit_requests/send_asset.rb +2 -3
- data/db/migrate/20181013072141_ensure_deposits_tx_id_uniqueness.rb +10 -0
- data/lib/stellar_base/version.rb +1 -1
- metadata +4 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7d46d85f2dc7b2aae1b07e4a4a8e14438492daed928984280164d555e14dd867
         | 
| 4 | 
            +
              data.tar.gz: 75f22ebee9475714b891fa8bfc3c76bfe224d5236b81ac82a0be403117f4d8b3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 00af460fe3e90e786c68e8854b877eb8b74ded926238f00feccbde764c8c8cd05ec26083b079e922227342cddfd6f8f6ea32f866a989567292cd1b110fcf75a8
         | 
| 7 | 
            +
              data.tar.gz: 63701fb3cbb3bc43c7c92f4b20d6efda1c0cc6b13fcaa8173fadeaecca0105273de7745776ab55e8d7dac4aa49a0ede6b71d40373e56feee2b7c212aa4524a28
         | 
| @@ -4,8 +4,10 @@ module StellarBase | |
| 4 4 | 
             
                  class Create < ApplicationOperation
         | 
| 5 5 |  | 
| 6 6 | 
             
                    DEFAULT_ETA = (10 * 60).freeze
         | 
| 7 | 
            +
                    POLICY_ERROR_MESSAGE = "You are unauthorized to request withdrawal details"
         | 
| 7 8 |  | 
| 8 9 | 
             
                    step self::Policy::Pundit(WithdrawalRequestPolicy, :create?)
         | 
| 10 | 
            +
                    failure :set_policy_error!
         | 
| 9 11 | 
             
                    step Model(WithdrawalRequest, :new)
         | 
| 10 12 | 
             
                    step :setup_params!
         | 
| 11 13 | 
             
                    step Contract::Build(constant: Contracts::Create)
         | 
| @@ -17,6 +19,10 @@ module StellarBase | |
| 17 19 |  | 
| 18 20 | 
             
                    private
         | 
| 19 21 |  | 
| 22 | 
            +
                    def set_policy_error!(options, params:, **)
         | 
| 23 | 
            +
                      options["result.policy.message"] = POLICY_ERROR_MESSAGE
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
             | 
| 20 26 | 
             
                    def setup_params!(options, params:, **)
         | 
| 21 27 | 
             
                      params[:withdrawal_request].merge!({
         | 
| 22 28 | 
             
                        asset_type: params[:withdrawal_request][:type],
         | 
| @@ -12,13 +12,14 @@ module StellarBase | |
| 12 12 | 
             
                  promises :operations
         | 
| 13 13 |  | 
| 14 14 | 
             
                  executed do |c|
         | 
| 15 | 
            +
                    address = c.account_subscription.address
         | 
| 16 | 
            +
             | 
| 15 17 | 
             
                    c.operations = c.stellar_sdk_client.horizon
         | 
| 16 | 
            -
                      .account(account_id:  | 
| 18 | 
            +
                      .account(account_id: address)
         | 
| 17 19 | 
             
                      .operations(order: "asc", limit: c.operation_limit).records
         | 
| 18 20 |  | 
| 19 21 | 
             
                    if c.operations.empty?
         | 
| 20 | 
            -
                      c.fail_and_return! "No operations found " | 
| 21 | 
            -
                        "for #{c.account_subscription.address}"
         | 
| 22 | 
            +
                      c.fail_and_return! "No operations found for #{address}"
         | 
| 22 23 | 
             
                    end
         | 
| 23 24 | 
             
                  rescue Faraday::ClientError => e
         | 
| 24 25 | 
             
                    c.fail_and_return! "Skipping fetching operations of #{address} " \
         | 
| @@ -34,9 +34,8 @@ module StellarBase | |
| 34 34 |  | 
| 35 35 | 
             
                      c.stellar_tx_id = response.to_hash["hash"]
         | 
| 36 36 | 
             
                    rescue Faraday::ClientError => e
         | 
| 37 | 
            -
                      c. | 
| 38 | 
            -
             | 
| 39 | 
            -
                        "Faraday::ClientError: #{e.message}"
         | 
| 37 | 
            +
                      c.fail_and_return! "Error sending the asset. " \
         | 
| 38 | 
            +
                        "Faraday::ClientError: #{e.inspect}"
         | 
| 40 39 | 
             
                    end
         | 
| 41 40 | 
             
                  end
         | 
| 42 41 |  | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            class CreateStellarBaseAccountSubscriptions < ActiveRecord::Migration[5.2]
         | 
| 2 | 
            +
              def change
         | 
| 3 | 
            +
                create_table :stellar_base_account_subscriptions do |t|
         | 
| 4 | 
            +
                  t.string :address, null: false
         | 
| 5 | 
            +
                  t.string :cursor
         | 
| 6 | 
            +
                  t.index :address, unique: true
         | 
| 7 | 
            +
                  t.timestamps
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
    
        data/lib/stellar_base/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: stellar_base-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ace Subido
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-10- | 
| 11 | 
            +
            date: 2018-10-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: disposable
         | 
| @@ -430,6 +430,7 @@ files: | |
| 430 430 | 
             
            - db/migrate/20180925045927_create_stellar_base_deposit_requests.rb
         | 
| 431 431 | 
             
            - db/migrate/20181001070647_create_stellar_base_deposits.rb
         | 
| 432 432 | 
             
            - db/migrate/20181003072138_create_stellar_base_account_subscriptions.rb
         | 
| 433 | 
            +
            - db/migrate/20181013072141_ensure_deposits_tx_id_uniqueness.rb
         | 
| 433 434 | 
             
            - lib/stellar_base-rails.rb
         | 
| 434 435 | 
             
            - lib/stellar_base.rb
         | 
| 435 436 | 
             
            - lib/stellar_base/engine.rb
         | 
| @@ -463,7 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 463 464 | 
             
                  version: '0'
         | 
| 464 465 | 
             
            requirements: []
         | 
| 465 466 | 
             
            rubyforge_project: 
         | 
| 466 | 
            -
            rubygems_version: 2.7. | 
| 467 | 
            +
            rubygems_version: 2.7.7
         | 
| 467 468 | 
             
            signing_key: 
         | 
| 468 469 | 
             
            specification_version: 4
         | 
| 469 470 | 
             
            summary: Mountable Stellar API Endpoints for Rails
         |