peatio 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -0
- data/lib/peatio/transaction.rb +24 -12
- data/lib/peatio/version.rb +1 -1
- data/peatio.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fb20b81afaac98eea7daeb0282533132bef4688d3e5a37799122c17035d1216
|
4
|
+
data.tar.gz: 479cdd4ce1245d1829b18ebd3a70093cf1e360b435229085b8bb00d1cee2029e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b5e37492a3ae5c3d1408054675268157229b3dac4ee8413dd533d69bbdd8c477f70aa28933c8ff9ebd2d09b4507af22a7e1b1b05c52b222e83aeaec9dd48611
|
7
|
+
data.tar.gz: 3696fe9d97ee721d92222f17af05bff1b93bb040647735e7725b96c7f81ba3f47e3f8b4cf538efbe6ccb10ba5a9d6361fbe5d7fa8d10f1b5892b7d09d35a6d71
|
data/Gemfile.lock
CHANGED
@@ -31,7 +31,9 @@ GEM
|
|
31
31
|
amq-protocol (~> 2.3.0)
|
32
32
|
bunny-mock (1.7.0)
|
33
33
|
bunny (>= 1.7)
|
34
|
+
byebug (11.0.1)
|
34
35
|
clamp (1.3.0)
|
36
|
+
coderay (1.1.2)
|
35
37
|
concurrent-ruby (1.1.5)
|
36
38
|
diff-lcs (1.3)
|
37
39
|
docile (1.3.1)
|
@@ -50,12 +52,19 @@ GEM
|
|
50
52
|
jaro_winkler (1.5.1)
|
51
53
|
json (2.1.0)
|
52
54
|
jwt (2.1.0)
|
55
|
+
method_source (0.9.2)
|
53
56
|
minitest (5.11.3)
|
54
57
|
mysql2 (0.5.2)
|
55
58
|
parallel (1.12.1)
|
56
59
|
parser (2.5.1.2)
|
57
60
|
ast (~> 2.4.0)
|
58
61
|
powerpack (0.1.2)
|
62
|
+
pry (0.12.2)
|
63
|
+
coderay (~> 1.1.0)
|
64
|
+
method_source (~> 0.9.0)
|
65
|
+
pry-byebug (3.7.0)
|
66
|
+
byebug (~> 11.0)
|
67
|
+
pry (~> 0.10)
|
59
68
|
rainbow (3.0.0)
|
60
69
|
rake (10.5.0)
|
61
70
|
rspec (3.8.0)
|
@@ -108,6 +117,7 @@ DEPENDENCIES
|
|
108
117
|
em-spec
|
109
118
|
em-websocket-client
|
110
119
|
peatio!
|
120
|
+
pry-byebug
|
111
121
|
rake (~> 10.0)
|
112
122
|
rspec (~> 3.0)
|
113
123
|
rspec_junit_formatter
|
data/lib/peatio/transaction.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'active_support/concern'
|
2
|
+
require 'active_support/core_ext/string/inquiry'
|
3
|
+
require 'active_support/core_ext/object/blank'
|
2
4
|
require 'active_model'
|
3
5
|
|
4
6
|
module Peatio #:nodoc:
|
@@ -31,7 +33,8 @@ module Peatio #:nodoc:
|
|
31
33
|
#
|
32
34
|
# @note Statuses list:
|
33
35
|
#
|
34
|
-
# pending - the transaction is unconfirmed in the blockchain
|
36
|
+
# pending - the transaction is unconfirmed in the blockchain or
|
37
|
+
# wasn't created yet.
|
35
38
|
#
|
36
39
|
# success - the transaction is a successfull,
|
37
40
|
# the transaction amount has been successfully transferred
|
@@ -40,6 +43,8 @@ module Peatio #:nodoc:
|
|
40
43
|
|
41
44
|
STATUSES = %w[success pending failed].freeze
|
42
45
|
|
46
|
+
DEFAULT_STATUS = 'pending'.freeze
|
47
|
+
|
43
48
|
# @!attribute [rw] hash
|
44
49
|
# return [String] transaction hash
|
45
50
|
attr_accessor :hash
|
@@ -64,21 +69,19 @@ module Peatio #:nodoc:
|
|
64
69
|
# return [String] transaction currency id
|
65
70
|
attr_accessor :currency_id
|
66
71
|
|
67
|
-
|
68
|
-
#
|
69
|
-
# @see Peatio::Transaction::STATUSES for list of statuses by peatio
|
70
|
-
#
|
71
|
-
# return [String] transaction status
|
72
|
-
attr_writer :status
|
73
|
-
|
74
|
-
validates :hash, :txout,
|
75
|
-
:to_address,
|
72
|
+
validates :to_address,
|
76
73
|
:amount,
|
77
|
-
:block_number,
|
78
74
|
:currency_id,
|
79
75
|
:status,
|
80
76
|
presence: true
|
81
77
|
|
78
|
+
validates :hash,
|
79
|
+
:block_number,
|
80
|
+
presence: { if: -> (t){ t.status.failed? || t.status.success? } }
|
81
|
+
|
82
|
+
validates :txout,
|
83
|
+
presence: { if: -> (t){ t.status.success? } }
|
84
|
+
|
82
85
|
validates :block_number,
|
83
86
|
numericality: { greater_than_or_equal_to: 0, only_integer: true }
|
84
87
|
|
@@ -87,6 +90,11 @@ module Peatio #:nodoc:
|
|
87
90
|
|
88
91
|
validates :status, inclusion: { in: STATUSES }
|
89
92
|
|
93
|
+
def initialize(attributes={})
|
94
|
+
super
|
95
|
+
@status = @status.present? ? @status.to_s : DEFAULT_STATUS
|
96
|
+
end
|
97
|
+
|
90
98
|
# Status for specific transaction.
|
91
99
|
#
|
92
100
|
# @!method status
|
@@ -96,7 +104,11 @@ module Peatio #:nodoc:
|
|
96
104
|
# status.failed? # true if transaction status 'failed'
|
97
105
|
# status.success? # true if transaction status 'success'
|
98
106
|
def status
|
99
|
-
@status&.
|
107
|
+
@status&.inquiry
|
108
|
+
end
|
109
|
+
|
110
|
+
def status=(s)
|
111
|
+
@status = s.to_s
|
100
112
|
end
|
101
113
|
end
|
102
114
|
end
|
data/lib/peatio/version.rb
CHANGED
data/peatio.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peatio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis B.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-05-
|
12
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -277,6 +277,20 @@ dependencies:
|
|
277
277
|
- - ">="
|
278
278
|
- !ruby/object:Gem::Version
|
279
279
|
version: '0'
|
280
|
+
- !ruby/object:Gem::Dependency
|
281
|
+
name: pry-byebug
|
282
|
+
requirement: !ruby/object:Gem::Requirement
|
283
|
+
requirements:
|
284
|
+
- - ">="
|
285
|
+
- !ruby/object:Gem::Version
|
286
|
+
version: '0'
|
287
|
+
type: :development
|
288
|
+
prerelease: false
|
289
|
+
version_requirements: !ruby/object:Gem::Requirement
|
290
|
+
requirements:
|
291
|
+
- - ">="
|
292
|
+
- !ruby/object:Gem::Version
|
293
|
+
version: '0'
|
280
294
|
description: Peatio gem contains microservices and command line tools
|
281
295
|
email:
|
282
296
|
- lbellet@heliostech.fr
|
@@ -348,7 +362,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
362
|
- !ruby/object:Gem::Version
|
349
363
|
version: '0'
|
350
364
|
requirements: []
|
351
|
-
|
365
|
+
rubyforge_project:
|
366
|
+
rubygems_version: 2.7.8
|
352
367
|
signing_key:
|
353
368
|
specification_version: 4
|
354
369
|
summary: Peatio is a gem for running critical core services
|