Class: Beaconcha::Client
- Inherits:
-
Object
- Object
- Beaconcha::Client
- Defined in:
- lib/beaconcha/client.rb
Class Method Summary collapse
- .get(path:, query: {}) ⇒ Object
- .get_without_version(path:, query: {}) ⇒ Object
- .post(path:, parameters:) ⇒ Object
Instance Method Summary collapse
- #epoch ⇒ Object
- #eth_store ⇒ Object
- #execution ⇒ Object
-
#initialize(api_key: nil, uri_base: nil) ⇒ Client
constructor
A new instance of Client.
- #misc ⇒ Object
- #rocketpool ⇒ Object
- #slot ⇒ Object
- #sync_committee ⇒ Object
- #validator ⇒ Object
Constructor Details
#initialize(api_key: nil, uri_base: nil) ⇒ Client
Returns a new instance of Client.
3 4 5 6 |
# File 'lib/beaconcha/client.rb', line 3 def initialize(api_key: nil, uri_base: nil) Beaconcha.configuration.api_key = api_key if api_key Beaconcha.configuration.uri_base = uri_base if uri_base end |
Class Method Details
.get(path:, query: {}) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/beaconcha/client.rb', line 40 def self.get(path:, query: {}) HTTParty.get( uri(path: path), query: query&.compact, headers: headers ) end |
.get_without_version(path:, query: {}) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/beaconcha/client.rb', line 48 def self.get_without_version(path:, query: {}) HTTParty.get( uri_without_version(path: path), query: query&.compact, headers: headers ) end |
.post(path:, parameters:) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/beaconcha/client.rb', line 56 def self.post(path:, parameters:) HTTParty.post( uri(path: path), headers: headers, body: parameters&.compact&.to_json ) end |
Instance Method Details
#epoch ⇒ Object
8 9 10 |
# File 'lib/beaconcha/client.rb', line 8 def epoch @epoch ||= Beaconcha::Epoch.new end |
#eth_store ⇒ Object
28 29 30 |
# File 'lib/beaconcha/client.rb', line 28 def eth_store @eth_store ||= Beaconcha::EthStore.new end |
#execution ⇒ Object
24 25 26 |
# File 'lib/beaconcha/client.rb', line 24 def execution @execution ||= Beaconcha::Execution.new end |
#misc ⇒ Object
32 33 34 |
# File 'lib/beaconcha/client.rb', line 32 def misc @misc ||= Beaconcha::Misc.new end |
#rocketpool ⇒ Object
36 37 38 |
# File 'lib/beaconcha/client.rb', line 36 def rocketpool @rocketpool ||= Beaconcha::Rocketpool.new end |
#slot ⇒ Object
12 13 14 |
# File 'lib/beaconcha/client.rb', line 12 def slot @slot ||= Beaconcha::Slot.new end |
#sync_committee ⇒ Object
20 21 22 |
# File 'lib/beaconcha/client.rb', line 20 def sync_committee @sync_committee ||= Beaconcha::SyncCommittee.new end |