Class: Coinmarketcal::Coin

Inherits:
Object
  • Object
show all
Defined in:
lib/coinmarketcal/coin.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Coin

Returns a new instance of Coin.



5
6
7
8
9
# File 'lib/coinmarketcal/coin.rb', line 5

def initialize(attrs = {})
  @id = attrs['id']
  @name = attrs['name']
  @symbol = attrs['symbol']
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/coinmarketcal/coin.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/coinmarketcal/coin.rb', line 3

def name
  @name
end

#symbolObject (readonly)

Returns the value of attribute symbol.



3
4
5
# File 'lib/coinmarketcal/coin.rb', line 3

def symbol
  @symbol
end

Class Method Details

.allObject



11
12
13
# File 'lib/coinmarketcal/coin.rb', line 11

def self.all
  client.get('v1/coins').map{|data| new(data) }
end