cardano_explorer 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 37e15cc6db2c6c92806377105bc34bb0a16cb334
4
- data.tar.gz: f0f227756c77307b4ce1f3da91393aa008665537
3
+ metadata.gz: 9518bbe4d94623a013859fdb0b49dfc7bfd7a888
4
+ data.tar.gz: 8274820e35709cc02218f929351026755be37991
5
5
  SHA512:
6
- metadata.gz: 117da5f4240ce42cf108f7ef8a563ab618f728a75d7c5eb4dbd2ebae5bb4f20ac893b1a7d6da53b820fa973ac2850449dae389f03f3fd576037a8b937d9f0cf5
7
- data.tar.gz: ef744ce03536924843534cc05abb192c78ef6bb2abe40e4d51d60282a4c05a153774494dd5f8f1f810b9ea104987005ff76774cab035ba08fe3076e5aedc2e69
6
+ metadata.gz: cf5bac97e4dc6edf0e6b03f2da2d50935ad0a7dd38ab1bf9548f790f21b210686771a6044cce9cd041df70cb47d9c53e38ba21ec991a3c375b9525c18dcb9e77
7
+ data.tar.gz: 6edf330e27eae8dbcd840688be1b4f4cc7bbadf0fb8e3a4f500907ad1a917a9af589d9818235b329a8c4a7303a34033c686399c0c2d73386b3310a87aa212622
@@ -1,3 +1,13 @@
1
+ ## 0.1.2 - 2018/01/15
2
+
3
+ * [FEATURE] Added support for `Genesis#summary` and `Genesis#pages_total`
4
+
5
+
6
+ ## 0.1.1 - 2018/01/12
7
+
8
+ * [BUGFIX] Include lib directory in required files for gem.
9
+
10
+
1
11
  ## 0.1.0 - 2018/01/12
2
12
 
3
13
  * [FEATURE] Added support for retrieving summary of Address, Transaction,
data/README.md CHANGED
@@ -131,6 +131,37 @@ block.summary #=>
131
131
  # }
132
132
  ```
133
133
 
134
+ ### Genesis
135
+
136
+ Get a summary of the genesis block
137
+
138
+ ```ruby
139
+ genesis = CardanoExplorer::Genesis.new
140
+ genesis.summary #=>
141
+ # {
142
+ # 'cgsNumTotal' => 14505,
143
+ # 'cgsNumRedeemed' => 12535,
144
+ # 'cgsNumNotRedeemed' => 1970,
145
+ # 'cgsRedeemedAmountTotal' => {
146
+ # 'getCoin' => '29083491488000000'
147
+ # },
148
+ # 'cgsNonRedeemedAmountTotal' => {
149
+ # 'getCoin' => '2028993257000000'
150
+ # }
151
+ ```
152
+
153
+ Get the total pages of the genesis block
154
+
155
+ ```ruby
156
+ genesis = CardanoExplorer::Genesis.new
157
+ genesis.pages_total #=> 1451
158
+ ```
159
+ ## Notes
160
+
161
+ **Denominations**: The quantity of ADA coins is in denominations of Lovelaces.
162
+ 1 ADA == 1,000,000 Lovelaces. Learn more about denominations here:
163
+ https://cardanodocs.com/cardano/monetary-policy/#treasury-and-fees
164
+
134
165
  ## Configuring
135
166
 
136
167
  You can change the root url like so:
@@ -5,6 +5,7 @@ require 'cardano_explorer/base'
5
5
  require 'cardano_explorer/address'
6
6
  require 'cardano_explorer/block'
7
7
  require 'cardano_explorer/transaction'
8
+ require 'cardano_explorer/genesis'
8
9
 
9
10
  module CardanoExplorer
10
11
  def self.configuration
@@ -4,7 +4,7 @@ module CardanoExplorer
4
4
  private
5
5
 
6
6
  def endpoint
7
- 'api/addresses/summary'
7
+ 'api/addresses'
8
8
  end
9
9
  end
10
10
  end
@@ -6,18 +6,19 @@ module CardanoExplorer
6
6
  new hash
7
7
  end
8
8
 
9
- def initialize(hash)
9
+ def initialize(hash = nil)
10
10
  @hash = hash
11
11
  end
12
12
 
13
13
  def summary
14
- response.parsed_response['Right']
14
+ @summary ||= get "summary/#{hash}"
15
+ @summary.parsed_response['Right']
15
16
  end
16
17
 
17
18
  private
18
19
 
19
- def response
20
- @response ||= HTTParty.get "#{root_url}/#{endpoint}/#{hash}"
20
+ def get(path, options = {})
21
+ HTTParty.get "#{root_url}/#{endpoint}/#{path}", query: options
21
22
  end
22
23
 
23
24
  def root_url
@@ -4,7 +4,7 @@ module CardanoExplorer
4
4
  private
5
5
 
6
6
  def endpoint
7
- 'api/blocks/summary'
7
+ 'api/blocks'
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,20 @@
1
+ module CardanoExplorer
2
+ class Genesis < Base
3
+
4
+ def self.find
5
+ raise NoMethodError
6
+ end
7
+
8
+ def pages_total(options = {})
9
+ valid_params = %w[pageSize redeemeed]
10
+ options = options.keep_if { |k| valid_params.include?(k) }
11
+ get('address/pages/total', options).parsed_response['Right']
12
+ end
13
+
14
+ private
15
+
16
+ def endpoint
17
+ 'api/genesis'
18
+ end
19
+ end
20
+ end
@@ -4,7 +4,7 @@ module CardanoExplorer
4
4
  private
5
5
 
6
6
  def endpoint
7
- 'api/txs/summary'
7
+ 'api/txs'
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module CardanoExplorer
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardano_explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Nguyen
@@ -93,6 +93,7 @@ files:
93
93
  - lib/cardano_explorer/base.rb
94
94
  - lib/cardano_explorer/block.rb
95
95
  - lib/cardano_explorer/configuration.rb
96
+ - lib/cardano_explorer/genesis.rb
96
97
  - lib/cardano_explorer/transaction.rb
97
98
  - lib/cardano_explorer/version.rb
98
99
  homepage: https://github.com/philipqnguyen/cardano_explorer