coinfresh 0.0.1

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.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/coinfresh.gemspec +27 -0
  8. data/lib/coinfresh.rb +59 -0
  9. data/lib/coinfresh/api/base.rb +18 -0
  10. data/lib/coinfresh/api/cash_flow.rb +20 -0
  11. data/lib/coinfresh/api/currency.rb +19 -0
  12. data/lib/coinfresh/api/market.rb +25 -0
  13. data/lib/coinfresh/api/order.rb +43 -0
  14. data/lib/coinfresh/api/wallet.rb +21 -0
  15. data/lib/coinfresh/api/withdraw.rb +21 -0
  16. data/lib/coinfresh/api_operation/create.rb +12 -0
  17. data/lib/coinfresh/api_operation/destroy.rb +11 -0
  18. data/lib/coinfresh/api_operation/find.rb +16 -0
  19. data/lib/coinfresh/api_operation/list.rb +13 -0
  20. data/lib/coinfresh/api_operation/new.rb +11 -0
  21. data/lib/coinfresh/api_operation/update.rb +12 -0
  22. data/lib/coinfresh/client.rb +39 -0
  23. data/lib/coinfresh/http.rb +106 -0
  24. data/lib/coinfresh/model/base.rb +175 -0
  25. data/lib/coinfresh/model/cash_flow.rb +17 -0
  26. data/lib/coinfresh/model/currency.rb +18 -0
  27. data/lib/coinfresh/model/market.rb +18 -0
  28. data/lib/coinfresh/model/order.rb +22 -0
  29. data/lib/coinfresh/model/trade.rb +18 -0
  30. data/lib/coinfresh/model/wallet.rb +22 -0
  31. data/lib/coinfresh/model/withdraw.rb +21 -0
  32. data/lib/coinfresh/version.rb +3 -0
  33. data/spec/api/cash_flow_spec.rb +23 -0
  34. data/spec/api/currency_spec.rb +24 -0
  35. data/spec/api/market_spec.rb +52 -0
  36. data/spec/api/order_spec.rb +55 -0
  37. data/spec/api/wallet_spec.rb +40 -0
  38. data/spec/api/withdraw_spec.rb +43 -0
  39. data/spec/cassettes/Coinfresh_Api_CashFlow/_list/gets_all_the_cashflows_for_currency.yml +64 -0
  40. data/spec/cassettes/Coinfresh_Api_Currency/_list/gets_all_the_currencies.yml +64 -0
  41. data/spec/cassettes/Coinfresh_Api_Market/_find/gets_a_market_with_the_given_id.yml +64 -0
  42. data/spec/cassettes/Coinfresh_Api_Market/_list/gets_all_the_markets.yml +64 -0
  43. data/spec/cassettes/Coinfresh_Api_Market/_trades/gets_all_trades_for_a_market.yml +64 -0
  44. data/spec/cassettes/Coinfresh_Api_Order/_cancel/cancels_an_order.yml +65 -0
  45. data/spec/cassettes/Coinfresh_Api_Order/_create/creates_an_order.yml +64 -0
  46. data/spec/cassettes/Coinfresh_Api_Order/_list/gets_all_the_orders.yml +67 -0
  47. data/spec/cassettes/Coinfresh_Api_Order/_my/gets_all_the_orders.yml +67 -0
  48. data/spec/cassettes/Coinfresh_Api_Wallet/_create/creates_a_wallet_with_the_given_id.yml +64 -0
  49. data/spec/cassettes/Coinfresh_Api_Wallet/_list/gets_all_the_wallets.yml +64 -0
  50. data/spec/cassettes/Coinfresh_Api_Withdraw/_create/creates_a_wallet_with_the_given_id.yml +64 -0
  51. data/spec/cassettes/Coinfresh_Api_Withdraw/_list/gets_all_the_wallets.yml +64 -0
  52. data/spec/spec_helper.rb +22 -0
  53. data/spec/support/common_let_helpers.rb +62 -0
  54. data/spec/support/json_api_helpers.rb +5 -0
  55. metadata +190 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:3000/api/v1/withdraws
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"withdraw":{"address":"mxcA1w3sEfWUjjRYSUozFxzdiiHwK4dptF","amount":0.001},"password":"password","wallet_id":2}'
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ - text/json
15
+ User-Agent:
16
+ - Ruby
17
+ Content-Type:
18
+ - application/json
19
+ Content-Md5:
20
+ - XBFvgfbA5C8iyLF+HbNPjg==
21
+ Date:
22
+ - Tue, 29 Jul 2014 05:26:47 GMT
23
+ Authorization:
24
+ - APIAuth da5AgdjTchH4a5APfkBRVW8jQ6zdbiQPD2i3huaY:K/ql0Du5zD6gtIrFCQjrvmZxu78=
25
+ response:
26
+ status:
27
+ code: 201
28
+ message: Created
29
+ headers:
30
+ X-Frame-Options:
31
+ - DENY
32
+ X-Xss-Protection:
33
+ - 1; mode=block
34
+ X-Content-Type-Options:
35
+ - nosniff
36
+ X-Ua-Compatible:
37
+ - chrome=1
38
+ Content-Security-Policy-Report-Only:
39
+ - default-src 'self'; connect-src 'self' ws://localhost:9292 ws://testnet.CoinFresh.com:9292
40
+ wss://CoinFresh.com:4443; font-src 'self'; frame-src 'self'; img-src 'self'
41
+ https://www.google-analytics.com/ data:; media-src 'self'; object-src 'self';
42
+ script-src 'self' http://localhost:9292 http://testnet.CoinFresh.com:9292
43
+ https://CoinFresh.com:4443 https://ssl.google-analytics.com/ https://www.google-analytics.com/;
44
+ style-src 'self' 'unsafe-inline';
45
+ Content-Type:
46
+ - application/json; charset=utf-8
47
+ Etag:
48
+ - '"88b7a97e9656d75a74ad340c608dacd9"'
49
+ Cache-Control:
50
+ - max-age=0, private, must-revalidate
51
+ X-Request-Id:
52
+ - 76220c7b-65e8-4060-86f1-433f57117dba
53
+ X-Runtime:
54
+ - '2.538803'
55
+ Connection:
56
+ - close
57
+ Server:
58
+ - thin 1.5.1 codename Straight Razor
59
+ body:
60
+ encoding: UTF-8
61
+ string: '{"withdraw":{"id":2,"address":"mxcA1w3sEfWUjjRYSUozFxzdiiHwK4dptF","amount":0.001,"status":"pending","created_at":"2014-07-29T05:26:48.444Z","txid":null,"wallet":{"id":2,"balance":320.90848,"deposit_address":"mxcA1w3sEfWUjjRYSUozFxzdiiHwK4dptF","in_escrow":184736.71552,"total_deposit":1123800.0,"total_withdraw":0.0,"unconfirmed_deposit":0.0,"currency":{"id":1,"name":"Bitcoin","ticker":"BTC","withdraw_transaction_fee":0.0001,"deposit_confirmations":3}}},"meta":{}}'
62
+ http_version:
63
+ recorded_at: Tue, 29 Jul 2014 05:26:50 GMT
64
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,64 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/v1/withdraws?wallet_id=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ - text/json
15
+ User-Agent:
16
+ - Ruby
17
+ Date:
18
+ - Tue, 29 Jul 2014 05:16:08 GMT
19
+ Authorization:
20
+ - APIAuth da5AgdjTchH4a5APfkBRVW8jQ6zdbiQPD2i3huaY:OcQwYmCxv0PBK7lKSvXDmWdD3ew=
21
+ response:
22
+ status:
23
+ code: 200
24
+ message: OK
25
+ headers:
26
+ X-Frame-Options:
27
+ - DENY
28
+ X-Xss-Protection:
29
+ - 1; mode=block
30
+ X-Content-Type-Options:
31
+ - nosniff
32
+ X-Ua-Compatible:
33
+ - chrome=1
34
+ Content-Security-Policy-Report-Only:
35
+ - default-src 'self'; connect-src 'self' ws://localhost:9292 ws://testnet.CoinFresh.com:9292
36
+ wss://CoinFresh.com:4443; font-src 'self'; frame-src 'self'; img-src 'self'
37
+ https://www.google-analytics.com/ data:; media-src 'self'; object-src 'self';
38
+ script-src 'self' http://localhost:9292 http://testnet.CoinFresh.com:9292
39
+ https://CoinFresh.com:4443 https://ssl.google-analytics.com/ https://www.google-analytics.com/;
40
+ style-src 'self' 'unsafe-inline';
41
+ Content-Type:
42
+ - application/json; charset=utf-8
43
+ Etag:
44
+ - '"63a0a7d08dbbf3778a85545c8732939d"'
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ Set-Cookie:
48
+ - XSRF-TOKEN=%2BPuofAnTAh71CtQMIlZavLk3BGMSZMxpCGH9jCh05eg%3D; path=/
49
+ - _planetaltcoin_session=ckJpeXpPblpvZ0xvQURGNEJ2YVFLeVJpOUZ2UkovR0lIYlAzR01FeXl5SXNYbGNSTmkvM0xoQ0VhdlN2SGREbGlIOUFrZGp4bVlYN2xZTTg5MGlSUHFhb2htYlk0MzZGMXFldjYveml6WjZhMHpmZFpKVWp4QjBSejBUdlViUklZK3o4QmlielFnODhnMFpqVWtHblUvNzArK1J1UloxaERrcnJYMkI4WVY4YzV2VWJSd2FXVmd0allvL2RKQTUvLS1SY0VJMzhXRXZCNXhlb3lXT1grcWJnPT0%3D--d06e0dd1b16fb8d87235c1cdb3f414f36bf2328d;
50
+ path=/; HttpOnly
51
+ X-Request-Id:
52
+ - 03a682ec-475d-4d26-b60c-00094b7047b6
53
+ X-Runtime:
54
+ - '0.123409'
55
+ Connection:
56
+ - close
57
+ Server:
58
+ - thin 1.5.1 codename Straight Razor
59
+ body:
60
+ encoding: UTF-8
61
+ string: '{"withdraws":[{"id":1,"address":"mxcA1w3sEfWUjjRYSUozFxzdiiHwK4dptF","amount":1.0,"status":"pending","created_at":"2014-07-29T05:04:54.521Z","txid":"34981b77f6da4306490046f17ba897f9cc691687e4e1013b81b69fb34407481b","wallet":{"id":2,"balance":320.90948,"deposit_address":"mxcA1w3sEfWUjjRYSUozFxzdiiHwK4dptF","in_escrow":184736.71552,"total_deposit":1123800.0,"total_withdraw":0.0,"unconfirmed_deposit":0.0,"currency":{"id":1,"name":"Bitcoin","ticker":"BTC","withdraw_transaction_fee":0.0001,"deposit_confirmations":3}}}],"meta":{}}'
62
+ http_version:
63
+ recorded_at: Tue, 29 Jul 2014 05:16:09 GMT
64
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,22 @@
1
+ require 'coinfresh'
2
+ require 'debugger'
3
+
4
+ require 'support/common_let_helpers'
5
+ require 'support/json_api_helpers'
6
+
7
+ require 'rspec'
8
+ require 'rspec/core/shared_context'
9
+ require 'webmock/rspec'
10
+
11
+ require 'vcr'
12
+
13
+ VCR.configure do |c|
14
+ c.cassette_library_dir = 'spec/cassettes'
15
+ c.hook_into :webmock
16
+ c.configure_rspec_metadata!
17
+ end
18
+
19
+ RSpec.configure do |config|
20
+ config.filter_run_excluding :external => true
21
+ config.include CommonLetHelpers
22
+ end
@@ -0,0 +1,62 @@
1
+ require 'rspec/core/shared_context'
2
+
3
+ module CommonLetHelpers
4
+ extend RSpec::Core::SharedContext
5
+
6
+ let(:cryptsy_ex){
7
+ create(:exchange, name: 'Cryptsy')
8
+ }
9
+ let(:pa_ex){
10
+ create(:exchange, name: 'PlanetAltcoin')
11
+ }
12
+
13
+ let(:btc) {
14
+ create(:currency, name: "Bitcoin", ticker: "BTC")
15
+ }
16
+ let(:ltc) {
17
+ create(:currency, name: "Litecoin", ticker: "LTC")
18
+ }
19
+ let(:doge) {
20
+ create(:currency, name: "Dogecoin", ticker: "DOGE")
21
+ }
22
+
23
+ let(:market_btc_ltc){
24
+ create(:market, base_currency: btc, currency: ltc)
25
+ }
26
+
27
+ let(:market_doge_btc){
28
+ create(:market, base_currency: doge, currency: btc )
29
+ }
30
+
31
+ let(:ex_market_pa_btc_ltc){
32
+ create(:exchange_market, exchange: pa_ex, market: market_btc_ltc, remote_market_id: 10)
33
+ }
34
+ let(:ex_market_cryptsy_btc_ltc){
35
+ create(:exchange_market, exchange: cryptsy_ex, market: market_btc_ltc, remote_market_id: 20)
36
+ }
37
+
38
+ let(:ex_market_pa_doge_btc){
39
+ create(:exchange_market, exchange: pa_ex, market: market_doge_btc, remote_market_id: 2)
40
+ }
41
+ let(:ex_market_cryptsy_doge_btc){
42
+ create(:exchange_market, exchange: cryptsy_ex, market: market_doge_btc, remote_market_id: 132)
43
+ }
44
+
45
+ let!(:buy_ltc_btc_order){
46
+ {
47
+ market_id: 1,
48
+ order_type: "buy",
49
+ amount: 10,
50
+ price:0.02
51
+ }
52
+ }
53
+
54
+ let(:client) {
55
+ Coinfresh::Client.new({
56
+ access_token: 'da5AgdjTchH4a5APfkBRVW8jQ6zdbiQPD2i3huaY',
57
+ secret_key: 'jbxZyk1/L40fVBv1nfc2F9Tpx99m+SeCeEKWispNwQW4vuazShusLeaFlYp/DcR++kvu442Cpq0iemBT50DZtw==',
58
+ base_uri: 'http://localhost:3000'
59
+ })
60
+ }
61
+
62
+ end
@@ -0,0 +1,5 @@
1
+ module JsonApiHelpers
2
+ def json_response
3
+ @json_response ||= JSON.parse(response.body)
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coinfresh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pouyan T. Bibalan
8
+ - Ricky Gu
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-07-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.3'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '1.3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: vcr
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: webmock
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: api-auth
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: CoinFresh API Client
85
+ email:
86
+ - pouyan@coinfresh.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - coinfresh.gemspec
97
+ - lib/coinfresh.rb
98
+ - lib/coinfresh/api/base.rb
99
+ - lib/coinfresh/api/cash_flow.rb
100
+ - lib/coinfresh/api/currency.rb
101
+ - lib/coinfresh/api/market.rb
102
+ - lib/coinfresh/api/order.rb
103
+ - lib/coinfresh/api/wallet.rb
104
+ - lib/coinfresh/api/withdraw.rb
105
+ - lib/coinfresh/api_operation/create.rb
106
+ - lib/coinfresh/api_operation/destroy.rb
107
+ - lib/coinfresh/api_operation/find.rb
108
+ - lib/coinfresh/api_operation/list.rb
109
+ - lib/coinfresh/api_operation/new.rb
110
+ - lib/coinfresh/api_operation/update.rb
111
+ - lib/coinfresh/client.rb
112
+ - lib/coinfresh/http.rb
113
+ - lib/coinfresh/model/base.rb
114
+ - lib/coinfresh/model/cash_flow.rb
115
+ - lib/coinfresh/model/currency.rb
116
+ - lib/coinfresh/model/market.rb
117
+ - lib/coinfresh/model/order.rb
118
+ - lib/coinfresh/model/trade.rb
119
+ - lib/coinfresh/model/wallet.rb
120
+ - lib/coinfresh/model/withdraw.rb
121
+ - lib/coinfresh/version.rb
122
+ - spec/api/cash_flow_spec.rb
123
+ - spec/api/currency_spec.rb
124
+ - spec/api/market_spec.rb
125
+ - spec/api/order_spec.rb
126
+ - spec/api/wallet_spec.rb
127
+ - spec/api/withdraw_spec.rb
128
+ - spec/cassettes/Coinfresh_Api_CashFlow/_list/gets_all_the_cashflows_for_currency.yml
129
+ - spec/cassettes/Coinfresh_Api_Currency/_list/gets_all_the_currencies.yml
130
+ - spec/cassettes/Coinfresh_Api_Market/_find/gets_a_market_with_the_given_id.yml
131
+ - spec/cassettes/Coinfresh_Api_Market/_list/gets_all_the_markets.yml
132
+ - spec/cassettes/Coinfresh_Api_Market/_trades/gets_all_trades_for_a_market.yml
133
+ - spec/cassettes/Coinfresh_Api_Order/_cancel/cancels_an_order.yml
134
+ - spec/cassettes/Coinfresh_Api_Order/_create/creates_an_order.yml
135
+ - spec/cassettes/Coinfresh_Api_Order/_list/gets_all_the_orders.yml
136
+ - spec/cassettes/Coinfresh_Api_Order/_my/gets_all_the_orders.yml
137
+ - spec/cassettes/Coinfresh_Api_Wallet/_create/creates_a_wallet_with_the_given_id.yml
138
+ - spec/cassettes/Coinfresh_Api_Wallet/_list/gets_all_the_wallets.yml
139
+ - spec/cassettes/Coinfresh_Api_Withdraw/_create/creates_a_wallet_with_the_given_id.yml
140
+ - spec/cassettes/Coinfresh_Api_Withdraw/_list/gets_all_the_wallets.yml
141
+ - spec/spec_helper.rb
142
+ - spec/support/common_let_helpers.rb
143
+ - spec/support/json_api_helpers.rb
144
+ homepage: ''
145
+ licenses:
146
+ - MIT
147
+ metadata: {}
148
+ post_install_message:
149
+ rdoc_options: []
150
+ require_paths:
151
+ - lib
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 2.1.11
165
+ signing_key:
166
+ specification_version: 4
167
+ summary: A ruby wrapper library to interact with CoinFresh API
168
+ test_files:
169
+ - spec/api/cash_flow_spec.rb
170
+ - spec/api/currency_spec.rb
171
+ - spec/api/market_spec.rb
172
+ - spec/api/order_spec.rb
173
+ - spec/api/wallet_spec.rb
174
+ - spec/api/withdraw_spec.rb
175
+ - spec/cassettes/Coinfresh_Api_CashFlow/_list/gets_all_the_cashflows_for_currency.yml
176
+ - spec/cassettes/Coinfresh_Api_Currency/_list/gets_all_the_currencies.yml
177
+ - spec/cassettes/Coinfresh_Api_Market/_find/gets_a_market_with_the_given_id.yml
178
+ - spec/cassettes/Coinfresh_Api_Market/_list/gets_all_the_markets.yml
179
+ - spec/cassettes/Coinfresh_Api_Market/_trades/gets_all_trades_for_a_market.yml
180
+ - spec/cassettes/Coinfresh_Api_Order/_cancel/cancels_an_order.yml
181
+ - spec/cassettes/Coinfresh_Api_Order/_create/creates_an_order.yml
182
+ - spec/cassettes/Coinfresh_Api_Order/_list/gets_all_the_orders.yml
183
+ - spec/cassettes/Coinfresh_Api_Order/_my/gets_all_the_orders.yml
184
+ - spec/cassettes/Coinfresh_Api_Wallet/_create/creates_a_wallet_with_the_given_id.yml
185
+ - spec/cassettes/Coinfresh_Api_Wallet/_list/gets_all_the_wallets.yml
186
+ - spec/cassettes/Coinfresh_Api_Withdraw/_create/creates_a_wallet_with_the_given_id.yml
187
+ - spec/cassettes/Coinfresh_Api_Withdraw/_list/gets_all_the_wallets.yml
188
+ - spec/spec_helper.rb
189
+ - spec/support/common_let_helpers.rb
190
+ - spec/support/json_api_helpers.rb