coins_paid_rails 1.0.0 → 1.1.4

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: 76dfc07ca328248272a643ae517e9f4e3adfc8d4199df23c4e18aea9f90ee484
4
- data.tar.gz: 522e768d858bc97704304a6021b42e06c5905cbebd151556de6d326a6fc5f62b
3
+ metadata.gz: ca1acc712539224bd9600c8c093b27df63ff221cd6429b8e6ea9c7518a95b99f
4
+ data.tar.gz: 0e78adb0b3a02f21d54cc66c81de396c7a2e8201c35ca692953055c66e011337
5
5
  SHA512:
6
- metadata.gz: 25c3a98da0c552ac54e791d4df5cf939ffdb47be6a6bf17dc1de240e03769c69dc2b1edfaaf492e52c53eec3b2ee20a105bb17bc04a6e2af410adb09dbbdbd42
7
- data.tar.gz: e06207597934bcb1279527225c76ac08ffb0273cba8ad36d2db96a9a90e3fa3ac4e899b5c1a01f220ff3799ee43ee28ba00f6887a38634b33bd8905d434b01bb
6
+ metadata.gz: 3a75ccbe6564df90c140aa4bbf76039819a744cdb1181e27d4bfd83c14ec3b594273c85f411d0165e10537791a20c14bb89f947b2a451a94f0de3490be0721bc
7
+ data.tar.gz: 420f371a7800e275c953a6dbd039b9e0a30509829139de1d0dfd0b229641d46b0fb1b704b0aaa3813deada9ecdd6f1d7cf2af7a80e7855c9d31748e8c6b85231
data/.circleci/config.yml CHANGED
@@ -11,7 +11,7 @@ jobs:
11
11
  - checkout
12
12
  - run: mkdir log
13
13
  - save_cache:
14
- key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
14
+ key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
15
15
  paths:
16
16
  - ~/coins_paid
17
17
 
@@ -33,14 +33,14 @@ jobs:
33
33
  <<: *defaults
34
34
  steps:
35
35
  - restore_cache:
36
- key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
36
+ key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
37
37
  - restore_cache:
38
- key: v1-bundle-{{ checksum "Gemfile" }}
38
+ key: v4-bundle-{{ checksum "Gemfile.lock" }}
39
39
  - run: echo "export rvm_ignore_gemsets_flag=1" >> ~/.rvmrc
40
40
  - run: sudo apt-get update && sudo apt-get install -y libsodium-dev
41
- - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
41
+ - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
42
42
  - save_cache:
43
- key: v1-bundle-{{ checksum "Gemfile" }}
43
+ key: v4-bundle-{{ checksum "Gemfile.lock" }}
44
44
  paths:
45
45
  - ~/coins_paid/vendor/bundle
46
46
 
@@ -53,9 +53,9 @@ jobs:
53
53
  CIRCLE_ARTIFACTS: "./tmp"
54
54
  steps:
55
55
  - restore_cache:
56
- key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
56
+ key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
57
57
  - restore_cache:
58
- key: v1-bundle-{{ checksum "Gemfile" }}
58
+ key: v4-bundle-{{ checksum "Gemfile.lock" }}
59
59
  - attach_workspace:
60
60
  at: ~/coins_paid
61
61
  - run: sudo apt-get update && sudo apt-get install -y libsodium-dev
@@ -81,9 +81,9 @@ jobs:
81
81
  <<: *defaults
82
82
  steps:
83
83
  - restore_cache:
84
- key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
84
+ key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
85
85
  - restore_cache:
86
- key: v1-bundle-{{ checksum "Gemfile" }}
86
+ key: v4-bundle-{{ checksum "Gemfile.lock" }}
87
87
  - run: mkdir -p ~/.ssh && ssh-keyscan -H github.com >> ~/.ssh/known_hosts
88
88
  - run: sudo apt-get update && sudo apt-get install -y libsodium-dev
89
89
  - run: bundle check --path vendor/bundle
data/.gitignore CHANGED
@@ -1,3 +1,2 @@
1
1
  /*.gem
2
- /Gemfile.lock
3
2
  **/test.db
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/Gemfile.lock ADDED
@@ -0,0 +1,147 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ coins_paid_rails (1.1.3)
5
+ activerecord (>= 4.2.0)
6
+ coins_paid_api (~> 1.0)
7
+ dry-initializer (~> 3.0)
8
+ dry-struct (~> 1.0)
9
+
10
+ GEM
11
+ remote: http://www.rubygems.org/
12
+ specs:
13
+ actionpack (5.2.4.4)
14
+ actionview (= 5.2.4.4)
15
+ activesupport (= 5.2.4.4)
16
+ rack (~> 2.0, >= 2.0.8)
17
+ rack-test (>= 0.6.3)
18
+ rails-dom-testing (~> 2.0)
19
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
20
+ actionview (5.2.4.4)
21
+ activesupport (= 5.2.4.4)
22
+ builder (~> 3.1)
23
+ erubi (~> 1.4)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
26
+ activemodel (5.2.4.4)
27
+ activesupport (= 5.2.4.4)
28
+ activerecord (5.2.4.4)
29
+ activemodel (= 5.2.4.4)
30
+ activesupport (= 5.2.4.4)
31
+ arel (>= 9.0)
32
+ activesupport (5.2.4.4)
33
+ concurrent-ruby (~> 1.0, >= 1.0.2)
34
+ i18n (>= 0.7, < 2)
35
+ minitest (~> 5.1)
36
+ tzinfo (~> 1.1)
37
+ arel (9.0.0)
38
+ builder (3.2.4)
39
+ coins_paid_api (1.0.5)
40
+ dry-struct (~> 1.0)
41
+ faraday (~> 0.12)
42
+ faraday_middleware (~> 0.11)
43
+ concurrent-ruby (1.1.7)
44
+ crass (1.0.6)
45
+ diff-lcs (1.4.4)
46
+ docile (1.1.5)
47
+ dry-configurable (0.12.1)
48
+ concurrent-ruby (~> 1.0)
49
+ dry-core (~> 0.5, >= 0.5.0)
50
+ dry-container (0.7.2)
51
+ concurrent-ruby (~> 1.0)
52
+ dry-configurable (~> 0.1, >= 0.1.3)
53
+ dry-core (0.5.0)
54
+ concurrent-ruby (~> 1.0)
55
+ dry-inflector (0.2.0)
56
+ dry-initializer (3.0.4)
57
+ dry-logic (1.1.0)
58
+ concurrent-ruby (~> 1.0)
59
+ dry-core (~> 0.5, >= 0.5)
60
+ dry-struct (1.4.0)
61
+ dry-core (~> 0.5, >= 0.5)
62
+ dry-types (~> 1.5)
63
+ ice_nine (~> 0.11)
64
+ dry-types (1.5.1)
65
+ concurrent-ruby (~> 1.0)
66
+ dry-container (~> 0.3)
67
+ dry-core (~> 0.5, >= 0.5)
68
+ dry-inflector (~> 0.1, >= 0.1.2)
69
+ dry-logic (~> 1.0, >= 1.0.2)
70
+ erubi (1.10.0)
71
+ faraday (0.17.4)
72
+ multipart-post (>= 1.2, < 3)
73
+ faraday_middleware (0.14.0)
74
+ faraday (>= 0.7.4, < 1.0)
75
+ i18n (1.8.5)
76
+ concurrent-ruby (~> 1.0)
77
+ ice_nine (0.11.2)
78
+ json (2.3.0)
79
+ loofah (2.8.0)
80
+ crass (~> 1.0.2)
81
+ nokogiri (>= 1.5.9)
82
+ method_source (1.0.0)
83
+ mini_portile2 (2.5.0)
84
+ minitest (5.14.2)
85
+ multipart-post (2.1.1)
86
+ nokogiri (1.11.1)
87
+ mini_portile2 (~> 2.5.0)
88
+ racc (~> 1.4)
89
+ racc (1.5.2)
90
+ rack (2.2.3)
91
+ rack-test (1.1.0)
92
+ rack (>= 1.0, < 3)
93
+ rails-dom-testing (2.0.3)
94
+ activesupport (>= 4.2.0)
95
+ nokogiri (>= 1.6)
96
+ rails-html-sanitizer (1.3.0)
97
+ loofah (~> 2.3)
98
+ railties (5.2.4.4)
99
+ actionpack (= 5.2.4.4)
100
+ activesupport (= 5.2.4.4)
101
+ method_source
102
+ rake (>= 0.8.7)
103
+ thor (>= 0.19.0, < 2.0)
104
+ rake (13.0.1)
105
+ rspec-core (3.10.0)
106
+ rspec-support (~> 3.10.0)
107
+ rspec-expectations (3.10.0)
108
+ diff-lcs (>= 1.2.0, < 2.0)
109
+ rspec-support (~> 3.10.0)
110
+ rspec-its (1.3.0)
111
+ rspec-core (>= 3.0.0)
112
+ rspec-expectations (>= 3.0.0)
113
+ rspec-mocks (3.10.0)
114
+ diff-lcs (>= 1.2.0, < 2.0)
115
+ rspec-support (~> 3.10.0)
116
+ rspec-rails (4.0.1)
117
+ actionpack (>= 4.2)
118
+ activesupport (>= 4.2)
119
+ railties (>= 4.2)
120
+ rspec-core (~> 3.9)
121
+ rspec-expectations (~> 3.9)
122
+ rspec-mocks (~> 3.9)
123
+ rspec-support (~> 3.9)
124
+ rspec-support (3.10.0)
125
+ simplecov (0.13.0)
126
+ docile (~> 1.1.0)
127
+ json (>= 1.8, < 3)
128
+ simplecov-html (~> 0.10.0)
129
+ simplecov-html (0.10.2)
130
+ sqlite3 (1.4.2)
131
+ thor (1.0.1)
132
+ thread_safe (0.3.6)
133
+ tzinfo (1.2.8)
134
+ thread_safe (~> 0.1)
135
+
136
+ PLATFORMS
137
+ ruby
138
+
139
+ DEPENDENCIES
140
+ coins_paid_rails!
141
+ rspec-its
142
+ rspec-rails
143
+ simplecov
144
+ sqlite3
145
+
146
+ BUNDLED WITH
147
+ 1.17.1
@@ -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.0.0'
4
+ s.version = '1.1.4'
5
5
  s.files = `git ls-files`.split("\n")
6
6
  s.summary = 'CoinsPaid Rails Integration'
7
7
  s.license = 'MIT'
@@ -10,6 +10,5 @@ Gem::Specification.new do |s|
10
10
  s.add_runtime_dependency 'activerecord', '>= 4.2.0'
11
11
  s.add_runtime_dependency 'dry-initializer', '~> 3.0'
12
12
  s.add_runtime_dependency 'dry-struct', '~> 1.0'
13
- s.add_development_dependency 'rspec-rails', '~> 3.0'
13
+ s.add_development_dependency 'rspec-rails'
14
14
  end
15
-
data/lib/coins_paid.rb CHANGED
@@ -12,10 +12,17 @@ module CoinsPaid
12
12
 
13
13
  DEFAULT_CONVERT_TO = ENV['COINS_PAID_CURRENCY']
14
14
 
15
- CRYPTO_CURRENCIES = {
15
+ ADDRESS_PREFIXES = {
16
16
  'BTC' => 'bitcoin',
17
+ 'BCH' => 'bitcoincash',
18
+ 'DOGE' => 'doge',
17
19
  'ETH' => 'ethereum',
18
- 'LTC' => 'litecoin'
20
+ 'EURTE' => 'ethereum',
21
+ 'LTC' => 'litecoin',
22
+ 'USDT' => 'bitcoin',
23
+ 'USDTE' => 'ethereum',
24
+ 'TRX' => 'tron',
25
+ 'USDTT' => 'tron'
19
26
  }.freeze
20
27
 
21
28
  def address(foreign_id, currency:)
@@ -17,9 +17,11 @@ module CoinsPaid
17
17
  end
18
18
 
19
19
  def call
20
- CoinsPaidAddress.find_or_create_by!(request_data.attributes.slice(:foreign_id, :currency)) do |address|
21
- response = CoinsPaid::API.take_address(request_data.attributes)
22
- address.assign_attributes(response.attributes)
20
+ ActiveRecord::Base.transaction do
21
+ CoinsPaidAddress.lock.find_or_create_by!(request_data.attributes.slice(:foreign_id, :currency)) do |address|
22
+ response = CoinsPaid::API.take_address(request_data.attributes)
23
+ address.assign_attributes(response.attributes)
24
+ end
23
25
  end
24
26
  end
25
27
  end
@@ -30,7 +30,7 @@ module CoinsPaid
30
30
  private
31
31
 
32
32
  def token_type
33
- CRYPTO_CURRENCIES.fetch(currency)
33
+ ADDRESS_PREFIXES.fetch(currency)
34
34
  end
35
35
 
36
36
  def encode(string)
@@ -1,2 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative 'coins_paid'
3
+ require 'coins_paid_api'
data/spec/spec_helper.rb CHANGED
@@ -10,7 +10,6 @@ require "active_record/railtie"
10
10
  require 'rspec/rails'
11
11
  require 'rspec/its'
12
12
 
13
- require 'coins_paid_api'
14
13
  require 'coins_paid_rails'
15
14
 
16
15
  Dir['./spec/support/**/*.rb'].each { |f| require f }
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.0.0
4
+ version: 1.1.4
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: 2019-11-20 00:00:00.000000000 Z
12
+ date: 2021-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coins_paid_api
@@ -71,16 +71,16 @@ dependencies:
71
71
  name: rspec-rails
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '3.0'
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: '3.0'
83
+ version: '0'
84
84
  description:
85
85
  email:
86
86
  executables: []
@@ -90,7 +90,9 @@ files:
90
90
  - ".circleci/config.yml"
91
91
  - ".gitignore"
92
92
  - ".rspec"
93
+ - ".ruby-version"
93
94
  - Gemfile
95
+ - Gemfile.lock
94
96
  - coins_paid_rails.gemspec
95
97
  - lib/coins_paid.rb
96
98
  - lib/coins_paid/address.rb