cardano_explorer 0.1.2 → 0.1.3

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: 9518bbe4d94623a013859fdb0b49dfc7bfd7a888
4
- data.tar.gz: 8274820e35709cc02218f929351026755be37991
3
+ metadata.gz: e98f116c8f05f9975b3558f0263e4488da9070cc
4
+ data.tar.gz: d2a9b41cb310a8752dc1fc113136a285fdbec697
5
5
  SHA512:
6
- metadata.gz: cf5bac97e4dc6edf0e6b03f2da2d50935ad0a7dd38ab1bf9548f790f21b210686771a6044cce9cd041df70cb47d9c53e38ba21ec991a3c375b9525c18dcb9e77
7
- data.tar.gz: 6edf330e27eae8dbcd840688be1b4f4cc7bbadf0fb8e3a4f500907ad1a917a9af589d9818235b329a8c4a7303a34033c686399c0c2d73386b3310a87aa212622
6
+ metadata.gz: 8db8b5c6b918029147ecda60eb1f30fc4ce35cd5ffbb05daf480464218f5188910077a5010071e3435187643516e9f5af3af77f82700c807623076ca2280d046
7
+ data.tar.gz: f7557a9216ddf8731b6044d575ff040ce1d477ccf0583799a6ffad2140c37d0f8536efaeb023d1439efcadb143791f87418cdc97c4ba307d8fa7f183ce0e3767
@@ -1,3 +1,8 @@
1
+ ## 0.1.3 - 2018/01/24
2
+
3
+ * [FEATURE] Added support for `Transaction.latest`. See #9
4
+
5
+
1
6
  ## 0.1.2 - 2018/01/15
2
7
 
3
8
  * [FEATURE] Added support for `Genesis#summary` and `Genesis#pages_total`
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/philipqnguyen/cardano_explorer.svg?branch=master)](https://travis-ci.org/philipqnguyen/cardano_explorer)
2
+
1
3
  # Cardano Explorer
2
4
 
3
5
  A Ruby gem that wraps the Cardano SL Explorer API. At the moment, you can
@@ -101,6 +103,30 @@ transaction.summary #=>
101
103
  # }
102
104
  ```
103
105
 
106
+ Get the latest transactions.
107
+
108
+ ```ruby
109
+ CardanoExplorer::Transaction.latest #=>
110
+ # [
111
+ # #<CardanoExplorer::Transaction:0x00000001b39808 @hash="d5a71c0a0e59d57d17c2e3466447fdd58e312dd99c0e3d07682b9796ce7aec69">,
112
+ # #<CardanoExplorer::Transaction:0x00000001b397e0 @hash="fb91a2d4943e70cd85c65d036962ba915544a5d963d26f4cd3ea8d9eb55d3040">,
113
+ # ...
114
+ # ]
115
+ ```
116
+
117
+ Each of these is an instance of `CardanoExplorer::Transaction` with its methods.
118
+
119
+ ```ruby
120
+ transactions = CardanoExplorer::Transaction.latest
121
+ transactions.first.summary #=>
122
+ # {
123
+ # "ctsId" => "7012fcaabcbc1be16afdaf754125c93e9216058321d4777c13c251d0cb5067fa",
124
+ # "ctsTxTimeIssued" => 1515795491,
125
+ # "ctsBlockTimeIssued" => 1515795491,
126
+ # ...
127
+ # }
128
+ ```
129
+
104
130
  ### Block
105
131
 
106
132
  Find a summary of a Block.
@@ -3,7 +3,7 @@ module CardanoExplorer
3
3
 
4
4
  private
5
5
 
6
- def endpoint
6
+ def self.endpoint
7
7
  'api/addresses'
8
8
  end
9
9
  end
@@ -11,22 +11,23 @@ module CardanoExplorer
11
11
  end
12
12
 
13
13
  def summary
14
- @summary ||= get "summary/#{hash}"
14
+ @summary ||= self.class.get "summary/#{hash}"
15
15
  @summary.parsed_response['Right']
16
16
  end
17
17
 
18
18
  private
19
19
 
20
- def get(path, options = {})
20
+ def self.get(path, options = {})
21
21
  HTTParty.get "#{root_url}/#{endpoint}/#{path}", query: options
22
22
  end
23
23
 
24
- def root_url
24
+ def self.root_url
25
25
  CardanoExplorer.configuration.root_url
26
26
  end
27
27
 
28
- def endpoint
28
+ def self.endpoint
29
29
  raise NotImplementedError, '#endpoint not defined in child class'
30
30
  end
31
+
31
32
  end
32
33
  end
@@ -3,7 +3,7 @@ module CardanoExplorer
3
3
 
4
4
  private
5
5
 
6
- def endpoint
6
+ def self.endpoint
7
7
  'api/blocks'
8
8
  end
9
9
  end
@@ -8,12 +8,12 @@ module CardanoExplorer
8
8
  def pages_total(options = {})
9
9
  valid_params = %w[pageSize redeemeed]
10
10
  options = options.keep_if { |k| valid_params.include?(k) }
11
- get('address/pages/total', options).parsed_response['Right']
11
+ self.class.get('address/pages/total', options).parsed_response['Right']
12
12
  end
13
13
 
14
14
  private
15
15
 
16
- def endpoint
16
+ def self.endpoint
17
17
  'api/genesis'
18
18
  end
19
19
  end
@@ -1,9 +1,13 @@
1
1
  module CardanoExplorer
2
2
  class Transaction < Base
3
3
 
4
+ def self.latest
5
+ get('last').parsed_response['Right'].map{ |data| new data['cteId'] }
6
+ end
7
+
4
8
  private
5
9
 
6
- def endpoint
10
+ def self.endpoint
7
11
  'api/txs'
8
12
  end
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module CardanoExplorer
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardano_explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-10 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.6.11
119
+ rubygems_version: 2.4.5
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: A Ruby API wrapper to query the Cardano SL Explorer