stellar_client 0.6.1 → 0.7.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: 8f87f67b57931cc5226cf3dffbb994008e82960b16994a7d62e263ab9911bbf8
4
- data.tar.gz: d339486ef97b41626de0c18f69b8d6a4230d669787b5ca64236d389742a508d0
3
+ metadata.gz: 7f24ee961e406cf363efbf2d274ac755e6d32246b9e5f2bc520cb8f9a9ccdc4e
4
+ data.tar.gz: ac6396e89a4b9c292c2445634b42a112630de949ffa46158d2f8a5a6fe7c04cf
5
5
  SHA512:
6
- metadata.gz: '00791b7f130f1ca4978885e4661bd80bd60df7a52a997f9f106765c6b12f322f720b1da8472d14abbcd68d2f1a1c8556f4dd82c4bc0669c405c5520ce8241401'
7
- data.tar.gz: 7d2527fbac24d9175452c624d9257a1c3cdb3416e775cbd6984fbc1848f8789ed2882952eb956a677d19e5009f4b8e17bbb999859cfae44af8556f22b9f15150
6
+ metadata.gz: c93b46a750d15517b1937ef95d03c4ea3115e4457b6757e76dd48cf2461bebc62cdc7092fe4aa6750309cb823d906992b5f7501bd893f2b98a58d2952712ef9d
7
+ data.tar.gz: 2ff2f4bd8cb193f23ac0a7831eba288a9621cccd2106729a730378dd80138d6fefadc295b414a9d7398f208343c0995c841693a3a72e045e78f744aa30331ec1
@@ -1 +1 @@
1
- ruby-2.5.1
1
+ ruby-2.6.3
@@ -2,7 +2,7 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.5.1
6
- before_install: gem install bundler -v 1.16.2
5
+ - 2.6.3
6
+ before_install: gem install bundler -v 1.16.6
7
7
  before_script:
8
8
  - cp spec/config.yml{.sample,}
@@ -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`.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module StellarClient
2
- VERSION = "0.6.1".freeze
2
+ VERSION = "0.7.0".freeze
3
3
  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.6.1
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-02-19 00:00:00.000000000 Z
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
- rubyforge_project:
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