middlecoin 0.0.0
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 +7 -0
- data/LICENSE +20 -0
- data/README.markdown +22 -0
- data/Rakefile +63 -0
- data/bin/middlecoin +32 -0
- data/lib/middlecoin/cli/application.rb +110 -0
- data/lib/middlecoin/cli.rb +27 -0
- data/lib/middlecoin/core/bitcoinaddress.rb +45 -0
- data/lib/middlecoin/core/middlecoinapi.rb +81 -0
- data/lib/middlecoin/core.rb +28 -0
- data/lib/middlecoin.rb +37 -0
- data/middlecoin.gemspec +46 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a987245589473f8ece1f9761ec8c195dd158a346
|
4
|
+
data.tar.gz: 88e229054604cd034cc1332d0dbdf91c969abf4e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b4a6091a826efa8dd2d07aa0d93ef854336a82e1815d877ff51446dba643844d1e6450ce6af24a138b2e013b94464fd1d34847952cd38bc0ff073c667fec378
|
7
|
+
data.tar.gz: 256e16c11ad47cb705d711263c11ad794403b5937888ce8cb1f0f331eb0c4016d62d2d7934539b4e659983af81f6df86cf7a6452fac3491b7b1d263d2cf9ad2b
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# middlecoin
|
2
|
+
|
3
|
+
A rubygem for interacting with middlecoin.com JSON web api.
|
4
|
+
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
% gem install middlecoin
|
8
|
+
|
9
|
+
# Usage
|
10
|
+
|
11
|
+
%
|
12
|
+
|
13
|
+
# Contributing
|
14
|
+
If you would like to contribute templates/bug fixes/etc to middlecoin. The easiest way is to fork the project on [github](http://github.com/hammackj/middlecoin) and make the changes in your fork and the submit a pull request to the project.
|
15
|
+
|
16
|
+
# Issues
|
17
|
+
If you have any problems, bugs or feature requests please use the [github issue tracker](http://github.com/hammackj/middlecoin/issues).
|
18
|
+
|
19
|
+
# Contact
|
20
|
+
You can reach me at jacob[.]hammack[@]hammackj[.]com.
|
21
|
+
|
22
|
+
You can also contact me on IRC as hammackj on irc.freenode.net, #risu
|
data/Rakefile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
23
|
+
|
24
|
+
require "middlecoin"
|
25
|
+
require 'rake'
|
26
|
+
require 'rake/testtask'
|
27
|
+
|
28
|
+
task :build do
|
29
|
+
system "gem build #{Middlecoin::APP_NAME}.gemspec"
|
30
|
+
end
|
31
|
+
|
32
|
+
task :tag_and_bag do
|
33
|
+
system "git tag -a v#{Middlecoin::VERSION} -m 'version #{Middlecoin::VERSION}'"
|
34
|
+
system "git push --tags"
|
35
|
+
system "git checkout master"
|
36
|
+
system "git merge #{Middlecoin::VERSION}"
|
37
|
+
system "git push"
|
38
|
+
end
|
39
|
+
|
40
|
+
task :release => [:tag_and_bag, :build] do
|
41
|
+
system "gem push #{Middlecoin::APP_NAME}-#{Middlecoin::VERSION}.gem"
|
42
|
+
puts "Just released #{Middlecoin::APP_NAME} v#{Middlecoin::VERSION}. #{Middlecoin::APP_NAME} is a parser/status checker for middlecoin.com. More information at http://github.com/hammackj/middlecoin"
|
43
|
+
end
|
44
|
+
|
45
|
+
task :clean do
|
46
|
+
system "rm *.gem"
|
47
|
+
system "rm *.db"
|
48
|
+
system "rm *.cfg"
|
49
|
+
system "rm *.pdf"
|
50
|
+
system "rm -rf coverage"
|
51
|
+
end
|
52
|
+
|
53
|
+
task :test do
|
54
|
+
t.libs << "test"
|
55
|
+
t.pattern = 'test/*/*_test.rb'
|
56
|
+
t.verbose = true
|
57
|
+
end
|
58
|
+
|
59
|
+
task :merge do
|
60
|
+
system "git checkout master"
|
61
|
+
system "git merge #{Risu::VERSION}"
|
62
|
+
system "git push"
|
63
|
+
end
|
data/bin/middlecoin
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
|
5
|
+
# Copyright (c) 2014 Jacob Hammack
|
6
|
+
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
8
|
+
# this software and associated documentation files (the "Software"), to deal in
|
9
|
+
# the Software without restriction, including without limitation the rights to
|
10
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
11
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
12
|
+
# subject to the following conditions:
|
13
|
+
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
19
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
20
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
21
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
22
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../lib'))
|
25
|
+
|
26
|
+
$stdout.sync = true
|
27
|
+
$stderr.sync = true
|
28
|
+
|
29
|
+
require 'middlecoin'
|
30
|
+
|
31
|
+
app = Middlecoin::CLI::Application.new
|
32
|
+
app.run
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Middlecoin
|
23
|
+
module CLI
|
24
|
+
|
25
|
+
class Application
|
26
|
+
|
27
|
+
# Initializes a CLI Application
|
28
|
+
def initialize
|
29
|
+
@options = {}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Parses all the command line options
|
33
|
+
def parse_options
|
34
|
+
begin
|
35
|
+
opts = OptionParser.new do |opt|
|
36
|
+
opt.banner = "#{APP_NAME} v#{VERSION}\nJacob Hammack\nhttp://www.hammackj.com\n\n"
|
37
|
+
opt.banner << "Usage: #{APP_NAME} [options] <BTC Address>"
|
38
|
+
opt.separator ''
|
39
|
+
opt.separator 'Other Options'
|
40
|
+
|
41
|
+
opt.on_tail('-v', '--version', "Shows application version information") do
|
42
|
+
puts "#{APP_NAME}: #{VERSION}\nRuby Version: #{RUBY_VERSION}\nRubygems Version: #{Gem::VERSION}"
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
|
46
|
+
opt.on_tail("-?", "--help", "Show this message") do
|
47
|
+
puts opt.to_s + "\n"
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if ARGV.length != 0
|
53
|
+
opts.parse!
|
54
|
+
else
|
55
|
+
puts opts.to_s + "\n"
|
56
|
+
exit
|
57
|
+
end
|
58
|
+
rescue OptionParser::MissingArgument => m
|
59
|
+
puts opts.to_s + "\n"
|
60
|
+
exit
|
61
|
+
rescue OptionParser::InvalidOption => i
|
62
|
+
puts opts.to_s + "\n"
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Main Application loop, handles all of the command line arguments and
|
68
|
+
#parsing of files on the command line
|
69
|
+
def run
|
70
|
+
parse_options
|
71
|
+
|
72
|
+
api = Middlecoin::Core::MiddlecoinAPI.new
|
73
|
+
api.fetch_report
|
74
|
+
|
75
|
+
ARGV.each do |address|
|
76
|
+
begin
|
77
|
+
puts "[*] Checking Address #{address}"
|
78
|
+
Middlecoin::Core::BitcoinAddress.validate address
|
79
|
+
|
80
|
+
result = api.lookup address
|
81
|
+
|
82
|
+
if result == nil
|
83
|
+
puts "[!] Address not found"
|
84
|
+
next
|
85
|
+
end
|
86
|
+
|
87
|
+
puts "\tAddress: #{result[:address]}"
|
88
|
+
puts "\tMHs: #{result[:megahashesPerSecond]}"
|
89
|
+
puts "\tRejected MHs: #{result[:rejectedMegahashesPerSecond]}"
|
90
|
+
puts "\tLast hour shares: #{result[:lastHourShares]}"
|
91
|
+
puts "\tLast hour rejected shares: #{result[:lastHourRejectedShares]}"
|
92
|
+
puts "\tImmature Balance: #{result[:immatureBalance]}"
|
93
|
+
puts "\tUnexchanged Balance: #{result[:unexchangedBalance]}"
|
94
|
+
puts "\tBitcoin Balance: #{result[:bitcoinBalance]}"
|
95
|
+
puts "\tTotal paid out: #{result[:paidOut]}"
|
96
|
+
puts "\n"
|
97
|
+
rescue Middlecoin::InvalidBitcoinAddressError => i
|
98
|
+
puts "[!] Error: #{i.message}"
|
99
|
+
next
|
100
|
+
rescue => e
|
101
|
+
puts e.inspect
|
102
|
+
puts e.backtrace
|
103
|
+
puts "[!] Error: #{address}"
|
104
|
+
next
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Middlecoin
|
23
|
+
module CLI
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'middlecoin/cli/application'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Middlecoin
|
23
|
+
module Core
|
24
|
+
|
25
|
+
# Bitcoin Address
|
26
|
+
class BitcoinAddress
|
27
|
+
|
28
|
+
def self.validate address
|
29
|
+
if address[0] != "1" && address[0] != "3"
|
30
|
+
raise Middlecoin::InvalidBitcoinAddressError, "Bitcoin addresses must start with 1 or 3"
|
31
|
+
end
|
32
|
+
|
33
|
+
if !(27..34).include?(address.length)
|
34
|
+
raise Middlecoin::InvalidBitcoinAddressError, "Bitcoin addresses must be between 27 and 34 in length"
|
35
|
+
end
|
36
|
+
|
37
|
+
if address =~ /\A\p{Alnum}+\z/
|
38
|
+
return true
|
39
|
+
else
|
40
|
+
raise Middlecoin::InvalidBitcoinAddressError, "Bitcoin addresses must only contain Alphanumerical characters"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'net/http'
|
23
|
+
require 'json'
|
24
|
+
require 'uri'
|
25
|
+
|
26
|
+
module Middlecoin
|
27
|
+
module Core
|
28
|
+
|
29
|
+
# Bitcoin Address
|
30
|
+
class MiddlecoinAPI
|
31
|
+
attr_accessor :report
|
32
|
+
|
33
|
+
def fetch(uri_str, limit = 10)
|
34
|
+
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
35
|
+
|
36
|
+
url = URI.parse(uri_str)
|
37
|
+
req = Net::HTTP::Get.new(url.path, { 'User-Agent' => "Agent" })
|
38
|
+
|
39
|
+
response = Net::HTTP.start(url.host, url.port) do |http|
|
40
|
+
http.request(req)
|
41
|
+
end
|
42
|
+
|
43
|
+
case response
|
44
|
+
when Net::HTTPSuccess
|
45
|
+
then response
|
46
|
+
when Net::HTTPRedirection
|
47
|
+
then fetch(response['location'], limit - 1)
|
48
|
+
else
|
49
|
+
response.error!
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def fetch_report
|
54
|
+
report = fetch("#{Middlecoin::MIDDLECOIN_URL}/json")
|
55
|
+
@report = JSON.parse(report.body)["report"]
|
56
|
+
end
|
57
|
+
|
58
|
+
def lookup btc_address
|
59
|
+
@report.each do |address|
|
60
|
+
if address[0].eql?(btc_address)
|
61
|
+
result = {
|
62
|
+
:address => address[0],
|
63
|
+
:lastHourShares => address[1]["lastHourShares"],
|
64
|
+
:immatureBalance => address[1]["immatureBalance"],
|
65
|
+
:lastHourRejectedShares => address[1]["lastHourRejectedShares"],
|
66
|
+
:paidOut => address[1]["paidOut"],
|
67
|
+
:unexchangedBalance => address[1]["unexchangedBalance"],
|
68
|
+
:megahashesPerSecond => address[1]["megahashesPerSecond"],
|
69
|
+
:bitcoinBalance => address[1]["bitcoinBalance"],
|
70
|
+
:rejectedMegahashesPerSecond => address[1]["rejectedMegahashesPerSecond"]
|
71
|
+
}
|
72
|
+
|
73
|
+
return result
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
return nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Middlecoin
|
23
|
+
module Core
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'middlecoin/core/bitcoinaddress'
|
28
|
+
require 'middlecoin/core/middlecoinapi'
|
data/lib/middlecoin.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Middlecoin
|
23
|
+
APP_NAME = "middlecoin"
|
24
|
+
VERSION = "0.0.0"
|
25
|
+
GITHUB = "http://github.com/hammackj/middlecoin"
|
26
|
+
EMAIL = "jacob.hammack@hammackj.com"
|
27
|
+
MIDDLECOIN_URL = "http://middlecoin.com"
|
28
|
+
|
29
|
+
class Error < StandardError; end
|
30
|
+
class InvalidBitcoinAddressError < Error; end
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'json'
|
34
|
+
require 'optparse'
|
35
|
+
|
36
|
+
require 'middlecoin/core'
|
37
|
+
require 'middlecoin/cli'
|
data/middlecoin.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2014 Jacob Hammack
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
base = __FILE__
|
23
|
+
$:.unshift(File.join(File.dirname(base), 'lib'))
|
24
|
+
|
25
|
+
require 'middlecoin'
|
26
|
+
|
27
|
+
Gem::Specification.new do |s|
|
28
|
+
s.name = "#{Middlecoin::APP_NAME}"
|
29
|
+
s.version = Middlecoin::VERSION
|
30
|
+
s.homepage = "http://www.github.com/hammackj/middlecoin"
|
31
|
+
s.summary = "#{Middlecoin::APP_NAME}"
|
32
|
+
s.description = "#{Middlecoin::APP_NAME} is a parser/status checker for middlecoin.com"
|
33
|
+
s.license = "MIT"
|
34
|
+
|
35
|
+
s.author = "Jacob Hammack"
|
36
|
+
s.email = "jacob.hammack@hammackj.com"
|
37
|
+
|
38
|
+
s.files = Dir['[A-Z]*'] + Dir['lib/**/*'] + ['middlecoin.gemspec']
|
39
|
+
s.bindir = "bin"
|
40
|
+
s.executables = "#{Middlecoin::APP_NAME}"
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
s.has_rdoc = 'yard'
|
43
|
+
s.extra_rdoc_files = ["README.markdown", "LICENSE"]
|
44
|
+
|
45
|
+
s.required_rubygems_version = ">= 1.8.24"
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middlecoin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jacob Hammack
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: middlecoin is a parser/status checker for middlecoin.com
|
14
|
+
email: jacob.hammack@hammackj.com
|
15
|
+
executables:
|
16
|
+
- middlecoin
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.markdown
|
20
|
+
- LICENSE
|
21
|
+
files:
|
22
|
+
- LICENSE
|
23
|
+
- README.markdown
|
24
|
+
- Rakefile
|
25
|
+
- bin/middlecoin
|
26
|
+
- lib/middlecoin.rb
|
27
|
+
- lib/middlecoin/cli.rb
|
28
|
+
- lib/middlecoin/cli/application.rb
|
29
|
+
- lib/middlecoin/core.rb
|
30
|
+
- lib/middlecoin/core/bitcoinaddress.rb
|
31
|
+
- lib/middlecoin/core/middlecoinapi.rb
|
32
|
+
- middlecoin.gemspec
|
33
|
+
homepage: http://www.github.com/hammackj/middlecoin
|
34
|
+
licenses:
|
35
|
+
- MIT
|
36
|
+
metadata: {}
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 1.8.24
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.2.0
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: middlecoin
|
57
|
+
test_files: []
|