cardano_explorer 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +31 -0
- data/lib/cardano_explorer.rb +1 -0
- data/lib/cardano_explorer/address.rb +1 -1
- data/lib/cardano_explorer/base.rb +5 -4
- data/lib/cardano_explorer/block.rb +1 -1
- data/lib/cardano_explorer/genesis.rb +20 -0
- data/lib/cardano_explorer/transaction.rb +1 -1
- data/lib/cardano_explorer/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9518bbe4d94623a013859fdb0b49dfc7bfd7a888
|
4
|
+
data.tar.gz: 8274820e35709cc02218f929351026755be37991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf5bac97e4dc6edf0e6b03f2da2d50935ad0a7dd38ab1bf9548f790f21b210686771a6044cce9cd041df70cb47d9c53e38ba21ec991a3c375b9525c18dcb9e77
|
7
|
+
data.tar.gz: 6edf330e27eae8dbcd840688be1b4f4cc7bbadf0fb8e3a4f500907ad1a917a9af589d9818235b329a8c4a7303a34033c686399c0c2d73386b3310a87aa212622
|
data/CHANGELOG.md
CHANGED
@@ -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:
|
data/lib/cardano_explorer.rb
CHANGED
@@ -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
|
-
|
14
|
+
@summary ||= get "summary/#{hash}"
|
15
|
+
@summary.parsed_response['Right']
|
15
16
|
end
|
16
17
|
|
17
18
|
private
|
18
19
|
|
19
|
-
def
|
20
|
-
|
20
|
+
def get(path, options = {})
|
21
|
+
HTTParty.get "#{root_url}/#{endpoint}/#{path}", query: options
|
21
22
|
end
|
22
23
|
|
23
24
|
def root_url
|
@@ -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
|
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.
|
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
|