bitcoin_value 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/bitcoin_value.rb +22 -0
  3. metadata +44 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MGMyZTg1OTYzZjA1Y2RhNWQyYTg5N2Q2ZjJmOTlmZGM5Mjc2YzRiOA==
5
+ data.tar.gz: !binary |-
6
+ NTM1OTZjOWVhYmYxMGNkM2VlNzlhNzQ3OTQyMDMzNjc3M2VlMTEzYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDRmY2I2Yzk1MzMzZTZmZDFlYmFkNDM0NmI0ODNkMDYxZTVmMTI4M2VhMWVk
10
+ NjgzOTUzNTlhOTlhZTBmOWQ3NDZhMTdlZWNlODZiNTllNDRlNTNhODUwNDhk
11
+ MmM5YmQ0MmE0MTRiNzkzMWRkYjFiY2M0ZWVhYjViNDllODU3MDU=
12
+ data.tar.gz: !binary |-
13
+ MGIxNTJkNTFiYzllMzkzZTdlNjIwNTM0OGQ4OThiNjAzYzg3MmJiNzI4MThm
14
+ ZDcyMDM0ZGFmOWEzNGRjMTMxZjk1ZjE3MWYyYjc4MjBlYmJmNjMzMTNlNzZj
15
+ MTM3ZTA4ZjUwYzU5MzM1NjVlZDU3OWZhOTdlMmE0YzU5OWE0ZWM=
@@ -0,0 +1,22 @@
1
+ require 'mechanize'
2
+ require 'json'
3
+
4
+ module BitcoinValue
5
+ class << self
6
+
7
+ VERSION = '0.0.10'
8
+
9
+ API_URL = 'https://api.bitcoinaverage.com/ticker'
10
+ VALID_FIATS = [
11
+ :AUD, :BRL, :CAD, :CHF, :CNY, :EUR, :GBP, :HKD, :ILS, :JPY,
12
+ :NOK, :NZD, :PLN, :RUB, :SEK, :SGD, :TRY, :USD, :ZAR
13
+ ]
14
+
15
+ def method_missing(meth, *args, &block)
16
+ currency = meth.upcase.to_sym
17
+ raise ArgumentError, "Cannot fetch data for #{currency}, as it is not offered by the API!" if !VALID_FIATS.include?(currency)
18
+ JSON.parse(Mechanize.new.get("#{API_URL}/#{currency}").body)['24h_avg']
19
+ end
20
+
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitcoin_value
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.10
5
+ platform: ruby
6
+ authors:
7
+ - Ethan Barron
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Provides a wrapper around Rest APIs to fetch the current BTC/Fiat value.
14
+ email: inkybro@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/bitcoin_value.rb
20
+ homepage: http://github.com/Inkybro/bitcoin_value
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: Simple gem to fetch current BTC/Fiat value.
44
+ test_files: []