cardano_explorer 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: ac691ba137628f992820df845f77196f17bf0241
4
- data.tar.gz: 8690df2bf12eef2e63ed7ad0403a92f221bbc203
3
+ metadata.gz: 37e15cc6db2c6c92806377105bc34bb0a16cb334
4
+ data.tar.gz: f0f227756c77307b4ce1f3da91393aa008665537
5
5
  SHA512:
6
- metadata.gz: b4b3fab3459b65f548a7bf384e2f9cff998aa3e082a7f8268617bbda431574ce1350fdf65ce9cb6e4e4aafbc0dd9d0e53feaf98a755e00a841d7a6bc8c97031f
7
- data.tar.gz: 0dfe3328e4b5bc4a087f5b61c6d876980eca6e0e3509a0e6b7a8f443f5fe24db8561e9368f7961e502f72ca8fd87acc0dbf046d2a34723ab94ad17a7f548fba6
6
+ metadata.gz: 117da5f4240ce42cf108f7ef8a563ab618f728a75d7c5eb4dbd2ebae5bb4f20ac893b1a7d6da53b820fa973ac2850449dae389f03f3fd576037a8b937d9f0cf5
7
+ data.tar.gz: ef744ce03536924843534cc05abb192c78ef6bb2abe40e4d51d60282a4c05a153774494dd5f8f1f810b9ea104987005ff76774cab035ba08fe3076e5aedc2e69
@@ -0,0 +1,4 @@
1
+ ## 0.1.0 - 2018/01/12
2
+
3
+ * [FEATURE] Added support for retrieving summary of Address, Transaction,
4
+ and Block.
data/README.md CHANGED
@@ -55,8 +55,8 @@ address.summary #=>
55
55
  Find a summary of a Transaction.
56
56
 
57
57
  ```ruby
58
- transaction_id = 'Ae2tdPwUPEZKmwoy3AU3cXb5Chnasj6mvVNxV1H11997q3VW5ihbSfQwGpm'
59
- transaction = CardanoExplorer::transaction.find transaction_id
58
+ transaction_id = '7012fcaabcbc1be16afdaf754125c93e9216058321d4777c13c251d0cb5067fa'
59
+ transaction = CardanoExplorer::Transaction.find transaction_id
60
60
  transaction.summary #=>
61
61
  # {
62
62
  # "ctsId" => "7012fcaabcbc1be16afdaf754125c93e9216058321d4777c13c251d0cb5067fa",
@@ -0,0 +1,17 @@
1
+ require 'httparty'
2
+ require 'cardano_explorer/version'
3
+ require 'cardano_explorer/configuration'
4
+ require 'cardano_explorer/base'
5
+ require 'cardano_explorer/address'
6
+ require 'cardano_explorer/block'
7
+ require 'cardano_explorer/transaction'
8
+
9
+ module CardanoExplorer
10
+ def self.configuration
11
+ @configuration ||= Configuration.new
12
+ end
13
+
14
+ def self.configure
15
+ yield configuration if block_given?
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ module CardanoExplorer
2
+ class Address < Base
3
+
4
+ private
5
+
6
+ def endpoint
7
+ 'api/addresses/summary'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,31 @@
1
+ module CardanoExplorer
2
+ class Base
3
+ attr_reader :hash
4
+
5
+ def self.find(hash)
6
+ new hash
7
+ end
8
+
9
+ def initialize(hash)
10
+ @hash = hash
11
+ end
12
+
13
+ def summary
14
+ response.parsed_response['Right']
15
+ end
16
+
17
+ private
18
+
19
+ def response
20
+ @response ||= HTTParty.get "#{root_url}/#{endpoint}/#{hash}"
21
+ end
22
+
23
+ def root_url
24
+ CardanoExplorer.configuration.root_url
25
+ end
26
+
27
+ def endpoint
28
+ raise NotImplementedError, '#endpoint not defined in child class'
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ module CardanoExplorer
2
+ class Block < Base
3
+
4
+ private
5
+
6
+ def endpoint
7
+ 'api/blocks/summary'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module CardanoExplorer
2
+ class Configuration
3
+ attr_accessor :root_url
4
+
5
+ def initialize
6
+ @root_url = 'https://cardanoexplorer.com'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module CardanoExplorer
2
+ class Transaction < Base
3
+
4
+ private
5
+
6
+ def endpoint
7
+ 'api/txs/summary'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module CardanoExplorer
2
+ VERSION = '0.1.1'
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Nguyen
@@ -86,8 +86,15 @@ executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
- - LICENSE.txt
89
+ - CHANGELOG.md
90
90
  - README.md
91
+ - lib/cardano_explorer.rb
92
+ - lib/cardano_explorer/address.rb
93
+ - lib/cardano_explorer/base.rb
94
+ - lib/cardano_explorer/block.rb
95
+ - lib/cardano_explorer/configuration.rb
96
+ - lib/cardano_explorer/transaction.rb
97
+ - lib/cardano_explorer/version.rb
91
98
  homepage: https://github.com/philipqnguyen/cardano_explorer
92
99
  licenses:
93
100
  - MIT
@@ -1,19 +0,0 @@
1
- Copyright (c) 2018 Philip Q Nguyen
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.