cryptocoincharts_ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/cryptocoincharts_ruby.rb +66 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDZmODA2YTYwMzFkNzI3ZGVhNjRkZWI2YTRjNjRmMjFmNDhmMmVlYg==
5
+ data.tar.gz: !binary |-
6
+ N2U5MDU2ZmI1ZWRmYmEyYmIxOWUwZWZhZWQ0YzQxMGNkM2UzZDQzNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTFkZDg1M2JmODZmZWVjYWRiN2QxZmJiZTc5NjE4ODhiNGMyZDMzYjBlYzgw
10
+ YzRjOTZhOGU2ZmZlZTUxYmI3MzQzZGUwMGQzY2Q3ZTkyNThjNjk1NDQ2OTFj
11
+ NjljZTRjMjRkYWRlNGU1YWZiZjEyZTIwNmJjZDlhZWRmOGNhNGE=
12
+ data.tar.gz: !binary |-
13
+ MjM5NDFkNjg5MDZhNDE5OWZmY2YwZTlhYTcwNzU1ZmE2YjFhZGEyOTQzOTkx
14
+ MmI3MzAxYjZmYzFjN2VlZDBhN2JiZTc3MGMzODQ1YjMwNzY5NmIzNWMxY2U1
15
+ Nzk5YTA0NzAzYjNmNTQ3N2E2ZWEwODZlZTAzNzY3MTA3YzRlNGQ=
@@ -0,0 +1,66 @@
1
+ require 'mechanize'
2
+ require 'json'
3
+ require 'hashie'
4
+
5
+ module CryptoCoinCharts
6
+ class << self
7
+
8
+ VERSION = '0.0.1'
9
+
10
+ API_URL = 'http://www.cryptocoincharts.info/v2/api'
11
+ VALID_PAIRS = [
12
+ :"42_btc", :"888_btc", :aaa_btc, :adt_btc, :air_btc, :alb_btc, :alf_btc, :alp_btc,
13
+ :amc_btc, :anc_btc, :ant_btc, :aph_btc, :app_btc, :arg_btc, :asc_btc, :asr_btc, :atp_btc, :aur_btc,
14
+ :bat_btc, :bc_btc, :bcx_btc, :bea_btc, :bec_btc, :bela_btc, :beli_btc, :ben_btc, :bet_btc, :bfc_btc,
15
+ :bil_btc, :blc_btc, :blk_btc, :boc_btc, :bqc_btc, :btb_btc, :btc_btc, :btcs_btc, :bte_btc, :btg_btc,
16
+ :btq_btc, :btr_btc, :buk_btc, :c2_btc, :cach_btc, :cage_btc, :cap_btc, :cash_btc, :cat_btc, :cdc_btc,
17
+ :cent_btc, :cga_btc, :cgb_btc, :cin_btc, :clr_btc, :cmc_btc, :cnc_btc, :cnote_btc, :cny_btc, :coin_btc,
18
+ :col_btc, :con_btc, :corg_btc, :cpr_btc, :crc_btc, :csc_btc, :ctm_btc, :dbl_btc, :dem_btc, :dgb_btc,
19
+ :dgc_btc, :diem_btc, :dime_btc, :dmd_btc, :doge_btc, :drk_btc, :dsc_btc, :dtc_btc, :duck_btc, :dvc_btc,
20
+ :eac_btc, :ebt_btc, :efl_btc, :elc_btc, :elp_btc, :emc2_btc, :emd_btc, :emo_btc, :etok_btc, :eur_btc,
21
+ :exc_btc, :exe_btc, :ezc_btc, :ffc_btc, :flap_btc, :flo_btc, :flt_btc, :fox_btc, :frc_btc, :fre_btc,
22
+ :frk_btc, :frq_btc, :fry_btc, :fsc_btc, :fst_btc, :ftc_btc, :fz_btc, :gac_btc, :gdc_btc, :ghc_btc,
23
+ :gil_btc, :glb_btc, :glc_btc, :gld_btc, :glx_btc, :gme_btc, :gns_btc, :gpu_btc, :gpuc_btc, :gra_btc,
24
+ :grc_btc, :grump_btc, :grw_btc, :hbn_btc, :hic_btc, :hiro_btc, :hkc_btc, :hpc_btc, :huc_btc, :hvc_btc,
25
+ :hyc_btc, :i0c_btc, :icn_btc, :ifc_btc, :ipc_btc, :iqd_btc, :isk_btc, :ixc_btc, :jkc_btc, :karm_btc,
26
+ :kdc_btc, :kgc_btc, :krn_btc, :lbw_btc, :ldc_btc, :leaf_btc, :lgbt_btc, :lk7_btc, :lky_btc, :lot_btc,
27
+ :love_btc, :ltc_btc, :lyc_btc, :max_btc, :mcx_btc, :mec_btc, :med_btc, :mem_btc, :meow_btc, :mim_btc,
28
+ :mint_btc, :mmc_btc, :mnc_btc, :moon_btc, :mrc_btc, :mrs_btc, :msc_btc, :mst_btc, :mtc_btc, :mts_btc,
29
+ :mvc_btc, :mxb_btc, :myr_btc, :mzc_btc, :nan_btc, :nbl_btc, :nec_btc, :net_btc, :nib_btc, :nka_btc,
30
+ :nmc_btc, :nobl_btc, :nok_btc, :nrb_btc, :nrs_btc, :nvc_btc, :nwc_btc, :nxt_btc, :nyan_btc, :nym_btc,
31
+ :ogc_btc, :oly_btc, :orb_btc, :osc_btc, :pand_btc, :panda_btc, :pawn_btc, :pcc_btc, :peng_btc, :pho_btc,
32
+ :phs_btc, :pi_btc, :pig_btc, :plnc_btc, :pmc_btc, :points_btc, :pop_btc, :pot_btc, :ppc_btc, :ppl_btc,
33
+ :prc_btc, :prt_btc, :pt_btc, :pts_btc, :pwc_btc, :pxc_btc, :pxl_btc, :pyc_btc, :q2c_btc, :qqc_btc,
34
+ :qrk_btc, :rch_btc, :rdd_btc, :rec_btc, :red_btc, :redd_btc, :ric_btc, :rpc_btc, :rpd_btc, :rqc_btc,
35
+ :ruby_btc, :rur_btc, :ryc_btc, :sat_btc, :sav_btc, :sbc_btc, :sc_btc, :skc_btc, :sll_btc, :sloth_btc,
36
+ :smc_btc, :soc_btc, :spa_btc, :spt_btc, :src_btc, :stc_btc, :str_btc, :sun_btc, :svc_btc, :sxc_btc,
37
+ :syn_btc, :tag_btc, :tak_btc, :tea_btc, :tek_btc, :tes_btc, :tgc_btc, :tips_btc, :tix_btc, :top_btc,
38
+ :trc_btc, :trl_btc, :ttc_btc, :ufc_btc, :uni_btc, :uno_btc, :usd_btc, :usde_btc, :utc_btc, :vel_btc,
39
+ :ven_btc, :vtc_btc, :wdc_btc, :wiki_btc, :wolf_btc, :xcp_btc, :xiv_btc, :xjo_btc, :xnc_btc, :xpm_btc,
40
+ :xrp_btc, :xsv_btc, :yac_btc, :yang_btc, :ybc_btc, :yin_btc, :zcc_btc, :zed_btc, :zeit_btc, :zet_btc
41
+ ]
42
+
43
+ def list_coins
44
+ coins = JSON.parse(Mechanize.new.get("#{API_URL}/listCoins").body)
45
+ coins.map {|c| Hashie::Mash.new(c) }
46
+ end
47
+
48
+ def coin_info(pair)
49
+ raise ArgumentError, "You must supply a valid coin pair!" if !VALID_PAIRS.include?(pair.to_sym)
50
+ #Hashie::Mash.new(JSON.parse(Mechanize.new.get("#{API_URL}/tradingPair/#{pair.to_s}").body))
51
+ coins_info(pair)[0]
52
+ end
53
+
54
+ def coins_info(*pairs)
55
+ pairs.map! {|p| p.to_sym }
56
+ pairs.each do |pair|
57
+ raise ArgumentError, "You must supply only valid coin pairs!" if !VALID_PAIRS.include?(pair)
58
+ end
59
+ coins = JSON.parse(Mechanize.new.post("#{API_URL}/tradingPairs", {
60
+ :pairs => pairs.join(',')
61
+ }).body)
62
+ coins.map {|c| Hashie::Mash.new(c) }
63
+ end
64
+
65
+ end
66
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cryptocoincharts_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ethan Barron
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Provides a wrapper for Cryptocoincharts.info API.
14
+ email: inkybro@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/cryptocoincharts_ruby.rb
20
+ homepage: http://rubygems.org/gems/cryptocoincharts_ruby
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.2.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A gem providing a wrapper around the Cryptocoincharts.info API.
44
+ test_files: []