litecoin_tools 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 +9 -2
- data/lib/litecoin_tools.rb +1 -0
- data/lib/litecoin_tools/litecoin_tickers.rb +24 -0
- data/lib/litecoin_tools/litecoin_tickers/btce.rb +16 -0
- data/lib/litecoin_tools/litecoin_tickers/bter.rb +10 -0
- data/lib/litecoin_tools/litecoin_tickers/vircurex.rb +14 -0
- data/lib/litecoin_tools/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d51c42516cd53d5e9e72885ad284a4044d7f68
|
4
|
+
data.tar.gz: fad2b3f74ec866415ae0e42e880100d368995ea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b025ef39d2771b587f116ecf7169a118e023396e1b643559eb9767f8940d8b33d57b5057f8afc753d7893d1a7205a61abcf5590767093b89ca1def8e595b4eaf
|
7
|
+
data.tar.gz: b0ec589fe29b011036248e54688793ad68488f858fc8aa4184522f8260a45a4e5471b2b8a099da1e26f55bbf3bf632aa3a13be4d293936e63012c163f6de9474
|
data/README.md
CHANGED
@@ -5,11 +5,11 @@ Tools for litecoin.
|
|
5
5
|
It includes:
|
6
6
|
|
7
7
|
- Litecoin RPC
|
8
|
+
- Litecoin pricetickers
|
8
9
|
|
9
10
|
Todo:
|
10
11
|
|
11
|
-
-
|
12
|
-
- Other litecoin tools
|
12
|
+
- Other userfull litecoin tools, ideas?
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
@@ -32,6 +32,12 @@ Example for the RPC:
|
|
32
32
|
lt = LitecoinRPC.new('http://user:password@127.0.0.1:9332')
|
33
33
|
p lt.getbalance # this outputs the balance
|
34
34
|
|
35
|
+
Example for a BTCe Priceticker:
|
36
|
+
|
37
|
+
LitecoinTickers::BTCe.ltcusd
|
38
|
+
|
39
|
+
This returns a hash that contains info about the ltc value in usd on BTC-e
|
40
|
+
|
35
41
|
## Contributing
|
36
42
|
|
37
43
|
1. Fork it
|
@@ -40,6 +46,7 @@ p lt.getbalance # this outputs the balance
|
|
40
46
|
4. Push to the branch (`git push origin my-new-feature`)
|
41
47
|
5. Create new Pull Request
|
42
48
|
|
49
|
+
If someone has some suggestions for this gem let me know.
|
43
50
|
|
44
51
|
## Donations
|
45
52
|
|
data/lib/litecoin_tools.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'json'
|
4
|
+
require 'openssl'
|
5
|
+
|
6
|
+
# included pricetickers
|
7
|
+
require_relative 'litecoin_tickers/btce'
|
8
|
+
require_relative 'litecoin_tickers/bter'
|
9
|
+
require_relative 'litecoin_tickers/vircurex'
|
10
|
+
|
11
|
+
# This module contains the price tickers
|
12
|
+
module LitecoinTickers
|
13
|
+
def getJsonObject(url)
|
14
|
+
uri = URI.parse(url)
|
15
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
16
|
+
http.use_ssl = true
|
17
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
18
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
19
|
+
response = http.request(request)
|
20
|
+
resp = JSON.parse(response.body, { symbolize_names: true})
|
21
|
+
end
|
22
|
+
|
23
|
+
module_function :getJsonObject
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module LitecoinTickers
|
2
|
+
# Priceticker for BTC-e
|
3
|
+
module BTCe
|
4
|
+
def ltcusd
|
5
|
+
json = LitecoinTickers::getJsonObject("https://btc-e.com/api/2/ltc_usd/ticker")
|
6
|
+
json[:ticker]
|
7
|
+
end
|
8
|
+
|
9
|
+
def ltcbtc
|
10
|
+
json = LitecoinTickers::getJsonObject("https://btc-e.com/api/2/ltc_btc/ticker")
|
11
|
+
json[:ticker]
|
12
|
+
end
|
13
|
+
|
14
|
+
module_function :ltcusd, :ltcbtc
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module LitecoinTickers
|
2
|
+
# Priceticker for VirCurEx
|
3
|
+
module VirCurEx
|
4
|
+
def ltcusd
|
5
|
+
LitecoinTickers::getJsonObject('https://vircurex.com/api/get_info_for_1_currency.json?base=ltc&alt=usd')
|
6
|
+
end
|
7
|
+
|
8
|
+
def ltcbtc
|
9
|
+
LitecoinTickers::getJsonObject('https://vircurex.com/api/get_info_for_1_currency.json?base=ltc&alt=btc')
|
10
|
+
end
|
11
|
+
|
12
|
+
module_function :ltcusd, :ltcbtc
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: litecoin_tools
|
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
|
- Bart Koopmans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,10 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- lib/litecoin_tools.rb
|
54
54
|
- lib/litecoin_tools/litecoin_rpc.rb
|
55
|
+
- lib/litecoin_tools/litecoin_tickers.rb
|
56
|
+
- lib/litecoin_tools/litecoin_tickers/btce.rb
|
57
|
+
- lib/litecoin_tools/litecoin_tickers/bter.rb
|
58
|
+
- lib/litecoin_tools/litecoin_tickers/vircurex.rb
|
55
59
|
- lib/litecoin_tools/version.rb
|
56
60
|
- litecoin_tools.gemspec
|
57
61
|
homepage: https://github.com/barthoz/litecoin_tools
|
@@ -74,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
78
|
version: '0'
|
75
79
|
requirements: []
|
76
80
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.0.
|
81
|
+
rubygems_version: 2.0.0
|
78
82
|
signing_key:
|
79
83
|
specification_version: 4
|
80
84
|
summary: This gem provides litecoin tools
|