buda 0.1.4.0.1 → 0.1.4.0.4
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/.rubocop.yml +1 -1
 - data/.vscode/settings.json +1 -0
 - data/Gemfile +2 -0
 - data/Rakefile +2 -3
 - data/bin/console +15 -0
 - data/bin/setup +8 -0
 - data/buda.gemspec +7 -4
 - data/lib/buda/client.rb +27 -5
 - data/lib/buda/resources/balance.rb +1 -1
 - data/lib/buda/resources/deposit.rb +45 -0
 - data/lib/buda/resources/deposit_data.rb +30 -0
 - data/lib/buda/resources/fiat_account.rb +34 -0
 - data/lib/buda/resources/market.rb +20 -20
 - data/lib/buda/resources/ticker.rb +24 -25
 - data/lib/buda/resources/withdrawal.rb +38 -0
 - data/lib/buda/resources/withdrawal_data.rb +31 -0
 - data/lib/buda/utils.rb +1 -1
 - data/lib/buda/version.rb +1 -1
 - metadata +15 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fdc15eb6001b9c923419a9985835dcd3e7962e4e667135066d90714e3b8038a8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9910e867b55e96625c2dedeb573297b00cfeac86ebc4792170fcfa085a3b48ef
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e842e8ef9b05b581f4f733565f49bb186e580d0fcd79f3be2bb51b2aeacd1989233717639a1754a36c21180d9be14b204c44e4bc6bb948f17e74f174eb9cff2e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 77f8652261520842f9a4d22e1fa2633d565d011e755352511cebaf3f73f74799f4ddfe94ee3af210c49301027ccdc4dd455978ba8d3d1b3c685bf4b95fa86d50
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {}
         
     | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            require 'rake'
         
     | 
| 
       2 
4 
     | 
    
         
             
            require 'rubocop/rake_task'
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
         @@ -8,9 +10,6 @@ rescue LoadError 
     | 
|
| 
       8 
10 
     | 
    
         
             
              puts 'although not required, bundler is recommended for running the tests'
         
     | 
| 
       9 
11 
     | 
    
         
             
            end
         
     | 
| 
       10 
12 
     | 
    
         
             
            task default: :spec
         
     | 
| 
       11 
     | 
    
         
            -
            require 'rspec/core/rake_task'
         
     | 
| 
       12 
     | 
    
         
            -
            RSpec::Core::RakeTask.new(:spec)
         
     | 
| 
       13 
     | 
    
         
            -
            require 'rubocop/rake_task'
         
     | 
| 
       14 
13 
     | 
    
         
             
            RuboCop::RakeTask.new do |task|
         
     | 
| 
       15 
14 
     | 
    
         
             
              task.requires << 'rubocop-performance'
         
     | 
| 
       16 
15 
     | 
    
         
             
              task.requires << 'rubocop-rspec'
         
     | 
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'buda'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 8 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 11 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 12 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            require 'irb'
         
     | 
| 
      
 15 
     | 
    
         
            +
            IRB.start(__FILE__)
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/buda.gemspec
    CHANGED
    
    | 
         @@ -1,20 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
4 
     | 
    
         
             
              s.name        = 'buda'
         
     | 
| 
       3 
     | 
    
         
            -
              s.version     = '0.1.4.0. 
     | 
| 
       4 
     | 
    
         
            -
              s.summary     = ' 
     | 
| 
      
 5 
     | 
    
         
            +
              s.version     = '0.1.4.0.4'
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.summary     = 'buda.com client'
         
     | 
| 
       5 
7 
     | 
    
         
             
              s.description = 'A simple client for buda.com api'
         
     | 
| 
       6 
8 
     | 
    
         
             
              s.authors     = ['Alfredo Enrione']
         
     | 
| 
       7 
9 
     | 
    
         
             
              s.email       = 'aenrione@protonmail.com'
         
     | 
| 
       8 
10 
     | 
    
         
             
              s.homepage    =
         
     | 
| 
       9 
11 
     | 
    
         
             
                'https://rubygems.org/gems/buda'
         
     | 
| 
       10 
12 
     | 
    
         
             
              s.license = 'MIT'
         
     | 
| 
       11 
     | 
    
         
            -
              s.required_ruby_version = Gem::Requirement.new('>= 2.3 
     | 
| 
      
 13 
     | 
    
         
            +
              s.required_ruby_version = Gem::Requirement.new('>= 2.7.3')
         
     | 
| 
       12 
14 
     | 
    
         
             
              s.add_dependency 'http'
         
     | 
| 
       13 
15 
     | 
    
         
             
              s.add_dependency 'json'
         
     | 
| 
       14 
16 
     | 
    
         
             
              s.files = Dir.chdir(File.expand_path(__dir__)) do
         
     | 
| 
       15 
17 
     | 
    
         
             
                `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
       16 
     | 
    
         
            -
              end 
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
       17 
19 
     | 
    
         
             
              s.bindir        = 'exe'
         
     | 
| 
       18 
20 
     | 
    
         
             
              s.executables   = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       19 
21 
     | 
    
         
             
              s.require_paths = ['lib']
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.metadata['rubygems_mfa_required'] = 'true'
         
     | 
| 
       20 
23 
     | 
    
         
             
            end
         
     | 
    
        data/lib/buda/client.rb
    CHANGED
    
    | 
         @@ -6,6 +6,8 @@ require 'buda/errors' 
     | 
|
| 
       6 
6 
     | 
    
         
             
            require 'buda/constants'
         
     | 
| 
       7 
7 
     | 
    
         
             
            require 'buda/version'
         
     | 
| 
       8 
8 
     | 
    
         
             
            require 'buda/resources/balance'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'buda/resources/deposit'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'buda/resources/withdrawal'
         
     | 
| 
       9 
11 
     | 
    
         
             
            require 'buda/resources/market'
         
     | 
| 
       10 
12 
     | 
    
         
             
            require 'json'
         
     | 
| 
       11 
13 
     | 
    
         
             
            require 'net/http'
         
     | 
| 
         @@ -48,15 +50,17 @@ module Buda 
     | 
|
| 
       48 
50 
     | 
    
         
             
                def balances
         
     | 
| 
       49 
51 
     | 
    
         
             
                  result = get.call('balances', true)[:balances]
         
     | 
| 
       50 
52 
     | 
    
         
             
                  balances = []
         
     | 
| 
       51 
     | 
    
         
            -
                   
     | 
| 
       52 
     | 
    
         
            -
                     
     | 
| 
       53 
     | 
    
         
            -
                      new_balance = Balance.new(**balance)
         
     | 
| 
       54 
     | 
    
         
            -
                      balances << new_balance
         
     | 
| 
       55 
     | 
    
         
            -
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  result&.each do |balance|
         
     | 
| 
      
 54 
     | 
    
         
            +
                    balances << Balance.new(**balance)
         
     | 
| 
       56 
55 
     | 
    
         
             
                  end
         
     | 
| 
       57 
56 
     | 
    
         
             
                  balances
         
     | 
| 
       58 
57 
     | 
    
         
             
                end
         
     | 
| 
       59 
58 
     | 
    
         | 
| 
      
 59 
     | 
    
         
            +
                def get_balance(balance_id)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  result = get.call("balances/#{balance_id}", true)[:balance]
         
     | 
| 
      
 61 
     | 
    
         
            +
                  Balance.new(**result)
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
       60 
64 
     | 
    
         
             
                def get_market(market_id)
         
     | 
| 
       61 
65 
     | 
    
         
             
                  market = get.call("markets/#{market_id.upcase}")[:market]
         
     | 
| 
       62 
66 
     | 
    
         
             
                  ticker = get.call("markets/#{market_id.upcase}/ticker")[:ticker]
         
     | 
| 
         @@ -65,6 +69,24 @@ module Buda 
     | 
|
| 
       65 
69 
     | 
    
         
             
                  new_market
         
     | 
| 
       66 
70 
     | 
    
         
             
                end
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
                def deposits(currency)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  result = get.call("currencies/#{currency}/deposits", true)[:deposits]
         
     | 
| 
      
 74 
     | 
    
         
            +
                  deposits = []
         
     | 
| 
      
 75 
     | 
    
         
            +
                  result&.each do |deposit|
         
     | 
| 
      
 76 
     | 
    
         
            +
                    deposits << Deposit.new(**deposit)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
                  deposits
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                def withdrawals(currency)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  result = get.call("currencies/#{currency}/withdrawals", true)[:withdrawals]
         
     | 
| 
      
 83 
     | 
    
         
            +
                  withdrawals = []
         
     | 
| 
      
 84 
     | 
    
         
            +
                  result&.each do |withdrawal|
         
     | 
| 
      
 85 
     | 
    
         
            +
                    withdrawals << Withdrawal.new(**withdrawal)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  end
         
     | 
| 
      
 87 
     | 
    
         
            +
                  withdrawals
         
     | 
| 
      
 88 
     | 
    
         
            +
                end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
       68 
90 
     | 
    
         
             
                def to_s
         
     | 
| 
       69 
91 
     | 
    
         
             
                  visible_chars = 4
         
     | 
| 
       70 
92 
     | 
    
         
             
                  hidden_part = '*' * (@api_key.size - visible_chars)
         
     | 
| 
         @@ -3,7 +3,7 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Buda
         
     | 
| 
       4 
4 
     | 
    
         
             
              # for handling the total balance
         
     | 
| 
       5 
5 
     | 
    
         
             
              class Balance
         
     | 
| 
       6 
     | 
    
         
            -
                attr_reader :id, :available, : 
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :id, :available, :current, :frozen, :pending
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                def initialize(id:, available_amount:, amount:, frozen_amount:, pending_withdraw_amount:, **)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = id
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'deposit_data'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Buda
         
     | 
| 
      
 6 
     | 
    
         
            +
              # for handling deposited amount
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Deposit
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :id, :created_at, :amount, :currency,
         
     | 
| 
      
 9 
     | 
    
         
            +
                            :fee, :state, :deposit_data, :account_id,
         
     | 
| 
      
 10 
     | 
    
         
            +
                            :user_id, :order_id, :order_type, :state_reason,
         
     | 
| 
      
 11 
     | 
    
         
            +
                            :expected_arrival_time, :reserve_name, :reserve_code
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(
         
     | 
| 
      
 14 
     | 
    
         
            +
                  id:, created_at:, amount:, currency:,
         
     | 
| 
      
 15 
     | 
    
         
            +
                  fee:, state:, account_id:, user_id:,
         
     | 
| 
      
 16 
     | 
    
         
            +
                  order_id:, order_type:, state_reason:,
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expected_arrival_time:, reserve_name:, reserve_code:,
         
     | 
| 
      
 18 
     | 
    
         
            +
                  deposit_data:, **
         
     | 
| 
      
 19 
     | 
    
         
            +
                )
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @id = id
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @created_at = created_at
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @amount = amount[0]
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @currency = currency
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @fee = fee
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @state = state
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @account_id = account_id
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @user_id = user_id
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @order_id = order_id
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @order_type = order_type
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @state_reason = state_reason
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @expected_arrival_time = expected_arrival_time
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @reserve_name = reserve_name
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @reserve_code = reserve_code
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @deposit_data = DepositData.new(**deposit_data)
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "#{@amount} (#{@currency})"
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 42 
     | 
    
         
            +
                  "<Deposit #{@amount} (#{@currency})>"
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Buda
         
     | 
| 
      
 4 
     | 
    
         
            +
              # for handling deposit_data of Deposit Class
         
     | 
| 
      
 5 
     | 
    
         
            +
              class DepositData
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :type, :upload_url, :created_at, :update_at,
         
     | 
| 
      
 7 
     | 
    
         
            +
                            :tx_hash, :address, :method
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(
         
     | 
| 
      
 10 
     | 
    
         
            +
                  type:, upload_url:, created_at:,
         
     | 
| 
      
 11 
     | 
    
         
            +
                  updated_at:, **kwargs
         
     | 
| 
      
 12 
     | 
    
         
            +
                )
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @type = type
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @upload_url = upload_url
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @created_at = created_at
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @updated_at = updated_at
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @method = kwargs[:method]
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @address = kwargs[:address]
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @tx_hash = kwargs[:tx_hash]
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "#{@type} (#{@created_at.to_date})"
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "<DepositData #{@type} (#{@created_at.to_date})>"
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Buda
         
     | 
| 
      
 4 
     | 
    
         
            +
              # for handling the total balance
         
     | 
| 
      
 5 
     | 
    
         
            +
              class FiatAccount
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :id, :account_number, :created_at, :account_type,
         
     | 
| 
      
 7 
     | 
    
         
            +
                            :currency
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(**kwargs)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @id = kwargs[:id]
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @account_number = kwargs[:account_number]
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @created_at = kwargs[:created_at]
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @account_type = kwargs[:account_type]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @bank_id = kwargs[:bank_id]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @currency = kwargs[:currency]
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @document_number = kwargs[:document_number]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @email = kwargs[:email]
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @phone = kwargs[:phone]
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @national_number_identifier = kwargs[:national_number_identifier]
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @bank_name = kwargs[:bank_name]
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @updated_at = kwargs[:updated_at]
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @inter_bank_number = kwargs[:inter_bank_number]
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @source_account = kwargs[:source_account]
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "#{@bank_name} (#{@account_number})"
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 31 
     | 
    
         
            +
                  "<FiatAccount #{@bank_name} (#{@account_number})>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,30 +1,30 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'ticker'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            module Buda
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
              # for handling the total balance
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Market
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :id, :name, :base_currency, :quote_currency, :minimum_order_amount, :ticker
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(id:, name:, base_currency:, quote_currency:, minimum_order_amount:, **)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @id = id
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @name = name
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @base_currency = base_currency
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @quote_currency = quote_currency
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @minimum_order_amount = minimum_order_amount
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                def set_ticker(**ticker)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @ticker = Buda::Ticker.new(**ticker)
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "#{@name} (#{@id})"
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "<Market #{@name} (#{@id})>"
         
     | 
| 
       29 
28 
     | 
    
         
             
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
       30 
30 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,31 +1,30 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Buda
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              
         
     | 
| 
       9 
     | 
    
         
            -
                  def initialize(market_id:,
         
     | 
| 
       10 
     | 
    
         
            -
                    last_price:, min_ask:,
         
     | 
| 
       11 
     | 
    
         
            -
                    max_bid:, volume:,
         
     | 
| 
       12 
     | 
    
         
            -
                    price_variation_24h:, price_variation_7d:, **)
         
     | 
| 
       13 
     | 
    
         
            -
                    @market_id = market_id
         
     | 
| 
       14 
     | 
    
         
            -
                    @last_price = last_price[0]
         
     | 
| 
       15 
     | 
    
         
            -
                    @min_ask = min_ask
         
     | 
| 
       16 
     | 
    
         
            -
                    @max_bid = max_bid
         
     | 
| 
       17 
     | 
    
         
            -
                    @price_variation_24h = price_variation_24h
         
     | 
| 
       18 
     | 
    
         
            -
                    @volume = volume
         
     | 
| 
       19 
     | 
    
         
            -
                    @price_variation_7d = price_variation_7d
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
              
         
     | 
| 
       22 
     | 
    
         
            -
                  def to_s
         
     | 
| 
       23 
     | 
    
         
            -
                    "#{@market_id} (#{@last_price})"
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
      
 4 
     | 
    
         
            +
              # for handling the total balance
         
     | 
| 
      
 5 
     | 
    
         
            +
              class Ticker
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :market_id, :last_price, :min_ask, :volume,
         
     | 
| 
      
 7 
     | 
    
         
            +
                            :max_bid, :price_variation_7d, :price_variation_24h
         
     | 
| 
       25 
8 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(market_id:,
         
     | 
| 
      
 10 
     | 
    
         
            +
                               last_price:, min_ask:,
         
     | 
| 
      
 11 
     | 
    
         
            +
                               max_bid:, volume:,
         
     | 
| 
      
 12 
     | 
    
         
            +
                               price_variation_24h:, price_variation_7d:, **)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @market_id = market_id
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @last_price = last_price[0]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @min_ask = min_ask
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @max_bid = max_bid
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @price_variation_24h = price_variation_24h
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @volume = volume
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @price_variation_7d = price_variation_7d
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 23 
     | 
    
         
            +
                  "#{@market_id} (#{@last_price})"
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 27 
     | 
    
         
            +
                  "<Ticker #{@market_id} (#{@last_price})>"
         
     | 
| 
       29 
28 
     | 
    
         
             
                end
         
     | 
| 
       30 
29 
     | 
    
         
             
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'withdrawal_data'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Buda
         
     | 
| 
      
 6 
     | 
    
         
            +
              # for handling the total balance
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Withdrawal
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :id, :created_at, :amount, :currency,
         
     | 
| 
      
 9 
     | 
    
         
            +
                            :fee, :state, :deposit_data, :account_id,
         
     | 
| 
      
 10 
     | 
    
         
            +
                            :user_id, :order_id, :order_type, :state_reason,
         
     | 
| 
      
 11 
     | 
    
         
            +
                            :expected_arrival_time, :reserve_name, :reserve_code
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(**kwargs)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @id = kwargs[:id]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @uuid = kwargs[:uuid]
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @currency = kwargs[:currency]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @created_at = kwargs[:created_at]
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @forced_reason = kwargs[:forced_reason]
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @account_id = kwargs[:account_id]
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @user_id = kwargs[:user_id]
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @expected_execution_time = kwargs[:expected_execution_time]
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @expected_arrival_time = kwargs[:expected_arrival_time]
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @hold_execution = kwargs[:hold_execution]
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @amount = kwargs[:amount][0]
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @fee = kwargs[:fee]
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @usd_amount = kwargs[:usd_amount]
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @deposit_data = WithdrawalData.new(**kwargs[:withdrawal_data])
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 31 
     | 
    
         
            +
                  "#{@amount} (#{@currency})"
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 35 
     | 
    
         
            +
                  "<Withdrawal #{@amount} (#{@currency})>"
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'buda/resources/fiat_account'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Buda
         
     | 
| 
      
 6 
     | 
    
         
            +
              # for handling the total balance
         
     | 
| 
      
 7 
     | 
    
         
            +
              class WithdrawalData
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :type, :id, :created_at, :update_at,
         
     | 
| 
      
 9 
     | 
    
         
            +
                            :tx_hash, :target_address, :statement_ref,
         
     | 
| 
      
 10 
     | 
    
         
            +
                            :fiat_account
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def initialize(**kwargs)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @type = kwargs[:type]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @id = kwargs[:id]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @statement_ref = kwargs[:statement_ref]
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @created_at = kwargs[:created_at]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @updated_at = kwargs[:updated_at]
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @target_address = kwargs[:target_address]
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @tx_hash = kwargs[:tx_hash]
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @fiat_account = FiatAccount.new(**kwargs[:fiat_account]) if kwargs[:fiat_account]
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 24 
     | 
    
         
            +
                  "#{@type} (#{@created_at})"
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 28 
     | 
    
         
            +
                  "<WithdrawalData #{@type} (#{@created_at})>"
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/buda/utils.rb
    CHANGED
    
    
    
        data/lib/buda/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: buda
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1.4.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.4.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alfredo Enrione
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-01 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-05-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: http
         
     | 
| 
         @@ -46,8 +46,11 @@ extra_rdoc_files: [] 
     | 
|
| 
       46 
46 
     | 
    
         
             
            files:
         
     | 
| 
       47 
47 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       48 
48 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
      
 49 
     | 
    
         
            +
            - ".vscode/settings.json"
         
     | 
| 
       49 
50 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       50 
51 
     | 
    
         
             
            - Rakefile
         
     | 
| 
      
 52 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 53 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
       51 
54 
     | 
    
         
             
            - buda.gemspec
         
     | 
| 
       52 
55 
     | 
    
         
             
            - lib/buda.rb
         
     | 
| 
       53 
56 
     | 
    
         
             
            - lib/buda/client.rb
         
     | 
| 
         @@ -55,14 +58,20 @@ files: 
     | 
|
| 
       55 
58 
     | 
    
         
             
            - lib/buda/errors.rb
         
     | 
| 
       56 
59 
     | 
    
         
             
            - lib/buda/resources/balance.rb
         
     | 
| 
       57 
60 
     | 
    
         
             
            - lib/buda/resources/currency.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/buda/resources/deposit.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/buda/resources/deposit_data.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/buda/resources/fiat_account.rb
         
     | 
| 
       58 
64 
     | 
    
         
             
            - lib/buda/resources/market.rb
         
     | 
| 
       59 
65 
     | 
    
         
             
            - lib/buda/resources/ticker.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
            - lib/buda/resources/withdrawal.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/buda/resources/withdrawal_data.rb
         
     | 
| 
       60 
68 
     | 
    
         
             
            - lib/buda/utils.rb
         
     | 
| 
       61 
69 
     | 
    
         
             
            - lib/buda/version.rb
         
     | 
| 
       62 
70 
     | 
    
         
             
            homepage: https://rubygems.org/gems/buda
         
     | 
| 
       63 
71 
     | 
    
         
             
            licenses:
         
     | 
| 
       64 
72 
     | 
    
         
             
            - MIT
         
     | 
| 
       65 
     | 
    
         
            -
            metadata: 
     | 
| 
      
 73 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 74 
     | 
    
         
            +
              rubygems_mfa_required: 'true'
         
     | 
| 
       66 
75 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       67 
76 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       68 
77 
     | 
    
         
             
            require_paths:
         
     | 
| 
         @@ -71,15 +80,15 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       71 
80 
     | 
    
         
             
              requirements:
         
     | 
| 
       72 
81 
     | 
    
         
             
              - - ">="
         
     | 
| 
       73 
82 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       74 
     | 
    
         
            -
                  version: 2.3 
     | 
| 
      
 83 
     | 
    
         
            +
                  version: 2.7.3
         
     | 
| 
       75 
84 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       76 
85 
     | 
    
         
             
              requirements:
         
     | 
| 
       77 
86 
     | 
    
         
             
              - - ">="
         
     | 
| 
       78 
87 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       79 
88 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       80 
89 
     | 
    
         
             
            requirements: []
         
     | 
| 
       81 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 90 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
       82 
91 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       83 
92 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       84 
     | 
    
         
            -
            summary:  
     | 
| 
      
 93 
     | 
    
         
            +
            summary: buda.com client
         
     | 
| 
       85 
94 
     | 
    
         
             
            test_files: []
         
     |