Class: CoinMarketCap::Coin

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, mcap, price, change, url) ⇒ Coin

Returns a new instance of Coin.



4
5
6
7
8
9
10
# File 'lib/coin_market_cap/coin.rb', line 4

def initialize(name, mcap, price, change, url)
  @name = name
  @mcap = mcap
  @price = price
  @change = change
  @url = url
end

Instance Attribute Details

#changeObject

Returns the value of attribute change.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def change
  @change
end

#cir_supplyObject

Returns the value of attribute cir_supply.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def cir_supply
  @cir_supply
end

#max_supplyObject

Returns the value of attribute max_supply.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def max_supply
  @max_supply
end

#mcapObject

Returns the value of attribute mcap.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def mcap
  @mcap
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def name
  @name
end

#priceObject

Returns the value of attribute price.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def price
  @price
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def url
  @url
end

#volumeObject

Returns the value of attribute volume.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def volume
  @volume
end

#websiteObject

Returns the value of attribute website.



2
3
4
# File 'lib/coin_market_cap/coin.rb', line 2

def website
  @website
end

Class Method Details

.add_attributes(coin, attributes) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/coin_market_cap/coin.rb', line 12

def self.add_attributes(coin, attributes)
  coin.volume = attributes[:volume]
  coin.cir_supply = attributes[:cir_supply]
  coin.max_supply = attributes[:max_supply]
  coin.website = attributes[:website]
  coin
end