mtgox 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -0
- data/.yardopts +1 -0
- data/CONTRIBUTING.md +28 -0
- data/README.md +25 -36
- data/Rakefile +0 -2
- data/lib/mtgox/client.rb +7 -7
- data/lib/mtgox/connection.rb +4 -5
- data/lib/mtgox/request.rb +1 -1
- data/lib/mtgox/version.rb +1 -1
- data/mtgox.gemspec +26 -24
- data/spec/faraday/response_spec.rb +1 -1
- data/spec/helper.rb +5 -3
- data/spec/mtgox/client_spec.rb +28 -28
- metadata +56 -129
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
- data/.gitignore +0 -39
- data/.rspec +0 -2
- data/.travis.yml +0 -7
- data/Gemfile +0 -7
data.tar.gz.sig
ADDED
data/.yardopts
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
## Submitting an Issue
|
2
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
3
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
4
|
+
already been submitted. When submitting a bug report, please include a [Gist][]
|
5
|
+
that includes a stack trace and any details that may be necessary to reproduce
|
6
|
+
the bug, including your gem version, Ruby version, and operating system.
|
7
|
+
Ideally, a bug report should include a pull request with failing specs.
|
8
|
+
|
9
|
+
[gist]: https://gist.github.com/
|
10
|
+
|
11
|
+
## Submitting a Pull Request
|
12
|
+
1. [Fork the repository.][fork]
|
13
|
+
2. [Create a topic branch.][branch]
|
14
|
+
3. Add specs for your unimplemented feature or bug fix.
|
15
|
+
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
16
|
+
5. Implement your feature or bug fix.
|
17
|
+
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
|
18
|
+
7. Run `open coverage/index.html`. If your changes are not completely covered
|
19
|
+
by your tests, return to step 3.
|
20
|
+
8. Add documentation for your feature or bug fix.
|
21
|
+
9. Run `bundle exec rake doc:yard`. If your changes are not 100% documented, go
|
22
|
+
back to step 8.
|
23
|
+
10. Add, commit, and push your changes.
|
24
|
+
11. [Submit a pull request.][pr]
|
25
|
+
|
26
|
+
[fork]: http://help.github.com/fork-a-repo/
|
27
|
+
[branch]: http://learn.github.com/p/branching.html
|
28
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/README.md
CHANGED
@@ -1,25 +1,40 @@
|
|
1
|
-
# Ruby wrapper for the Mt. Gox Trade API
|
2
|
-
|
3
|
-
|
1
|
+
# Ruby wrapper for the Mt. Gox Trade API
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/mtgox.png)][gem]
|
3
|
+
[![Build Status](https://secure.travis-ci.org/sferik/mtgox.png?branch=master)][travis]
|
4
|
+
[![Dependency Status](https://gemnasium.com/sferik/mtgox.png?travis)][gemnasium]
|
4
5
|
|
6
|
+
[gem]: https://rubygems.org/gems/mtgox
|
5
7
|
[travis]: http://travis-ci.org/sferik/mtgox
|
6
8
|
[gemnasium]: https://gemnasium.com/sferik/mtgox
|
7
9
|
|
8
|
-
|
10
|
+
Mt. Gox allows you to trade US Dollars (USD) for Bitcoins (BTC) or Bitcoins for
|
11
|
+
US Dollars.
|
12
|
+
|
13
|
+
## Installation
|
9
14
|
gem install mtgox
|
10
15
|
|
11
|
-
|
16
|
+
To ensure the code you're installing hasn't been tampered with, it's
|
17
|
+
recommended that you verify the signature. To do this, you need to add my
|
18
|
+
public key as a trusted certificate (you only need to do this once):
|
19
|
+
|
20
|
+
gem cert --add <(curl -Ls https://gist.github.com/sferik/4701180/raw/public_cert.pem)
|
21
|
+
|
22
|
+
Then, install the gem with the high security trust policy:
|
23
|
+
|
24
|
+
gem install mtgox -P HighSecurity
|
25
|
+
|
26
|
+
## Alias
|
12
27
|
After installing the gem, you can get the current price for 1 BTC in USD by
|
13
28
|
typing `btc` in your bash shell simply by setting the following alias:
|
14
29
|
|
15
30
|
alias btc='ruby -r rubygems -r mtgox -e "puts MtGox.ticker.sell"'
|
16
31
|
|
17
|
-
##
|
32
|
+
## Documentation
|
18
33
|
[http://rdoc.info/gems/mtgox][documentation]
|
19
34
|
|
20
35
|
[documentation]: http://rdoc.info/gems/mtgox
|
21
36
|
|
22
|
-
##
|
37
|
+
## Usage Examples
|
23
38
|
require 'rubygems'
|
24
39
|
require 'mtgox'
|
25
40
|
|
@@ -56,7 +71,7 @@ typing `btc` in your bash shell simply by setting the following alias:
|
|
56
71
|
# Withdraw 1 BTC from your account
|
57
72
|
MtGox.withdraw! 1.0, "1KxSo9bGBfPVFEtWNLpnUK1bfLNNT4q31L"
|
58
73
|
|
59
|
-
##
|
74
|
+
## Contributing
|
60
75
|
In the spirit of [free software][free-sw], **everyone** is encouraged to help
|
61
76
|
improve this project.
|
62
77
|
|
@@ -77,33 +92,7 @@ Here are some ways *you* can contribute:
|
|
77
92
|
|
78
93
|
[issues]: https://github.com/sferik/mtgox/issues
|
79
94
|
|
80
|
-
##
|
81
|
-
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
82
|
-
submitting a bug report or feature request, check to make sure it hasn't
|
83
|
-
already been submitted. You can indicate support for an existing issue by
|
84
|
-
voting it up. When submitting a bug report, please include a [Gist][gist] that
|
85
|
-
includes a stack trace and any details that may be necessary to reproduce the
|
86
|
-
bug, including your gem version, Ruby version, and operating system. Ideally, a
|
87
|
-
bug report should include a pull request with failing specs.
|
88
|
-
|
89
|
-
[gist]: https://gist.github.com/
|
90
|
-
|
91
|
-
## <a name="pulls"></a>Submitting a Pull Request
|
92
|
-
1. Fork the project.
|
93
|
-
2. Create a topic branch.
|
94
|
-
3. Implement your feature or bug fix.
|
95
|
-
4. Add documentation for your feature or bug fix.
|
96
|
-
5. Run `bundle exec rake doc:yard`. If your changes are not 100% documented, go
|
97
|
-
back to step 4.
|
98
|
-
6. Add specs for your feature or bug fix.
|
99
|
-
7. Run `bundle exec rake spec`. If your changes are not 100% covered, go back
|
100
|
-
to step 6.
|
101
|
-
8. Commit and push your changes.
|
102
|
-
9. Submit a pull request. Please do not include changes to the gemspec,
|
103
|
-
version, or history file. (If you want to create your own version for some
|
104
|
-
reason, please do so in a separate commit.)
|
105
|
-
|
106
|
-
## <a name="versions"></a>Supported Ruby Versions
|
95
|
+
## Supported Ruby Versions
|
107
96
|
This library aims to support and is [tested against][travis] the following Ruby
|
108
97
|
implementations:
|
109
98
|
|
@@ -124,7 +113,7 @@ implementation, you will be personally responsible for providing patches in a
|
|
124
113
|
timely fashion. If critical issues for a particular implementation exist at the
|
125
114
|
time of a major release, support for that Ruby version may be dropped.
|
126
115
|
|
127
|
-
##
|
116
|
+
## Copyright
|
128
117
|
Copyright (c) 2011 Erik Michaels-Ober. See [LICENSE][] for details.
|
129
118
|
|
130
119
|
[license]: https://github.com/sferik/mtgox/blob/master/LICENSE.md
|
data/Rakefile
CHANGED
data/lib/mtgox/client.rb
CHANGED
@@ -16,7 +16,7 @@ module MtGox
|
|
16
16
|
include MtGox::Connection
|
17
17
|
include MtGox::Request
|
18
18
|
|
19
|
-
ORDER_TYPES = {:
|
19
|
+
ORDER_TYPES = {sell: 1, buy: 2}
|
20
20
|
|
21
21
|
# Fetch a deposit address
|
22
22
|
# @authenticated true
|
@@ -64,7 +64,7 @@ module MtGox
|
|
64
64
|
end.map! do |bid|
|
65
65
|
Bid.new(*bid)
|
66
66
|
end
|
67
|
-
{:
|
67
|
+
{asks: asks, bids: bids}
|
68
68
|
end
|
69
69
|
|
70
70
|
# Fetch open asks
|
@@ -175,7 +175,7 @@ module MtGox
|
|
175
175
|
# # Buy one bitcoin for $0.011
|
176
176
|
# MtGox.buy! 1.0, 0.011
|
177
177
|
def buy!(amount, price)
|
178
|
-
parse_orders(post('/api/0/buyBTC.php', {:
|
178
|
+
parse_orders(post('/api/0/buyBTC.php', {amount: amount, price: price})['orders'])
|
179
179
|
end
|
180
180
|
|
181
181
|
# Place a limit order to sell BTC
|
@@ -188,7 +188,7 @@ module MtGox
|
|
188
188
|
# # Sell one bitcoin for $100
|
189
189
|
# MtGox.sell! 1.0, 100.0
|
190
190
|
def sell!(amount, price)
|
191
|
-
parse_orders(post('/api/0/sellBTC.php', {:
|
191
|
+
parse_orders(post('/api/0/sellBTC.php', {amount: amount, price: price})['orders'])
|
192
192
|
end
|
193
193
|
|
194
194
|
# Cancel an open order
|
@@ -219,7 +219,7 @@ module MtGox
|
|
219
219
|
order = order.delete_if{|k, v| !['oid', 'type'].include?(k.to_s)}
|
220
220
|
parse_orders(post('/api/0/cancelOrder.php', order)['orders'])
|
221
221
|
else
|
222
|
-
raise Faraday::Error::ResourceNotFound, {:
|
222
|
+
raise Faraday::Error::ResourceNotFound, {status: 404, headers: {}, body: 'Order not found.'}
|
223
223
|
end
|
224
224
|
end
|
225
225
|
end
|
@@ -234,7 +234,7 @@ module MtGox
|
|
234
234
|
# # Withdraw 1 BTC from your account
|
235
235
|
# MtGox.withdraw! 1.0, '1KxSo9bGBfPVFEtWNLpnUK1bfLNNT4q31L'
|
236
236
|
def withdraw!(amount, btca)
|
237
|
-
parse_balance(post('/api/0/withdraw.php', {:
|
237
|
+
parse_balance(post('/api/0/withdraw.php', {group1: 'BTC', amount: amount, btca: btca}))
|
238
238
|
end
|
239
239
|
|
240
240
|
private
|
@@ -257,7 +257,7 @@ module MtGox
|
|
257
257
|
buys << Buy.new(order)
|
258
258
|
end
|
259
259
|
end
|
260
|
-
{:
|
260
|
+
{buys: buys, sells: sells}
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
data/lib/mtgox/connection.rb
CHANGED
@@ -12,12 +12,11 @@ module MtGox
|
|
12
12
|
|
13
13
|
def connection
|
14
14
|
options = {
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
15
|
+
headers: {
|
16
|
+
accept: 'application/json',
|
17
|
+
user_agent: "mtgox gem #{MtGox::Version}",
|
18
18
|
},
|
19
|
-
:
|
20
|
-
:url => 'https://mtgox.com',
|
19
|
+
url: 'https://mtgox.com',
|
21
20
|
}
|
22
21
|
|
23
22
|
Faraday.new(options) do |connection|
|
data/lib/mtgox/request.rb
CHANGED
data/lib/mtgox/version.rb
CHANGED
data/mtgox.gemspec
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mtgox/version'
|
3
5
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.add_dependency 'faraday', '~> 0.8'
|
8
|
+
spec.add_dependency 'faraday_middleware', '~> 0.8'
|
9
|
+
spec.add_dependency 'multi_json', '~> 1.3'
|
10
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
11
|
+
spec.author = "Erik Michaels-Ober"
|
12
|
+
spec.cert_chain = ['certs/sferik.pem']
|
13
|
+
spec.description = %q{Ruby wrapper for the Mt. Gox Trade API. Mt. Gox allows you to trade US Dollars (USD) for Bitcoins (BTC) or Bitcoins for US Dollars.}
|
14
|
+
spec.email = 'sferik@gmail.com'
|
15
|
+
spec.files = `git ls-files`.split("\n")
|
16
|
+
spec.files = %w(.yardopts CONTRIBUTING.md LICENSE.md README.md Rakefile mtgox.gemspec)
|
17
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
18
|
+
spec.files += Dir.glob("spec/**/*")
|
19
|
+
spec.homepage = 'https://github.com/sferik/mtgox'
|
20
|
+
spec.name = 'mtgox'
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
spec.required_ruby_version = '>= 1.9.2'
|
23
|
+
spec.required_rubygems_version = '>= 1.3.6'
|
24
|
+
spec.signing_key = File.expand_path("~/.gem/private_key.pem") if $0 =~ /gem\z/
|
25
|
+
spec.summary = %q{Ruby wrapper for the Mt. Gox Trade API}
|
26
|
+
spec.test_files = Dir.glob("spec/**/*")
|
27
|
+
spec.version = MtGox::Version.to_s
|
26
28
|
end
|
data/spec/helper.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
unless ENV['CI']
|
2
2
|
require 'simplecov'
|
3
|
-
SimpleCov.start
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'spec'
|
5
|
+
end
|
4
6
|
end
|
5
7
|
require 'base64'
|
6
8
|
require 'mtgox'
|
@@ -35,7 +37,7 @@ module MtGox
|
|
35
37
|
module Request
|
36
38
|
private
|
37
39
|
def add_nonce(options)
|
38
|
-
options.merge!({:
|
40
|
+
options.merge!({nonce: 1321745961249676})
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -50,5 +52,5 @@ def test_headers(body=test_body)
|
|
50
52
|
end
|
51
53
|
|
52
54
|
def test_body(options={})
|
53
|
-
options.merge!({:
|
55
|
+
options.merge!({nonce: 1321745961249676}).collect{|k, v| "#{k}=#{v}"} * '&'
|
54
56
|
end
|
data/spec/mtgox/client_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe MtGox::Client do
|
|
12
12
|
describe '#address' do
|
13
13
|
before do
|
14
14
|
stub_post('/api/0/btcAddress.php').
|
15
|
-
to_return(:
|
15
|
+
to_return(status: 200, body: fixture('address.json'))
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should fetch a deposit address" do
|
@@ -26,7 +26,7 @@ describe MtGox::Client do
|
|
26
26
|
describe '#ticker' do
|
27
27
|
before do
|
28
28
|
stub_get('/api/0/data/ticker.php').
|
29
|
-
to_return(:
|
29
|
+
to_return(status: 200, body: fixture('ticker.json'))
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should fetch the ticker" do
|
@@ -46,7 +46,7 @@ describe MtGox::Client do
|
|
46
46
|
describe 'depth methods' do
|
47
47
|
before :each do
|
48
48
|
stub_get('/api/0/data/getDepth.php').
|
49
|
-
to_return(:
|
49
|
+
to_return(status: 200, body: fixture('depth.json'))
|
50
50
|
end
|
51
51
|
|
52
52
|
describe '#asks' do
|
@@ -123,7 +123,7 @@ describe MtGox::Client do
|
|
123
123
|
describe '#trades' do
|
124
124
|
before do
|
125
125
|
stub_get('/api/0/data/getTrades.php').
|
126
|
-
to_return(:
|
126
|
+
to_return(status: 200, body: fixture('trades.json'))
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should fetch trades" do
|
@@ -140,14 +140,14 @@ describe MtGox::Client do
|
|
140
140
|
describe '#balance' do
|
141
141
|
before do
|
142
142
|
stub_post('/api/0/getFunds.php').
|
143
|
-
with(:
|
144
|
-
to_return(:
|
143
|
+
with(body: test_body, headers: test_headers).
|
144
|
+
to_return(status: 200, body: fixture('balance.json'))
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should fetch balance" do
|
148
148
|
balance = @client.balance
|
149
149
|
a_post("/api/0/getFunds.php").
|
150
|
-
with(:
|
150
|
+
with(body: test_body, headers: test_headers).
|
151
151
|
should have_been_made
|
152
152
|
balance.first.currency.should == "BTC"
|
153
153
|
balance.first.amount.should == 22.0
|
@@ -159,15 +159,15 @@ describe MtGox::Client do
|
|
159
159
|
describe "order methods" do
|
160
160
|
before :each do
|
161
161
|
stub_post('/api/0/getOrders.php').
|
162
|
-
with(:
|
163
|
-
to_return(:
|
162
|
+
with(body: test_body, headers: test_headers).
|
163
|
+
to_return(status: 200, body: fixture('orders.json'))
|
164
164
|
end
|
165
165
|
|
166
166
|
describe "#buys" do
|
167
167
|
it "should fetch orders" do
|
168
168
|
buys = @client.buys
|
169
169
|
a_post("/api/0/getOrders.php").
|
170
|
-
with(:
|
170
|
+
with(body: test_body, headers: test_headers).
|
171
171
|
should have_been_made
|
172
172
|
buys.last.price.should == 7
|
173
173
|
buys.last.date.should == Time.utc(2011, 6, 27, 18, 20, 38)
|
@@ -178,7 +178,7 @@ describe MtGox::Client do
|
|
178
178
|
it "should fetch sells" do
|
179
179
|
sells = @client.sells
|
180
180
|
a_post("/api/0/getOrders.php").
|
181
|
-
with(:
|
181
|
+
with(body: test_body, headers: test_headers).
|
182
182
|
should have_been_made
|
183
183
|
sells.last.price.should == 99.0
|
184
184
|
sells.last.date.should == Time.utc(2011, 6, 27, 18, 20, 20)
|
@@ -189,7 +189,7 @@ describe MtGox::Client do
|
|
189
189
|
it "should fetch both buys and sells, with only one call" do
|
190
190
|
orders = @client.orders
|
191
191
|
a_post("/api/0/getOrders.php").
|
192
|
-
with(:
|
192
|
+
with(body: test_body, headers: test_headers).
|
193
193
|
should have_been_made
|
194
194
|
orders[:buys].last.price.should == 7.0
|
195
195
|
orders[:buys].last.date.should == Time.utc(2011, 6, 27, 18, 20, 38)
|
@@ -203,15 +203,15 @@ describe MtGox::Client do
|
|
203
203
|
before do
|
204
204
|
body = test_body({"amount" => "0.88", "price" => "0.89"})
|
205
205
|
stub_post('/api/0/buyBTC.php').
|
206
|
-
with(:
|
207
|
-
to_return(:
|
206
|
+
with(body: body, headers: test_headers(body)).
|
207
|
+
to_return(status: 200, body: fixture('buy.json'))
|
208
208
|
end
|
209
209
|
|
210
210
|
it "should place a bid" do
|
211
211
|
buy = @client.buy!(0.88, 0.89)
|
212
212
|
body = test_body({"amount" => "0.88", "price" => "0.89"})
|
213
213
|
a_post("/api/0/buyBTC.php").
|
214
|
-
with(:
|
214
|
+
with(body: body, headers: test_headers(body)).
|
215
215
|
should have_been_made
|
216
216
|
buy[:buys].last.price.should == 2.0
|
217
217
|
buy[:buys].last.date.should == Time.utc(2011, 6, 27, 18, 26, 21)
|
@@ -224,15 +224,15 @@ describe MtGox::Client do
|
|
224
224
|
before do
|
225
225
|
body = test_body({"amount" => "0.88", "price" => "89.0"})
|
226
226
|
stub_post('/api/0/sellBTC.php').
|
227
|
-
with(:
|
228
|
-
to_return(:
|
227
|
+
with(body: body, headers: test_headers(body)).
|
228
|
+
to_return(status: 200, body: fixture('sell.json'))
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should place an ask" do
|
232
232
|
body = test_body({"amount" => "0.88", "price" => "89.0"})
|
233
233
|
sell = @client.sell!(0.88, 89.0)
|
234
234
|
a_post("/api/0/sellBTC.php").
|
235
|
-
with(:
|
235
|
+
with(body: body, headers: test_headers(body)).
|
236
236
|
should have_been_made
|
237
237
|
sell[:buys].last.price.should == 2.0
|
238
238
|
sell[:buys].last.date.should == Time.utc(2011, 6, 27, 18, 26, 21)
|
@@ -245,11 +245,11 @@ describe MtGox::Client do
|
|
245
245
|
before do
|
246
246
|
cancel_body = test_body({"oid" => "bddd042c-e837-4a88-a92e-3b7c05e483df", "type" => "2"})
|
247
247
|
stub_post('/api/0/getOrders.php').
|
248
|
-
with(:
|
249
|
-
to_return(:
|
248
|
+
with(body: test_body, headers: test_headers).
|
249
|
+
to_return(status: 200, body: fixture('orders.json'))
|
250
250
|
stub_post('/api/0/cancelOrder.php').
|
251
|
-
with(:
|
252
|
-
to_return(:
|
251
|
+
with(body: cancel_body, headers: test_headers(cancel_body)).
|
252
|
+
to_return(status: 200, body: fixture('cancel.json'))
|
253
253
|
end
|
254
254
|
|
255
255
|
context "with a valid oid passed" do
|
@@ -257,10 +257,10 @@ describe MtGox::Client do
|
|
257
257
|
cancel = @client.cancel("bddd042c-e837-4a88-a92e-3b7c05e483df")
|
258
258
|
cancel_body = test_body({"oid" => "bddd042c-e837-4a88-a92e-3b7c05e483df", "type" => "2"})
|
259
259
|
a_post("/api/0/getOrders.php").
|
260
|
-
with(:
|
260
|
+
with(body: test_body, headers: test_headers).
|
261
261
|
should have_been_made.once
|
262
262
|
a_post('/api/0/cancelOrder.php').
|
263
|
-
with(:
|
263
|
+
with(body: cancel_body, headers: test_headers(cancel_body)).
|
264
264
|
should have_been_made
|
265
265
|
cancel[:buys].last.price.should == 7.0
|
266
266
|
cancel[:buys].last.date.should == Time.utc(2011, 6, 27, 18, 20, 38)
|
@@ -282,7 +282,7 @@ describe MtGox::Client do
|
|
282
282
|
cancel = @client.cancel({'oid' => "bddd042c-e837-4a88-a92e-3b7c05e483df", 'type' => 2})
|
283
283
|
body = test_body({"oid" => "bddd042c-e837-4a88-a92e-3b7c05e483df", "type" => "2"})
|
284
284
|
a_post('/api/0/cancelOrder.php').
|
285
|
-
with(:
|
285
|
+
with(body: body, headers: test_headers(body)).
|
286
286
|
should have_been_made
|
287
287
|
cancel[:buys].last.price.should == 7.0
|
288
288
|
cancel[:buys].last.date.should == Time.utc(2011, 6, 27, 18, 20, 38)
|
@@ -296,15 +296,15 @@ describe MtGox::Client do
|
|
296
296
|
before do
|
297
297
|
body = test_body({"group1" => "BTC", "amount" => "1.0", "btca" => "1KxSo9bGBfPVFEtWNLpnUK1bfLNNT4q31L"})
|
298
298
|
stub_post('/api/0/withdraw.php').
|
299
|
-
with(:
|
300
|
-
to_return(:
|
299
|
+
with(body: body, headers: test_headers(body)).
|
300
|
+
to_return(status: 200, body: fixture('withdraw.json'))
|
301
301
|
end
|
302
302
|
|
303
303
|
it "should withdraw funds" do
|
304
304
|
withdraw = @client.withdraw!(1.0, "1KxSo9bGBfPVFEtWNLpnUK1bfLNNT4q31L")
|
305
305
|
body = test_body({"group1" => "BTC", "amount" => "1.0", "btca" => "1KxSo9bGBfPVFEtWNLpnUK1bfLNNT4q31L"})
|
306
306
|
a_post("/api/0/withdraw.php").
|
307
|
-
with(:
|
307
|
+
with(body: body, headers: test_headers(body)).
|
308
308
|
should have_been_made
|
309
309
|
withdraw.first.currency.should == "BTC"
|
310
310
|
withdraw.first.amount.should == 9.0
|
metadata
CHANGED
@@ -1,176 +1,107 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtgox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0
|
5
4
|
prerelease:
|
5
|
+
version: 0.8.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Erik Michaels-Ober
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
11
|
+
cert_chain:
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMakNDQWhhZ0F3SUJB
|
14
|
+
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE5TVE4d0RRWURWUVFEREFaelpt
|
15
|
+
VnkKYVdzeEZUQVRCZ29Ka2lhSmsvSXNaQUVaRmdWbmJXRnBiREVUTUJFR0Nn
|
16
|
+
bVNKb21UOGl4a0FSa1dBMk52YlRBZQpGdzB4TXpBeU1ETXhNREF5TWpkYUZ3
|
17
|
+
MHhOREF5TURNeE1EQXlNamRhTUQweER6QU5CZ05WQkFNTUJuTm1aWEpwCmF6
|
18
|
+
RVZNQk1HQ2dtU0pvbVQ4aXhrQVJrV0JXZHRZV2xzTVJNd0VRWUtDWkltaVpQ
|
19
|
+
eUxHUUJHUllEWTI5dE1JSUIKSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4
|
20
|
+
QU1JSUJDZ0tDQVFFQWwweDVkeDh1S3hpN1Rrckl1eUJVVEpWQgp2MW85M25V
|
21
|
+
QjlqL3k0TTk2Z1Yycll3QWNpMUpQQnNlTmQ2RnliempvM1lHdUhsN0VRSHVT
|
22
|
+
SE5hZjFwMmx4ZXcvCnk2MEpYSUpCQmdQY0RLL0tDUDROVUhvZm0wamZvWUQr
|
23
|
+
SDV1TkpmSENOcTcvWnNUeE90RTNSYTkyczBCQ01UcG0Kd0JNTWxXUjVNdGRF
|
24
|
+
aElZdUJPNFhobmVqWWdIMEwvN0JMMmx5bW50Vm5zci9hZ2RRb29qUUNOMUlR
|
25
|
+
bXNSSnZyUgpkdVpSTzN0WnZvSW8xcEJjNEpFZWhEdXFDZXlCZ1BMT3FNb0t0
|
26
|
+
UWxvbGQxVFFzMWtXVUJLN0tXTUZFaEtDL0tnCnp5ektSSFFvOXlEWXdPdllu
|
27
|
+
Z29CTFkrVC9sd0NUNGR5c3NkaHpSYmZueEFoYUt1NFNBc3NJd2FDMDF5Vm93
|
28
|
+
SUQKQVFBQm96a3dOekFKQmdOVkhSTUVBakFBTUIwR0ExVWREZ1FXQkJTMHJ1
|
29
|
+
RGZSYWs1Y2kxT3BETlgvWmRERWtJcwppVEFMQmdOVkhROEVCQU1DQkxBd0RR
|
30
|
+
WUpLb1pJaHZjTkFRRUZCUUFEZ2dFQkFISFNNcy9NUDBzT2FMa0V2NEpvCnp2
|
31
|
+
a20zcW41QTZ0MHZhSHg3NzRjbWVqeU1VKzV3eVN4UmV6c3BMN1VMaDlOZXVL
|
32
|
+
Mk9oVStPZTNUcHFyQWc1VEsKUjhHUUlMblZ1MkZlbUdBNnNBa1BEbGNQdGdB
|
33
|
+
NmllSTE5UFpPRjZIVkxtYy9JRC9kUC9OZ1pXV3pFZXFRS21jSwoyK0hNK1NF
|
34
|
+
RURoWmtTY1lla3c0Wk9lMTY0WnRaRzgxNm9BdjV4MHBHaXRTSWt1bVVwN1Y4
|
35
|
+
aUVaLzZlaHI3WTllClhPZzRlZXVuNUwvSmptakFSb1cya05kdmtSRDNjMkVl
|
36
|
+
U0xxV3ZRUnNCbHlwSGZoczZKSnVMbHlaUEdoVTNSL3YKU2YzbFZLcEJDV2dS
|
37
|
+
cEdUdnk0NVhWcEIrNTl5MzNQSm1FdVExUFRFT1l2UXlhbzlVS01BQWFBTi83
|
38
|
+
cVdRdGpsMApobHc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
39
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
13
40
|
dependencies:
|
14
41
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: faraday
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0.8'
|
22
|
-
type: :runtime
|
23
42
|
prerelease: false
|
24
43
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
44
|
requirements:
|
27
45
|
- - ~>
|
28
46
|
- !ruby/object:Gem::Version
|
29
47
|
version: '0.8'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: faraday_middleware
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
48
|
none: false
|
49
|
+
type: :runtime
|
50
|
+
name: faraday
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
34
52
|
requirements:
|
35
53
|
- - ~>
|
36
54
|
- !ruby/object:Gem::Version
|
37
55
|
version: '0.8'
|
38
|
-
|
56
|
+
none: false
|
57
|
+
- !ruby/object:Gem::Dependency
|
39
58
|
prerelease: false
|
40
59
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
60
|
requirements:
|
43
61
|
- - ~>
|
44
62
|
- !ruby/object:Gem::Version
|
45
63
|
version: '0.8'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: multi_json
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
64
|
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.3'
|
54
65
|
type: :runtime
|
55
|
-
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.3'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: json
|
66
|
+
name: faraday_middleware
|
64
67
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
68
|
requirements:
|
67
|
-
- -
|
69
|
+
- - ~>
|
68
70
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
version: '0.8'
|
73
72
|
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
73
|
- !ruby/object:Gem::Dependency
|
79
|
-
name: maruku
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
74
|
prerelease: false
|
88
75
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rake
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
76
|
requirements:
|
99
|
-
- -
|
77
|
+
- - ~>
|
100
78
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
version: '1.3'
|
105
80
|
none: false
|
106
|
-
|
107
|
-
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: rspec
|
81
|
+
type: :runtime
|
82
|
+
name: multi_json
|
112
83
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
84
|
requirements:
|
115
|
-
- -
|
85
|
+
- - ~>
|
116
86
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
version: '1.3'
|
121
88
|
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
89
|
- !ruby/object:Gem::Dependency
|
127
|
-
name: simplecov
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
90
|
prerelease: false
|
136
91
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
92
|
requirements:
|
139
|
-
- -
|
93
|
+
- - ~>
|
140
94
|
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: webmock
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
95
|
+
version: '1.0'
|
145
96
|
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
97
|
type: :development
|
151
|
-
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: yard
|
98
|
+
name: bundler
|
160
99
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
100
|
requirements:
|
163
|
-
- -
|
101
|
+
- - ~>
|
164
102
|
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
version: '1.0'
|
169
104
|
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
105
|
description: Ruby wrapper for the Mt. Gox Trade API. Mt. Gox allows you to trade US
|
175
106
|
Dollars (USD) for Bitcoins (BTC) or Bitcoins for US Dollars.
|
176
107
|
email: sferik@gmail.com
|
@@ -178,17 +109,13 @@ executables: []
|
|
178
109
|
extensions: []
|
179
110
|
extra_rdoc_files: []
|
180
111
|
files:
|
181
|
-
- .gemtest
|
182
|
-
- .gitignore
|
183
|
-
- .rspec
|
184
|
-
- .travis.yml
|
185
112
|
- .yardopts
|
186
|
-
-
|
113
|
+
- CONTRIBUTING.md
|
187
114
|
- LICENSE.md
|
188
115
|
- README.md
|
189
116
|
- Rakefile
|
117
|
+
- mtgox.gemspec
|
190
118
|
- lib/faraday/response/raise_mtgox_error.rb
|
191
|
-
- lib/mtgox.rb
|
192
119
|
- lib/mtgox/ask.rb
|
193
120
|
- lib/mtgox/balance.rb
|
194
121
|
- lib/mtgox/bid.rb
|
@@ -207,7 +134,7 @@ files:
|
|
207
134
|
- lib/mtgox/ticker.rb
|
208
135
|
- lib/mtgox/trade.rb
|
209
136
|
- lib/mtgox/version.rb
|
210
|
-
- mtgox.
|
137
|
+
- lib/mtgox.rb
|
211
138
|
- spec/faraday/response_spec.rb
|
212
139
|
- spec/fixtures/address.json
|
213
140
|
- spec/fixtures/balance.json
|
@@ -231,20 +158,20 @@ rdoc_options: []
|
|
231
158
|
require_paths:
|
232
159
|
- lib
|
233
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
161
|
requirements:
|
236
162
|
- - ! '>='
|
237
163
|
- !ruby/object:Gem::Version
|
238
164
|
version: 1.9.2
|
239
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
165
|
none: false
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
167
|
requirements:
|
242
168
|
- - ! '>='
|
243
169
|
- !ruby/object:Gem::Version
|
244
|
-
version:
|
170
|
+
version: 1.3.6
|
171
|
+
none: false
|
245
172
|
requirements: []
|
246
173
|
rubyforge_project:
|
247
|
-
rubygems_version: 1.8.
|
174
|
+
rubygems_version: 1.8.25
|
248
175
|
signing_key:
|
249
176
|
specification_version: 3
|
250
177
|
summary: Ruby wrapper for the Mt. Gox Trade API
|
metadata.gz.sig
ADDED
Binary file
|
data/.gemtest
DELETED
File without changes
|
data/.gitignore
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
!.gitignore
|
2
|
-
*.gem
|
3
|
-
*.rbc
|
4
|
-
*.sw[a-p]
|
5
|
-
*.tmproj
|
6
|
-
*.tmproject
|
7
|
-
*.un~
|
8
|
-
*~
|
9
|
-
.Spotlight-V100
|
10
|
-
.Trashes
|
11
|
-
._*
|
12
|
-
.bundle
|
13
|
-
.config
|
14
|
-
.directory
|
15
|
-
.elc
|
16
|
-
.redcar
|
17
|
-
.yardoc
|
18
|
-
/.emacs.desktop
|
19
|
-
/.emacs.desktop.lock
|
20
|
-
Desktop.ini
|
21
|
-
Gemfile.lock
|
22
|
-
Icon?
|
23
|
-
InstalledFiles
|
24
|
-
Session.vim
|
25
|
-
\#*\#
|
26
|
-
_yardoc
|
27
|
-
auto-save-list
|
28
|
-
coverage
|
29
|
-
doc/
|
30
|
-
lib/bundler/man
|
31
|
-
pkg
|
32
|
-
pkg/*
|
33
|
-
rdoc
|
34
|
-
spec/reports
|
35
|
-
test/tmp
|
36
|
-
test/version_tmp
|
37
|
-
tmp
|
38
|
-
tmtags
|
39
|
-
tramp
|
data/.rspec
DELETED
data/.travis.yml
DELETED