mtgox 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/faraday/response/raise_mtgox_error.rb +12 -0
- data/lib/mtgox.rb +1 -0
- data/lib/mtgox/connection.rb +3 -0
- data/lib/mtgox/error.rb +7 -0
- data/lib/mtgox/version.rb +1 -1
- data/spec/faraday/response_spec.rb +14 -0
- data/spec/fixtures/mysql_error +1 -0
- metadata +204 -204
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module Faraday
|
4
|
+
class Response::RaiseMtGoxError < Response::Middleware
|
5
|
+
def on_complete(env)
|
6
|
+
if 200 == env[:status] && 'MySQL error, please retry later' == env[:body]
|
7
|
+
raise MtGox::MysqlError, "MySQL error, please retry later"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
data/lib/mtgox.rb
CHANGED
data/lib/mtgox/connection.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday/response/raise_mtgox_error'
|
1
3
|
require 'faraday_middleware'
|
2
4
|
require 'mtgox/version'
|
3
5
|
|
@@ -20,6 +22,7 @@ module MtGox
|
|
20
22
|
connection.use Faraday::Response::RaiseError
|
21
23
|
connection.use Faraday::Response::Rashify
|
22
24
|
connection.use Faraday::Response::ParseJson
|
25
|
+
connection.use Faraday::Response::RaiseMtGoxError
|
23
26
|
connection.adapter(Faraday.default_adapter)
|
24
27
|
end
|
25
28
|
end
|
data/lib/mtgox/error.rb
ADDED
data/lib/mtgox/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Faraday::Response do
|
4
|
+
before do
|
5
|
+
stub_get('/code/data/getTrades.php').
|
6
|
+
to_return(:status => 200, :body => fixture('mysql_error'))
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should raise MtGox::MysqlError" do
|
10
|
+
lambda do
|
11
|
+
MtGox.trades
|
12
|
+
end.should raise_error(MtGox::MysqlError)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
MySQL error, please retry later
|
metadata
CHANGED
@@ -1,227 +1,227 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtgox
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.3.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- Erik Michaels-Ober
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-07-03 00:00:00 -07:00
|
12
|
+
date: 2011-07-03 00:00:00.000000000 -07:00
|
14
13
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
description: Ruby wrapper for the Mt. Gox Trade API. Mt. Gox allows you to trade US
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ZenTest
|
17
|
+
requirement: &70364608964540 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.5'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70364608964540
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: maruku
|
28
|
+
requirement: &70364608964000 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70364608964000
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: &70364608963420 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0.9'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70364608963420
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
requirement: &70364608962220 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '2.6'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70364608962220
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: simplecov
|
61
|
+
requirement: &70364608961080 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.4'
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70364608961080
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: webmock
|
72
|
+
requirement: &70364608943460 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.6'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *70364608943460
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: yard
|
83
|
+
requirement: &70364608942360 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.7'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *70364608942360
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: faraday
|
94
|
+
requirement: &70364608941420 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.6.1
|
100
|
+
type: :runtime
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *70364608941420
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: faraday_middleware
|
105
|
+
requirement: &70364608940880 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.6.3
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *70364608940880
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: hashie
|
116
|
+
requirement: &70364608940240 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ~>
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 1.0.0
|
122
|
+
type: :runtime
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: *70364608940240
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: multi_json
|
127
|
+
requirement: &70364608939620 !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ~>
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.0.3
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: *70364608939620
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: rash
|
138
|
+
requirement: &70364608939040 !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ~>
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 0.3.0
|
144
|
+
type: :runtime
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: *70364608939040
|
147
|
+
description: Ruby wrapper for the Mt. Gox Trade API. Mt. Gox allows you to trade US
|
148
|
+
Dollars (USD) for Bitcoins (BTC) or Bitcoins for US Dollars.
|
149
149
|
email: sferik@gmail.com
|
150
150
|
executables: []
|
151
|
-
|
152
151
|
extensions: []
|
153
|
-
|
154
152
|
extra_rdoc_files: []
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
153
|
+
files:
|
154
|
+
- .autotest
|
155
|
+
- .gemtest
|
156
|
+
- .gitignore
|
157
|
+
- .rspec
|
158
|
+
- .travis.yml
|
159
|
+
- .yardopts
|
160
|
+
- Gemfile
|
161
|
+
- LICENSE.md
|
162
|
+
- README.md
|
163
|
+
- Rakefile
|
164
|
+
- lib/faraday/response/raise_mtgox_error.rb
|
165
|
+
- lib/mtgox.rb
|
166
|
+
- lib/mtgox/client.rb
|
167
|
+
- lib/mtgox/connection.rb
|
168
|
+
- lib/mtgox/error.rb
|
169
|
+
- lib/mtgox/request.rb
|
170
|
+
- lib/mtgox/version.rb
|
171
|
+
- mtgox.gemspec
|
172
|
+
- spec/faraday/response_spec.rb
|
173
|
+
- spec/fixtures/balance.json
|
174
|
+
- spec/fixtures/buy.json
|
175
|
+
- spec/fixtures/cancel.json
|
176
|
+
- spec/fixtures/depth.json
|
177
|
+
- spec/fixtures/error.json
|
178
|
+
- spec/fixtures/mysql_error
|
179
|
+
- spec/fixtures/orders.json
|
180
|
+
- spec/fixtures/sell.json
|
181
|
+
- spec/fixtures/ticker.json
|
182
|
+
- spec/fixtures/trades.json
|
183
|
+
- spec/fixtures/withdraw.json
|
184
|
+
- spec/helper.rb
|
185
|
+
- spec/mtgox/client_spec.rb
|
186
|
+
- spec/mtgox_spec.rb
|
186
187
|
has_rdoc: true
|
187
188
|
homepage: https://github.com/sferik/mtgox
|
188
189
|
licenses: []
|
189
|
-
|
190
190
|
post_install_message:
|
191
191
|
rdoc_options: []
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
require_paths:
|
193
|
+
- lib
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
195
|
none: false
|
197
|
-
requirements:
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
201
|
none: false
|
203
|
-
requirements:
|
204
|
-
|
205
|
-
|
206
|
-
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
207
206
|
requirements: []
|
208
|
-
|
209
207
|
rubyforge_project:
|
210
|
-
rubygems_version: 1.
|
208
|
+
rubygems_version: 1.6.2
|
211
209
|
signing_key:
|
212
210
|
specification_version: 3
|
213
211
|
summary: Ruby wrapper for the Mt. Gox Trade API
|
214
|
-
test_files:
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
212
|
+
test_files:
|
213
|
+
- spec/faraday/response_spec.rb
|
214
|
+
- spec/fixtures/balance.json
|
215
|
+
- spec/fixtures/buy.json
|
216
|
+
- spec/fixtures/cancel.json
|
217
|
+
- spec/fixtures/depth.json
|
218
|
+
- spec/fixtures/error.json
|
219
|
+
- spec/fixtures/mysql_error
|
220
|
+
- spec/fixtures/orders.json
|
221
|
+
- spec/fixtures/sell.json
|
222
|
+
- spec/fixtures/ticker.json
|
223
|
+
- spec/fixtures/trades.json
|
224
|
+
- spec/fixtures/withdraw.json
|
225
|
+
- spec/helper.rb
|
226
|
+
- spec/mtgox/client_spec.rb
|
227
|
+
- spec/mtgox_spec.rb
|