rubitcoin 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -1
- data/bin/rubitcoin +9 -0
- data/lib/rubitcoin/version.rb +1 -1
- data/lib/rubitcoin.rb +6 -3
- data/rubitcoin.gemspec +3 -1
- data/test/minitest_helper.rb +1 -1
- data/test/{test_Rubitcoin.rb → test_rubitcoin.rb} +4 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c70a7f466c5ad1e9e5cab985dc79c46321b906
|
4
|
+
data.tar.gz: 1e2b8f02ca31a1646e7a078b614edeae8ad64e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d3d5558ec4862bae302fc94947206e84e8f83a9231f1dfe0ad064332e9c5108da6721a012aa30293938a4cc19d0bf773feb1fded04f8971d8aaeca32ffa2350
|
7
|
+
data.tar.gz: 0cbd5b9c30c008096ebc24366e667c5fd5c8e22cafef60c3d10983d16e557d6109859baf76efc982386a4eb016f272c34cea4a1973d48e4b12148b0c37b48f6d
|
data/README.md
CHANGED
@@ -23,12 +23,26 @@ Or install it yourself as:
|
|
23
23
|
```rb
|
24
24
|
require 'rubitcoin'
|
25
25
|
|
26
|
+
# USD is default currency.
|
26
27
|
Rubitcoin.fetch
|
27
|
-
#=> {:high=>
|
28
|
+
#=> {:high=>220.0, :low=>196.0, :avg=>208.0, :vol=>4663985.33289, :vol_cur=>22407.9454, :last=>210.01, :buy=>210.01, :sell=>209.925, :updated=>1421464571.0}
|
28
29
|
|
29
30
|
Rubitcoin.high
|
30
31
|
#=> 223.15
|
31
32
|
|
33
|
+
Rubitcoin.last
|
34
|
+
#=> 222.15
|
35
|
+
|
36
|
+
Rubitcoin.fetch(:rur)
|
37
|
+
#=> {:high=>15120.05664, :low=>13800.0, :avg=>14460.02832, :vol=>5735982.89998, :vol_cur=>394.4822, :last=>14600.0, :buy=>14640.0, :sell=>14445.4708, :updated=>1421464501.0}
|
38
|
+
|
39
|
+
Rubitcoin.high(:rur)
|
40
|
+
#=> 15120.05664
|
41
|
+
|
42
|
+
# Rubitcoin.call is alias to Rubitcoin.fetch
|
43
|
+
Rubitcoin.(:eur)
|
44
|
+
#=> {:high=>193.09383, :low=>173.13251, :avg=>183.11317, :vol=>21602.3727, :vol_cur=>117.53392, :last=>184.96301, :buy=>184.96301, :sell=>183.09709, :updated=>1421465049.0}
|
45
|
+
....
|
32
46
|
```
|
33
47
|
## Contributing
|
34
48
|
|
data/bin/rubitcoin
ADDED
data/lib/rubitcoin/version.rb
CHANGED
data/lib/rubitcoin.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
require 'json'
|
3
|
-
|
3
|
+
|
4
4
|
class Rubitcoin
|
5
|
-
END_POINT
|
5
|
+
END_POINT = "https://btc-e.com/api/3/ticker"
|
6
|
+
ATTRIBUTES = %w|high low avg vol vol_cur last buy sell updated|
|
7
|
+
|
6
8
|
class << self
|
7
9
|
def fetch(currency=:usd)
|
8
10
|
Hash.[] raw_fetch(currency).map { |k, v| [k.to_sym, v.to_f] }
|
9
11
|
end
|
12
|
+
alias call fetch
|
10
13
|
|
11
|
-
|
14
|
+
ATTRIBUTES.each do |mth|
|
12
15
|
define_method(mth) do |currency=:usd|
|
13
16
|
raw_fetch(currency)[mth].to_f
|
14
17
|
end
|
data/rubitcoin.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'rubitcoin/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rubitcoin"
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_dependency "awesome_print"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
spec.add_development_dependency "minitest"
|
data/test/minitest_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubitcoin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gogotanaka
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: awesome_print
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,7 +69,8 @@ dependencies:
|
|
55
69
|
description: " Fetch bitcoin ticker simple."
|
56
70
|
email:
|
57
71
|
- mail@tanakakazuki.com
|
58
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- rubitcoin
|
59
74
|
extensions: []
|
60
75
|
extra_rdoc_files: []
|
61
76
|
files:
|
@@ -65,11 +80,12 @@ files:
|
|
65
80
|
- LICENSE.txt
|
66
81
|
- README.md
|
67
82
|
- Rakefile
|
83
|
+
- bin/rubitcoin
|
68
84
|
- lib/rubitcoin.rb
|
69
85
|
- lib/rubitcoin/version.rb
|
70
86
|
- rubitcoin.gemspec
|
71
87
|
- test/minitest_helper.rb
|
72
|
-
- test/
|
88
|
+
- test/test_rubitcoin.rb
|
73
89
|
homepage: ''
|
74
90
|
licenses:
|
75
91
|
- MIT
|
@@ -96,4 +112,4 @@ specification_version: 4
|
|
96
112
|
summary: Fetch bitcoin ticker simple.
|
97
113
|
test_files:
|
98
114
|
- test/minitest_helper.rb
|
99
|
-
- test/
|
115
|
+
- test/test_rubitcoin.rb
|