peatio 0.5.0 → 0.5.1

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: 25f7358d1288e7c007202f1035d577a9dcd33b61b7f23bddf6d5b8c057bb5607
4
- data.tar.gz: 24fab553870452be347d1fe1fc1067556e485a5856767e4306e5548758135b24
3
+ metadata.gz: 19e4587348d9e3ef0967a19ca63089397f8a3acc49b5b565eae0a23cc071bc23
4
+ data.tar.gz: 2ce821a3fd697ab8afa53161d197e601961b14d3f9314d778757894e8c0f75b0
5
5
  SHA512:
6
- metadata.gz: ff767337bec9e7b6dfb2993bbe94535138502f9faf761ac70b2e7b30d26bb76df89130aa7cffb1ebab342bad51c512b79034d4f72f42b40a92f7e18240d3eb11
7
- data.tar.gz: 4b3602e261f5d09480d2c72e6db5c45617bbf257ebbbf7f3637dd20bb39497569f45f0d189868f437e88c2e0c8bdf6cf44408386714f82d3dacde060cb4a6d5a
6
+ metadata.gz: d7c9015c4cc3eb3c6cf0b67ab9925ebff6a968c3a6a3f05a5ad947e602c11859460e74eb626d4ac304bd7bf622bbfbb0ae1e1538aabfa555099586bf89dfabcd
7
+ data.tar.gz: a671c3f89623f0f74d8ba80363ab5c9d856c30ebf295a1a2e823b48f58a12cf2f28184a138bd92d11e214fcb08d2eff3109efe36909f5d4c62658221e04b5103
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- peatio (0.4.5)
4
+ peatio (0.5.0)
5
5
  activemodel (~> 5.2.3)
6
6
  amqp
7
7
  bunny
@@ -1,10 +1,25 @@
1
- module Peatio
1
+ module Peatio #:nodoc:
2
+
3
+ # This class represents blockchain block which contains transactions.
4
+ #
5
+ # Using instant of this class in return for Peatio::Blockchain#fetch_block!
6
+ # @see Peatio::Blockchain#fetch_block! example implementation
7
+ # (inside peatio source https://github.com/rubykube/peatio)
8
+ #
9
+ # @author
10
+ # Maksym Naichuk <naichuk.maks@gmail.com> (https://github.com/mnaichuk)
2
11
  class Block
3
12
  include Enumerable
4
13
 
5
14
  delegate :each, to: :@transactions
6
15
 
7
- attr_reader :number, :transactions
16
+ # @!attribute [r] number
17
+ # return [String] block number
18
+ attr_reader :number
19
+
20
+ # @!attribute [r] transactions
21
+ # return [Array<Peatio::Transaction>]
22
+ attr_reader :transactions
8
23
 
9
24
  def initialize(number, transactions)
10
25
  @number = number
@@ -5,7 +5,7 @@ module Peatio #:nodoc:
5
5
  #
6
6
  # Subclass and override abstract methods to implement
7
7
  # a peatio plugable blockchain.
8
- # Than you need to register your blockchain implementation.
8
+ # Then you need to register your blockchain implementation.
9
9
  #
10
10
  # @see Bitcoin::Blockchain Bitcoin as example of Abstract imlementation
11
11
  # (inside peatio source https://github.com/rubykube/peatio).
@@ -100,6 +100,10 @@ module Peatio #:nodoc:
100
100
  # Custom keys could be added by defining them in Currency #options.
101
101
  #
102
102
  # @return [Hash] merged settings.
103
+ #
104
+ # @note Be careful with your blockchain state after configure.
105
+ # Clean everything what could be related to other blockchain configuration.
106
+ # E.g. client state.
103
107
  def configure(settings = {})
104
108
  abstract_method
105
109
  end
@@ -3,7 +3,7 @@ require "peatio/adapter_registry"
3
3
  module Peatio
4
4
  module Blockchain
5
5
 
6
- VERSION = "1.0".freeze
6
+ VERSION = "1.0.0".freeze
7
7
 
8
8
  class << self
9
9
  def registry
@@ -1,18 +1,74 @@
1
1
  require 'active_support/concern'
2
2
  require 'active_model'
3
3
 
4
- module Peatio
4
+ module Peatio #:nodoc:
5
+
6
+ # This class represents blockchain transaction.
7
+ #
8
+ # Using the instant of this class the peatio application will send/recieve
9
+ # income/outcome transactions from a peatio pluggable blockchain.
10
+ #
11
+ # @example
12
+ #
13
+ # Peatio::Transaction.new(
14
+ # {
15
+ # hash: '0x5d0ef9697a2f3ea561c9fbefb48e380a4cf3d26ad2be253177c472fdd0e8b486',
16
+ # txout: 1,
17
+ # to_address: '0x9af4f143cd5ecfba0fcdd863c5ef52d5ccb4f3e5',
18
+ # amount: 0.01,
19
+ # block_number: 7732274,
20
+ # currency_id: 'eth',
21
+ # status: 'success'
22
+ # }
23
+ # )
24
+ #
25
+ # @author
26
+ # Maksym Naichuk <naichuk.maks@gmail.com> (https://github.com/mnaichuk)
5
27
  class Transaction
6
28
  include ActiveModel::Model
7
29
 
8
- STATUSES = %i[success pending fail].freeze
30
+ # List of statuses supported by peatio.
31
+ #
32
+ # @note Statuses list:
33
+ #
34
+ # pending - the transaction is unconfirmed in the blockchain.
35
+ #
36
+ # success - the transaction is a successfull,
37
+ # the transaction amount has been successfully transferred
38
+ #
39
+ # failed - the transaction is failed in the blockchain.
40
+
41
+ STATUSES = %i[success pending failed].freeze
42
+
43
+ # @!attribute [rw] hash
44
+ # return [String] transaction hash
45
+ attr_accessor :hash
46
+
47
+ # @!attribute [rw] txout
48
+ # return [Integer] transaction number in send-to-many request
49
+ attr_accessor :txout
50
+
51
+ # @!attribute [rw] to_address
52
+ # return [String] transaction recepient address
53
+ attr_accessor :to_address
54
+
55
+ # @!attribute [rw] amount
56
+ # return [Decimal] amount of the transaction
57
+ attr_accessor :amount
58
+
59
+ # @!attribute [rw] block_number
60
+ # return [Integer] transaction block number
61
+ attr_accessor :block_number
9
62
 
10
- attr_accessor :hash, :txout,
11
- :to_address,
12
- :amount,
13
- :block_number,
14
- :currency_id
63
+ # @!attribute [rw] currency_id
64
+ # return [String] transaction currency id
65
+ attr_accessor :currency_id
15
66
 
67
+ # @!attribute [w] status
68
+ #
69
+ # @see Peatio::Transaction::STATUSES for list of statuses by peatio
70
+ #
71
+ # return [String] transaction status
16
72
  attr_writer :status
17
73
 
18
74
  validates :hash, :txout,
@@ -31,9 +87,16 @@ module Peatio
31
87
 
32
88
  validates :status, inclusion: { in: STATUSES }
33
89
 
34
- # TODO: rewrite this method
90
+ # Status for specific transaction.
91
+ #
92
+ # @!method status
93
+ #
94
+ # @example
95
+ #
96
+ # status.failed? # true if transaction status 'failed'
97
+ # status.success? # true if transaction status 'success'
35
98
  def status
36
- @status.to_sym
99
+ @status&.inquiry
37
100
  end
38
101
  end
39
102
  end
@@ -1,3 +1,3 @@
1
1
  module Peatio
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -72,6 +72,10 @@ module Peatio
72
72
  # Custom keys could be added by defining them in Currency #options.
73
73
  #
74
74
  # @return [Hash] merged settings.
75
+ #
76
+ # @note Be careful with your wallet state after configure.
77
+ # Clean everything what could be related to other wallet configuration.
78
+ # E.g. client state.
75
79
  def configure(settings = {})
76
80
  abstract_method
77
81
  end
@@ -3,7 +3,7 @@ require "peatio/adapter_registry"
3
3
  module Peatio
4
4
  module Wallet
5
5
 
6
- VERSION = "1.0".freeze
6
+ VERSION = "1.0.0".freeze
7
7
 
8
8
  class << self
9
9
  def registry
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.5.0
4
+ version: 0.5.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-08 00:00:00.000000000 Z
12
+ date: 2019-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel