litecoin_tools 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53864ca133d7e8e6001bd025828386341b8bda3d
4
- data.tar.gz: 27f2413742543e74b1b13968f0430cc92a7f01cd
3
+ metadata.gz: a9d51c42516cd53d5e9e72885ad284a4044d7f68
4
+ data.tar.gz: fad2b3f74ec866415ae0e42e880100d368995ea3
5
5
  SHA512:
6
- metadata.gz: 3c465804a4e57b0a2c5fd2114712767515bc2d6c6d678feb3b1dce96b533cc0150427688d30a3f458b0c98739db3685d4854525fc3086159c588ad1c25f5d51c
7
- data.tar.gz: 2677548eba1fc2cbfaa92e8c0f4672fac2d8d2668ceaaeb949ddde6f7802cc461c6a69352f0803ea1bf8138f23db8b6618880a91fec0f138cc19c5cc4e9f1c47
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
- - Litecoin pricetickers
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
 
@@ -1,5 +1,6 @@
1
1
  require 'litecoin_tools/version'
2
2
  require 'litecoin_tools/litecoin_rpc'
3
+ require 'litecoin_tools/litecoin_tickers'
3
4
 
4
5
  module LitecoinTools
5
6
  end
@@ -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,10 @@
1
+ module LitecoinTickers
2
+ # Priceticker for Bter
3
+ module Bter
4
+ def ltcbtc
5
+ json = LitecoinTickers::getJsonObject("https://bter.com/api/1/ticker/ltc_btc")
6
+ end
7
+
8
+ module_function :ltcbtc
9
+ end
10
+ 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
@@ -1,3 +1,3 @@
1
1
  module LitecoinTools
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  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.3
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-15 00:00:00.000000000 Z
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.3
81
+ rubygems_version: 2.0.0
78
82
  signing_key:
79
83
  specification_version: 4
80
84
  summary: This gem provides litecoin tools