stellar_client 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/lib/stellar_client.rb +2 -0
- data/lib/stellar_client/client.rb +7 -0
- data/lib/stellar_client/requests/get_fees_request.rb +30 -0
- data/lib/stellar_client/responses/get_fees_response.rb +25 -0
- data/lib/stellar_client/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f24ee961e406cf363efbf2d274ac755e6d32246b9e5f2bc520cb8f9a9ccdc4e
|
4
|
+
data.tar.gz: ac6396e89a4b9c292c2445634b42a112630de949ffa46158d2f8a5a6fe7c04cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c93b46a750d15517b1937ef95d03c4ea3115e4457b6757e76dd48cf2461bebc62cdc7092fe4aa6750309cb823d906992b5f7501bd893f2b98a58d2952712ef9d
|
7
|
+
data.tar.gz: 2ff2f4bd8cb193f23ac0a7831eba288a9621cccd2106729a730378dd80138d6fefadc295b414a9d7398f208343c0995c841693a3a72e045e78f744aa30331ec1
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.6.3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [0.7.0] - 2019-08-07
|
8
|
+
### Added
|
9
|
+
- Add `StellarClient::Client.get_fees`
|
10
|
+
|
7
11
|
## [0.6.1] - 2018-02-19
|
8
12
|
### Fixed
|
9
13
|
- Do not join paths when using `/deposit` and `/withdraw`.
|
data/lib/stellar_client.rb
CHANGED
@@ -20,11 +20,13 @@ end
|
|
20
20
|
require "stellar_client/client"
|
21
21
|
require "stellar_client/coercers/indifferent_hash"
|
22
22
|
require "stellar_client/requests/deposit_request"
|
23
|
+
require "stellar_client/requests/get_fees_request"
|
23
24
|
require "stellar_client/requests/get_toml_request"
|
24
25
|
require "stellar_client/requests/send_payment_request"
|
25
26
|
require "stellar_client/requests/withdraw_request"
|
26
27
|
require "stellar_client/responses/base_response"
|
27
28
|
require "stellar_client/responses/deposit_response"
|
29
|
+
require "stellar_client/responses/get_fees_response"
|
28
30
|
require "stellar_client/responses/get_toml_response"
|
29
31
|
require "stellar_client/responses/send_payment_response"
|
30
32
|
require "stellar_client/responses/withdraw_response"
|
@@ -19,6 +19,13 @@ module StellarClient
|
|
19
19
|
DepositResponse.new(raw_response: raw_response)
|
20
20
|
end
|
21
21
|
|
22
|
+
def get_fees(opts = {})
|
23
|
+
transfer_host = get_toml.toml["TRANSFER_SERVER"]
|
24
|
+
request = GetFeesRequest.new(opts.merge(host: transfer_host))
|
25
|
+
raw_response = request.()
|
26
|
+
GetFeesResponse.new(raw_response: raw_response)
|
27
|
+
end
|
28
|
+
|
22
29
|
attribute :bridge_host, String
|
23
30
|
|
24
31
|
private
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module StellarClient
|
2
|
+
class GetFeesRequest
|
3
|
+
|
4
|
+
include APIClientBase::Request.module
|
5
|
+
|
6
|
+
BODY_ATTRS = %i[
|
7
|
+
amount
|
8
|
+
asset_code
|
9
|
+
operation
|
10
|
+
type
|
11
|
+
]
|
12
|
+
attribute :amount, BigDecimal
|
13
|
+
attribute :asset_code, String
|
14
|
+
attribute :operation, String
|
15
|
+
attribute :type, String
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def path
|
20
|
+
"/fee"
|
21
|
+
end
|
22
|
+
|
23
|
+
def params
|
24
|
+
BODY_ATTRS.each_with_object({}) do |attr, hash|
|
25
|
+
hash[attr] = send(attr)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module StellarClient
|
2
|
+
class GetFeesResponse < BaseResponse
|
3
|
+
|
4
|
+
attribute(:body, Coercers::IndifferentHash, {
|
5
|
+
lazy: true,
|
6
|
+
default: :default_body,
|
7
|
+
})
|
8
|
+
attribute :fee, BigDecimal, lazy: true, default: :default_fee
|
9
|
+
attribute :error, String, lazy: true, default: :default_error
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def default_body
|
14
|
+
JSON.parse(raw_response.body)
|
15
|
+
end
|
16
|
+
|
17
|
+
def default_fee
|
18
|
+
body[:fee]
|
19
|
+
end
|
20
|
+
|
21
|
+
def default_error
|
22
|
+
body[:error]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramon Tayag
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|
@@ -217,11 +217,13 @@ files:
|
|
217
217
|
- lib/stellar_client/client.rb
|
218
218
|
- lib/stellar_client/coercers/indifferent_hash.rb
|
219
219
|
- lib/stellar_client/requests/deposit_request.rb
|
220
|
+
- lib/stellar_client/requests/get_fees_request.rb
|
220
221
|
- lib/stellar_client/requests/get_toml_request.rb
|
221
222
|
- lib/stellar_client/requests/send_payment_request.rb
|
222
223
|
- lib/stellar_client/requests/withdraw_request.rb
|
223
224
|
- lib/stellar_client/responses/base_response.rb
|
224
225
|
- lib/stellar_client/responses/deposit_response.rb
|
226
|
+
- lib/stellar_client/responses/get_fees_response.rb
|
225
227
|
- lib/stellar_client/responses/get_toml_response.rb
|
226
228
|
- lib/stellar_client/responses/send_payment_response.rb
|
227
229
|
- lib/stellar_client/responses/withdraw_response.rb
|
@@ -248,8 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
250
|
- !ruby/object:Gem::Version
|
249
251
|
version: '0'
|
250
252
|
requirements: []
|
251
|
-
|
252
|
-
rubygems_version: 2.7.7
|
253
|
+
rubygems_version: 3.0.3
|
253
254
|
signing_key:
|
254
255
|
specification_version: 4
|
255
256
|
summary: Ruby wrapper for Stellar's Stellar Server API
|