arkecosystem-client 0.1.0 → 1.0.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.
@@ -15,7 +15,6 @@ module ArkEcosystem
15
15
  # @return [ArkEcosystem::Client::API::Two::Wallets]
16
16
  def initialize(config)
17
17
  @host = config[:host]
18
- @version = config[:version]
19
18
  @http_client = nil
20
19
  end
21
20
 
@@ -81,10 +80,7 @@ module ArkEcosystem
81
80
  if @http_client.nil?
82
81
  Faraday.new @host.to_s do |faraday|
83
82
  faraday.headers['Content-Type'] = 'application/json'
84
-
85
- unless @version.nil?
86
- faraday.headers['API-Version'] = @version.to_s
87
- end
83
+ faraday.headers['API-Version'] = 2
88
84
 
89
85
  faraday.request :json
90
86
 
@@ -1,10 +1,10 @@
1
1
  module ArkEcosystem
2
2
  module Client
3
3
  # Current major release.
4
- MAJOR = 0
4
+ MAJOR = 1
5
5
 
6
6
  # Current minor release.
7
- MINOR = 1
7
+ MINOR = 0
8
8
 
9
9
  # Current patch level.
10
10
  PATCH = 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkecosystem-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Faust
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: codecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.4
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.1.4
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.16.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.16.1
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: faraday
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +122,7 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: 0.12.2
97
- description: A simple Ruby API client for the ARK Blockchain.
125
+ description: A simple Ruby API client for the Ark Blockchain.
98
126
  email:
99
127
  - brian@ark.io
100
128
  executables: []
@@ -103,20 +131,13 @@ extra_rdoc_files: []
103
131
  files:
104
132
  - lib/arkecosystem/client.rb
105
133
  - lib/arkecosystem/client/api/base.rb
106
- - lib/arkecosystem/client/api/one/accounts.rb
107
- - lib/arkecosystem/client/api/one/blocks.rb
108
- - lib/arkecosystem/client/api/one/delegates.rb
109
- - lib/arkecosystem/client/api/one/loader.rb
110
- - lib/arkecosystem/client/api/one/peers.rb
111
- - lib/arkecosystem/client/api/one/signatures.rb
112
- - lib/arkecosystem/client/api/one/transactions.rb
113
- - lib/arkecosystem/client/api/two/blocks.rb
114
- - lib/arkecosystem/client/api/two/delegates.rb
115
- - lib/arkecosystem/client/api/two/node.rb
116
- - lib/arkecosystem/client/api/two/peers.rb
117
- - lib/arkecosystem/client/api/two/transactions.rb
118
- - lib/arkecosystem/client/api/two/votes.rb
119
- - lib/arkecosystem/client/api/two/wallets.rb
134
+ - lib/arkecosystem/client/api/blocks.rb
135
+ - lib/arkecosystem/client/api/delegates.rb
136
+ - lib/arkecosystem/client/api/node.rb
137
+ - lib/arkecosystem/client/api/peers.rb
138
+ - lib/arkecosystem/client/api/transactions.rb
139
+ - lib/arkecosystem/client/api/votes.rb
140
+ - lib/arkecosystem/client/api/wallets.rb
120
141
  - lib/arkecosystem/client/connection.rb
121
142
  - lib/arkecosystem/client/connection_manager.rb
122
143
  - lib/arkecosystem/client/http/client.rb
@@ -143,8 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
164
  version: '0'
144
165
  requirements: []
145
166
  rubyforge_project:
146
- rubygems_version: 2.7.6
167
+ rubygems_version: 2.7.7
147
168
  signing_key:
148
169
  specification_version: 4
149
- summary: A simple Ruby API client for the ARK Blockchain.
170
+ summary: A simple Ruby API client for the Ark Blockchain.
150
171
  test_files: []
@@ -1,58 +0,0 @@
1
- require 'arkecosystem/client/api/base'
2
-
3
- module ArkEcosystem
4
- module Client
5
- module API
6
- # Methods for Version 1 of the API
7
- #
8
- # @see https://docs.ark.io/v1.0/reference#api-v1-accounts
9
- module One
10
- # Methods for the Accounts API
11
- class Accounts < Base
12
- # Get the balance for the given address.
13
- #
14
- # @param address [String]
15
- #
16
- # @return [Faraday::Response]
17
- def balance(address)
18
- @client.get('accounts/getBalance', address: address)
19
- end
20
-
21
- # Get the public key for the given address.
22
- #
23
- # @param address [String]
24
- #
25
- # @return [Faraday::Response]
26
- def public_key(address)
27
- @client.get('accounts/getPublickey', address: address)
28
- end
29
-
30
- # Get the delegate by the given address.
31
- #
32
- # @param address [String]
33
- #
34
- # @return [Faraday::Response]
35
- def delegate(address)
36
- @client.get('accounts/delegates', address: address)
37
- end
38
-
39
- # Get the delegate registration fee.
40
- #
41
- # @return [Faraday::Response]
42
- def delegates_fee
43
- @client.get('accounts/delegates/fee')
44
- end
45
-
46
- # Get the account by the given address.
47
- #
48
- # @param address [String]
49
- #
50
- # @return [Faraday::Response]
51
- def account(address)
52
- @client.get('accounts', address: address)
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,96 +0,0 @@
1
- require 'arkecosystem/client/api/base'
2
-
3
- module ArkEcosystem
4
- module Client
5
- module API
6
- # Methods for Version 1 of the API
7
- #
8
- # @see https://docs.ark.io/v1.0/reference#api-v1-blocks
9
- module One
10
- # Methods for the Blocks API
11
- class Blocks < Base
12
- # Get all blocks.
13
- #
14
- # @param parameters [Hash]
15
- #
16
- # @return [Faraday::Response]
17
- def all(parameters = {})
18
- @client.get('blocks', parameters)
19
- end
20
-
21
- # Get the delegate by the given id.
22
- #
23
- # @param id [String]
24
- #
25
- # @return [Faraday::Response]
26
- def show(id)
27
- @client.get('blocks/get', id: id)
28
- end
29
-
30
- # Get the blockchain epoch.
31
- #
32
- # @return [Faraday::Response]
33
- def epoch
34
- @client.get('blocks/getEpoch')
35
- end
36
-
37
- # Get the blockchain height.
38
- #
39
- # @return [Faraday::Response]
40
- def height
41
- @client.get('blocks/getHeight')
42
- end
43
-
44
- # Get the blockchain nethash.
45
- #
46
- # @return [Faraday::Response]
47
- def nethash
48
- @client.get('blocks/getNethash')
49
- end
50
-
51
- # Get the blockchain fee.
52
- #
53
- # @return [Faraday::Response]
54
- def fee
55
- @client.get('blocks/getFee')
56
- end
57
-
58
- # Get the blockchain fees.
59
- #
60
- # @return [Faraday::Response]
61
- def fees
62
- @client.get('blocks/getFees')
63
- end
64
-
65
- # Get the blockchain milestone.
66
- #
67
- # @return [Faraday::Response]
68
- def milestone
69
- @client.get('blocks/getMilestone')
70
- end
71
-
72
- # Get the blockchain reward.
73
- #
74
- # @return [Faraday::Response]
75
- def reward
76
- @client.get('blocks/getReward')
77
- end
78
-
79
- # Get the blockchain supply.
80
- #
81
- # @return [Faraday::Response]
82
- def supply
83
- @client.get('blocks/getSupply')
84
- end
85
-
86
- # Get the blockchain status.
87
- #
88
- # @return [Faraday::Response]
89
- def status
90
- @client.get('blocks/getStatus')
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
@@ -1,102 +0,0 @@
1
- require 'arkecosystem/client/api/base'
2
-
3
- module ArkEcosystem
4
- module Client
5
- module API
6
- # Methods for Version 1 of the API
7
- #
8
- # @see https://docs.ark.io/v1.0/reference#api-v1-delegates
9
- module One
10
- # Methods for the Delegates API
11
- class Delegates < Base
12
- # Get all delegates.
13
- #
14
- # @param parameters [Hash]
15
- #
16
- # @return [Faraday::Response]
17
- def all(parameters = {})
18
- @client.get('delegates', parameters)
19
- end
20
-
21
- # Get the delegate by the given id.
22
- #
23
- # @param parameters [Hash]
24
- #
25
- # @return [Faraday::Response]
26
- def show(parameters = {})
27
- @client.get('delegates/get', parameters)
28
- end
29
-
30
- # Count all delegates.
31
- #
32
- # @return [Faraday::Response]
33
- def count
34
- @client.get('delegates/count')
35
- end
36
-
37
- # Search all delegates.
38
- #
39
- # @param query [String]
40
- # @param parameters [Hash]
41
- #
42
- # @return [Faraday::Response]
43
- def search(query, parameters = {})
44
- @client.get('delegates/search', { q: query }.merge(parameters))
45
- end
46
-
47
- # Get the voters for the given delegate.
48
- #
49
- # @param address [String]
50
- # @param parameters [Hash]
51
- #
52
- # @return [Faraday::Response]
53
- def voters(public_key, parameters = {})
54
- mandatory = { publicKey: public_key }
55
-
56
- @client.get('delegates/voters', mandatory.merge(parameters))
57
- end
58
-
59
- # Get the delegate registration fee.
60
- #
61
- # @param address [String]
62
- #
63
- # @return [Faraday::Response]
64
- def fee
65
- @client.get('delegates/fee')
66
- end
67
-
68
- # Get the total forged for the given delegate.
69
- #
70
- # @param generator_public_key [String]
71
- #
72
- # @return [Faraday::Response]
73
- def forged_by_account(generator_public_key)
74
- parameters = { generatorPublicKey: generator_public_key }
75
- @client.get('delegates/forging/getForgedByAccount', parameters)
76
- end
77
-
78
- # Get a list of the next forgers.
79
- #
80
- # @param address [String]
81
- #
82
- # @return [Faraday::Response]
83
- def next_forgers
84
- @client.get('delegates/getNextForgers')
85
- end
86
-
87
- # Get the forging status for the given delegate.
88
- #
89
- # @param public_key [String]
90
- # @param parameters [Hash]
91
- #
92
- # @return [Faraday::Response]
93
- def forging_status(public_key, parameters = {})
94
- mandatory = { publicKey: public_key }
95
-
96
- @client.get('delegates/forging/status', mandatory.merge(parameters))
97
- end
98
- end
99
- end
100
- end
101
- end
102
- end
@@ -1,36 +0,0 @@
1
- require 'arkecosystem/client/api/base'
2
-
3
- module ArkEcosystem
4
- module Client
5
- module API
6
- # Methods for Version 1 of the API
7
- #
8
- # @see https://docs.ark.io/v1.0/reference#api-v1-loader
9
- module One
10
- # Methods for the Loader API
11
- class Loader < Base
12
- # Get the loader status.
13
- #
14
- # @return [Faraday::Response]
15
- def status
16
- @client.get('loader/status')
17
- end
18
-
19
- # Get the loader syncing status.
20
- #
21
- # @return [Faraday::Response]
22
- def sync
23
- @client.get('loader/status/sync')
24
- end
25
-
26
- # Get the loader configuration.
27
- #
28
- # @return [Faraday::Response]
29
- def autoconfigure
30
- @client.get('loader/autoconfigure')
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,41 +0,0 @@
1
- require 'arkecosystem/client/api/base'
2
-
3
- module ArkEcosystem
4
- module Client
5
- module API
6
- # Methods for Version 1 of the API
7
- #
8
- # @see https://docs.ark.io/v1.0/reference#api-v1-peers
9
- module One
10
- # Methods for the Peers API
11
- class Peers < Base
12
- # Get all peers.
13
- #
14
- # @param parameters [Hash]
15
- #
16
- # @return [Faraday::Response]
17
- def all(parameters = {})
18
- @client.get('peers', parameters)
19
- end
20
-
21
- # Get the peer by the given ip and port.
22
- #
23
- # @param ip_addr [String]
24
- # @param port [Integer]
25
- #
26
- # @return [Faraday::Response]
27
- def show(ip_addr, port)
28
- @client.get('peers/get', ip: ip_addr, port: port)
29
- end
30
-
31
- # Get the node version of the peer.
32
- #
33
- # @return [Faraday::Response]
34
- def version
35
- @client.get('peers/version')
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end