class CardanoExplorer::Base

Attributes

hash[R]

Public Class Methods

find(hash) click to toggle source
# File lib/cardano_explorer/base.rb, line 5
def self.find(hash)
  new hash
end
new(hash = nil) click to toggle source
# File lib/cardano_explorer/base.rb, line 9
def initialize(hash = nil)
  @hash = hash
end

Private Class Methods

endpoint() click to toggle source
# File lib/cardano_explorer/base.rb, line 28
def self.endpoint
  raise NotImplementedError, '#endpoint not defined in child class'
end
get(path, options = {}) click to toggle source
# File lib/cardano_explorer/base.rb, line 20
def self.get(path, options = {})
  HTTParty.get "#{root_url}/#{endpoint}/#{path}", query: options
end
root_url() click to toggle source
# File lib/cardano_explorer/base.rb, line 24
def self.root_url
  CardanoExplorer.configuration.root_url
end

Public Instance Methods

summary() click to toggle source
# File lib/cardano_explorer/base.rb, line 13
def summary
  @summary ||= self.class.get "summary/#{hash}"
  @summary.parsed_response['Right']
end