binance_client 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52c8b1596a4976bc9b6e2743fad40d6e33d050f6a614bcb550128ce29bb97d00
4
- data.tar.gz: 2cb12b4ad491d438303a745e357793f4c2d9df97d66c05fd59226f2649e7b492
3
+ metadata.gz: 4b4624eac956c44c052169d1c6598f527ac24dbee062321dd23525d33cc5fea0
4
+ data.tar.gz: 3cc4c5a13eedf200f51a218daf89aeb2ad4a8b49607149db8397af47b5c45c02
5
5
  SHA512:
6
- metadata.gz: cd519eeaff647220d99d6abea75054cc1eae2fd2dea9f6733d44afb4c40977957aeb74e8720bda35f5d159fff28d4092a0bb1c6fcddc3995bdc8bb84d5a4ccda
7
- data.tar.gz: 0d4570d268372084d100619469064d6ae5f364e63b99d6c0063f6bb4b68f1b6dad84a94bccd15d1308361a7bfe72371791e2a27f5f3a97465217f200f076a931
6
+ metadata.gz: 416797926140c8928d4db9eb322db9187d3744af4d8c0a9f5090ce1bbedc85edabd4ea2f26b9249591d329d6da01445f38a98f881d12a91d88d3f76349c3cc0f
7
+ data.tar.gz: 49cec6ad29790c32623484f23ca6986f79d635d738d18da4b3fec3b8a0495696d146380fea9a77f9011930ca2c8bdb7ab2d871f4ea7e1a7efdf7ded25d6b3037
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.4.0] - 2021-12-09
8
+ ### Added
9
+ - Add factories for use in app development
10
+ - Add `#sub_account_deposit_address`
11
+
7
12
  ## [1.3.0] - 2021-11-29
8
13
  ### Added
9
14
  - Add proxy support
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in binance_client.gemspec
4
4
  gemspec
5
5
 
6
+ gem "factory_bot"
6
7
  gem "rake", "~> 12.0"
7
8
  gem "rspec", "~> 3.0"
8
9
  gem "pry-byebug"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- binance_client (1.3.0)
4
+ binance_client (1.4.0)
5
5
  activesupport
6
6
  api_client_base (~> 1.11)
7
7
  typhoeus
@@ -37,6 +37,8 @@ GEM
37
37
  diff-lcs (1.4.4)
38
38
  ethon (0.15.0)
39
39
  ffi (>= 1.15.0)
40
+ factory_bot (6.2.0)
41
+ activesupport (>= 5.0.0)
40
42
  ffi (1.15.4)
41
43
  gem_config (0.3.2)
42
44
  hashdiff (1.0.1)
@@ -91,6 +93,7 @@ PLATFORMS
91
93
 
92
94
  DEPENDENCIES
93
95
  binance_client!
96
+ factory_bot
94
97
  pry-byebug
95
98
  rake (~> 12.0)
96
99
  rspec (~> 3.0)
data/README.md CHANGED
@@ -67,6 +67,10 @@ end
67
67
  ## Development
68
68
  Edit the `config.yml.sample` with your own credentials for testing
69
69
 
70
+ ## Factories
71
+
72
+ To make testing easier in your app, `require "binance_client/factories"` to get access to factories of the models.
73
+
70
74
  ## Contributing
71
75
 
72
76
  Bug reports and pull requests are welcome on GitHub at https://github.com/bloom-solutions/binance_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/bloom-solutions/binance_client/blob/master/CODE_OF_CONDUCT.md).
@@ -8,6 +8,7 @@ module BinanceClient
8
8
  api_action :book_ticker
9
9
  api_action :order_book_depth
10
10
  api_action :sub_account_assets, args: [:email]
11
+ api_action :sub_account_deposit_address, args: [:email, :coin]
11
12
 
12
13
  attribute :host
13
14
  attribute :api_key
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+
3
+ factory :binance_client_asset_balance, class: "BinanceClient::AssetBalance" do
4
+ sequence(:asset) { |n| "ASSET#{n}" }
5
+ free { rand(10_000) }
6
+ locked { rand(1_000) }
7
+
8
+ initialize_with do
9
+ new(asset: asset, free: free, locked: locked)
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,28 @@
1
+ module BinanceClient
2
+ class DepositAddress
3
+
4
+ def self.new_from_raw(raw_hash)
5
+ args = raw_hash.each_with_object({}) do |(k, v), h|
6
+ h[k.underscore] = v
7
+ end
8
+
9
+ self.new(**args)
10
+ end
11
+
12
+ ATTRS = [
13
+ :address,
14
+ :coin,
15
+ :tag,
16
+ :url,
17
+ ]
18
+
19
+ attr_accessor(*ATTRS)
20
+
21
+ def initialize(**kwargs)
22
+ kwargs.each do |attr, value|
23
+ self.send("#{attr}=", value)
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ module BinanceClient
2
+ class SubAccountDepositAddressRequest < AuthenticatedBaseRequest
3
+
4
+ attribute :email, String
5
+ attribute :coin, String
6
+ attribute :network, String
7
+
8
+ private
9
+
10
+ def path
11
+ "/sapi/v1/capital/deposit/subAddress"
12
+ end
13
+
14
+ def params_without_signature
15
+ {
16
+ email: email,
17
+ coin: coin,
18
+ network: network,
19
+ }.reject do |key, value|
20
+ value.nil?
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,14 @@
1
+ module BinanceClient
2
+ class SubAccountDepositAddressResponse < BaseResponse
3
+
4
+ def deposit_address
5
+ DepositAddress.new(
6
+ address: body["address"],
7
+ coin: body["coin"],
8
+ tag: body["tag"],
9
+ url: body["url"],
10
+ )
11
+ end
12
+
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module BinanceClient
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -11,6 +11,7 @@ require "binance_client/models/base_model"
11
11
  require "binance_client/models/order_book_entry"
12
12
  require "binance_client/models/order_book"
13
13
  require "binance_client/models/asset_balance"
14
+ require "binance_client/models/deposit_address"
14
15
 
15
16
  require "binance_client/requests/base_request"
16
17
  require "binance_client/requests/authenticated_base_request"
@@ -21,12 +22,14 @@ require "binance_client/requests/get_all_request"
21
22
  require "binance_client/requests/book_ticker_request"
22
23
  require "binance_client/requests/order_book_depth_request"
23
24
  require "binance_client/requests/sub_account_assets_request"
25
+ require "binance_client/requests/sub_account_deposit_address_request"
24
26
  require "binance_client/responses/system_status_response"
25
27
  require "binance_client/responses/account_snapshot_response"
26
28
  require "binance_client/responses/get_all_response"
27
29
  require "binance_client/responses/book_ticker_response"
28
30
  require "binance_client/responses/order_book_depth_response"
29
31
  require "binance_client/responses/sub_account_assets_response"
32
+ require "binance_client/responses/sub_account_deposit_address_response"
30
33
 
31
34
  module BinanceClient
32
35
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binance_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AJ Villalobos
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-29 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api_client_base
@@ -116,8 +116,10 @@ files:
116
116
  - binance_client.gemspec
117
117
  - lib/binance_client.rb
118
118
  - lib/binance_client/client.rb
119
+ - lib/binance_client/factories.rb
119
120
  - lib/binance_client/models/asset_balance.rb
120
121
  - lib/binance_client/models/base_model.rb
122
+ - lib/binance_client/models/deposit_address.rb
121
123
  - lib/binance_client/models/order_book.rb
122
124
  - lib/binance_client/models/order_book_entry.rb
123
125
  - lib/binance_client/requests/account_snapshot_request.rb
@@ -127,6 +129,7 @@ files:
127
129
  - lib/binance_client/requests/get_all_request.rb
128
130
  - lib/binance_client/requests/order_book_depth_request.rb
129
131
  - lib/binance_client/requests/sub_account_assets_request.rb
132
+ - lib/binance_client/requests/sub_account_deposit_address_request.rb
130
133
  - lib/binance_client/requests/system_status_request.rb
131
134
  - lib/binance_client/responses/account_snapshot_response.rb
132
135
  - lib/binance_client/responses/base_response.rb
@@ -134,6 +137,7 @@ files:
134
137
  - lib/binance_client/responses/get_all_response.rb
135
138
  - lib/binance_client/responses/order_book_depth_response.rb
136
139
  - lib/binance_client/responses/sub_account_assets_response.rb
140
+ - lib/binance_client/responses/sub_account_deposit_address_response.rb
137
141
  - lib/binance_client/responses/system_status_response.rb
138
142
  - lib/binance_client/version.rb
139
143
  homepage: https://github.com/bloom-solutions/binance_client-ruby