Class: Coinbase::AddressReputation
- Inherits:
-
Object
- Object
- Coinbase::AddressReputation
- Defined in:
- lib/coinbase/address_reputation.rb
Overview
A representation of the reputation of a blockchain address.
Defined Under Namespace
Classes: Metadata
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model) ⇒ AddressReputation
constructor
A new instance of AddressReputation.
- #inspect ⇒ Object
- #metadata ⇒ Object
- #risky? ⇒ Boolean
- #score ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(model) ⇒ AddressReputation
Returns a new instance of AddressReputation.
37 38 39 40 41 |
# File 'lib/coinbase/address_reputation.rb', line 37 def initialize(model) raise ArgumentError, 'must be an AddressReputation object' unless model.is_a?(Coinbase::Client::AddressReputation) @model = model end |
Class Method Details
.fetch(address_id:, network: Coinbase.default_network) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/coinbase/address_reputation.rb', line 20 def fetch(address_id:, network: Coinbase.default_network) network = Coinbase::Network.from_id(network) model = Coinbase.call_api do reputation_api.get_address_reputation(network.normalized_id, address_id) end new(model) end |
Instance Method Details
#inspect ⇒ Object
63 64 65 |
# File 'lib/coinbase/address_reputation.rb', line 63 def inspect to_s end |
#metadata ⇒ Object
47 48 49 |
# File 'lib/coinbase/address_reputation.rb', line 47 def @metadata ||= Metadata.new(**@model.) end |
#risky? ⇒ Boolean
51 52 53 |
# File 'lib/coinbase/address_reputation.rb', line 51 def risky? score.negative? end |
#score ⇒ Object
43 44 45 |
# File 'lib/coinbase/address_reputation.rb', line 43 def score @model.score end |
#to_s ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/coinbase/address_reputation.rb', line 55 def to_s Coinbase.pretty_print_object( self.class, score: score, **.to_h ) end |