coins_paid_rails 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df7e3a2b5d34d191761e465f1c8a82d4b7711d93b39bc03eebe9bfadccb339ec
4
- data.tar.gz: 8dbf452034f18709317f11f0318b37e71cc32d8f3fcf7b936b1d0c0a754a34ae
3
+ metadata.gz: 25025c942a4c630da89e160486f2c5d1f05ed9584ce7f2c4fa27d4bf54c738f3
4
+ data.tar.gz: 5d8394faae19349b459dbd31e3277f047eda74eaaa67c9b632649100244170e7
5
5
  SHA512:
6
- metadata.gz: 86fb4482d7847a7b2acdcc22a2d17857dc290e0a271095ba932489bff59f05466ac12568a364ccf6fdc02081e9e0e21d787f4b0829e36f58560f4d883b365543
7
- data.tar.gz: 2d4ccb6c6cb43dc7d6392e34908b8349fa274fd6aef8ba8d92ec514eebe541f274fd6e52f40ba9d831e02d06a3e3ac0b053c41bef291eda513b2247aa316bf2e
6
+ metadata.gz: f53a2431352a34504e6cca780e8a29b3492418ea7112ccfb647139f33e211cf98194e5964a37f837cc856a711db0f1f172bf878fbba7b5b6265ae3f4a610144a
7
+ data.tar.gz: 49ef1f19b5924e1b2ffbc1c0ae485d3c185a8fa91796e676b7fdf07429e1d472a4770d253014e5c023ad3e12681d5969e10a8a6e0b8fb1abd24bc17e92a56b6d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coins_paid_rails (1.1.6)
4
+ coins_paid_rails (1.1.7)
5
5
  activerecord (>= 4.2.0)
6
6
  coins_paid_api (~> 1.0)
7
7
  dry-initializer (~> 3.0)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'coins_paid_rails'
3
3
  s.authors = ['Artem Biserov(artembiserov)', 'Oleg Ivanov(morhekil)']
4
- s.version = '1.1.6'
4
+ s.version = '1.1.7'
5
5
  s.files = `git ls-files`.split("\n")
6
6
  s.summary = 'CoinsPaid Rails Integration'
7
7
  s.license = 'MIT'
data/lib/coins_paid.rb CHANGED
@@ -36,4 +36,8 @@ module CoinsPaid
36
36
  def currency(name)
37
37
  CoinsPaid::API.currencies_list.find { |item| item.currency == name } || raise(UnknownCurrency, name)
38
38
  end
39
+
40
+ def issued_addresses(foreign_id)
41
+ CoinsPaidAddress.where(foreign_id: foreign_id).order(:currency)
42
+ end
39
43
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe CoinsPaid, '.issued_addresses' do
4
+ let(:foreign_id) { 123 }
5
+
6
+ it 'returns addresses with requested foreign_id ordered by currency' do
7
+ attrs = {
8
+ foreign_id: foreign_id,
9
+ currency: 'BTC',
10
+ address: 'addr',
11
+ external_id: 1
12
+ }
13
+
14
+ addr1 = CoinsPaid::CoinsPaidAddress.create!(attrs)
15
+ addr2 = CoinsPaid::CoinsPaidAddress.create!(attrs.merge(currency: 'ETH'))
16
+ CoinsPaid::CoinsPaidAddress.create!(attrs.merge(foreign_id: 555))
17
+
18
+ expect(CoinsPaid.issued_addresses(foreign_id)).to eq [addr1, addr2]
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coins_paid_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Biserov(artembiserov)
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-09-23 00:00:00.000000000 Z
12
+ date: 2021-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coins_paid_api
@@ -104,6 +104,7 @@ files:
104
104
  - lib/generators/coins_paid/templates/migration.rb
105
105
  - spec/address_spec.rb
106
106
  - spec/currency_spec.rb
107
+ - spec/issued_addresses_spec.rb
107
108
  - spec/qr_code_spec.rb
108
109
  - spec/spec_helper.rb
109
110
  - spec/support/database/create_table.rb