Module: Mintpal
- Defined in:
- lib/mintpal_ruby.rb
Defined Under Namespace
Classes: CoinSummary
Constant Summary collapse
- VERSION =
'0.0.10'- API_URL =
'https://api.mintpal.com/market'- VALID_EXCHANGES =
[ :BTC, :LTC ]
- VALID_COINS =
[ :AUR, :BC, :BTCS, :CAGE, :CTM, :DGB, :DOGE, :DOPE, :DRK, :ECC, :EMO, :FLT, :HVC, :KARM, :KDC, :LTC, :MINT, :MRC, :MRS, :MZC, :OLY, :PANDA, :PENG, :PND, :POT, :Q2C, :RBBT, :RIC, :SAT, :SPA, :SUN, :TAK, :TES, :TOP, :UNO, :USDE, :UTC, :ZED, :ZEIT ]
Class Method Summary collapse
- .market_chart_data ⇒ Object
- .market_orders ⇒ Object
- .market_stats(coin, exchange = :BTC) ⇒ Object
- .market_summary(exchange = nil) ⇒ Object
- .market_trades ⇒ Object
Class Method Details
.market_chart_data ⇒ Object
51 52 53 |
# File 'lib/mintpal_ruby.rb', line 51 def market_chart_data # end |
.market_orders ⇒ Object
47 48 49 |
# File 'lib/mintpal_ruby.rb', line 47 def market_orders # end |
.market_stats(coin, exchange = :BTC) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/mintpal_ruby.rb', line 33 def market_stats(coin, exchange=:BTC) exchange = exchange.to_sym.upcase raise ArgumentError, "You must specify a valid exchange: #{VALID_EXCHANGES}!" if !VALID_EXCHANGES.include?(exchange) coin = coin.to_sym.upcase raise ArgumentError, "You must specify a valid coin: #{VALID_COINS}!" if !VALID_COINS.include?(coin) response = JSON.parse(Mechanize.new.get("#{API_URL}/stats/#{coin}/#{exchange}")) CoinSummary.new(response.first) end |
.market_summary(exchange = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mintpal_ruby.rb', line 22 def market_summary(exchange=nil) if exchange.is_a?(Symbol) || exchange.is_a?(String) exchange = exchange.to_sym.upcase raise ArgumentError, "You must specify a valid exchange: #{VALID_EXCHANGES}!" if !VALID_EXCHANGES.include?(exchange) response = JSON.parse(Mechanize.new.get("#{API_URL}/summary/#{exchange}").body) else response = JSON.parse(Mechanize.new.get("#{API_URL}/summary").body) end response.map {|c| CoinSummary.new(c) } end |
.market_trades ⇒ Object
43 44 45 |
# File 'lib/mintpal_ruby.rb', line 43 def market_trades # end |