Class: Coingecko::Global

Inherits:
Object
  • Object
show all
Defined in:
lib/coingecko/global.rb

Constant Summary collapse

@@all_coins_list =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#active_cryptocurrenciesObject

Returns the value of attribute active_cryptocurrencies.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def active_cryptocurrencies
  @active_cryptocurrencies
end

#dataObject

Returns the value of attribute data.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def data
  @data
end

#ended_icosObject

Returns the value of attribute ended_icos.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def ended_icos
  @ended_icos
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def id
  @id
end

#market_cap_change_percentage_24h_usdObject

Returns the value of attribute market_cap_change_percentage_24h_usd.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def market_cap_change_percentage_24h_usd
  @market_cap_change_percentage_24h_usd
end

#market_cap_percentageObject

Returns the value of attribute market_cap_percentage.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def market_cap_percentage
  @market_cap_percentage
end

#marketsObject

Returns the value of attribute markets.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def markets
  @markets
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def name
  @name
end

#ongoing_icosObject

Returns the value of attribute ongoing_icos.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def ongoing_icos
  @ongoing_icos
end

#symbolObject

Returns the value of attribute symbol.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def symbol
  @symbol
end

#total_market_capObject

Returns the value of attribute total_market_cap.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def total_market_cap
  @total_market_cap
end

#total_volumeObject

Returns the value of attribute total_volume.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def total_volume
  @total_volume
end

#upcoming_icosObject

Returns the value of attribute upcoming_icos.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def upcoming_icos
  @upcoming_icos
end

#updated_atObject

Returns the value of attribute updated_at.



2
3
4
# File 'lib/coingecko/global.rb', line 2

def updated_at
  @updated_at
end

Class Method Details

.all_coins_listObject



14
15
16
# File 'lib/coingecko/global.rb', line 14

def self.all_coins_list
  @@all_coins_list
end

.get_all_coins_listObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/coingecko/global.rb', line 18

def self.get_all_coins_list
    @@all_coins_list.clear
    api_get_all = Coingecko::API.get_all_coins
    counter = 0
    while counter < api_get_all.length 
      Coingecko::Global.new.tap do |coin_info| 
        api_get_all[counter].each do |k, v|
            coin_info.send("#{k}=", v)
        end 
       @@all_coins_list << coin_info
       counter += 1
      end
   end 
end

.new_from_globalObject



6
7
8
9
10
11
12
# File 'lib/coingecko/global.rb', line 6

def self.new_from_global
   Coingecko::Global.new.tap do |global_attributes| 
    Coingecko::API.get_global_info.each do |k,v|
         global_attributes.send("#{k}=", v)
      end 
    end 
end