bitex-bitstamp 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +27 -0
  6. data/Gemfile.lock +126 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +96 -0
  9. data/Rakefile +55 -0
  10. data/VERSION +1 -0
  11. data/bitstamp.gemspec +93 -0
  12. data/lib/bitstamp.rb +107 -0
  13. data/lib/bitstamp/collection.rb +30 -0
  14. data/lib/bitstamp/helper.rb +19 -0
  15. data/lib/bitstamp/model.rb +29 -0
  16. data/lib/bitstamp/net.rb +43 -0
  17. data/lib/bitstamp/orders.rb +71 -0
  18. data/lib/bitstamp/ticker.rb +16 -0
  19. data/lib/bitstamp/transactions.rb +43 -0
  20. data/spec/bitstamp_spec.rb +87 -0
  21. data/spec/collection_spec.rb +12 -0
  22. data/spec/fixtures/vcr_cassettes/bitstamp/balance.yml +63 -0
  23. data/spec/fixtures/vcr_cassettes/bitstamp/order_book.yml +1910 -0
  24. data/spec/fixtures/vcr_cassettes/bitstamp/orders/all.yml +62 -0
  25. data/spec/fixtures/vcr_cassettes/bitstamp/orders/buy.yml +62 -0
  26. data/spec/fixtures/vcr_cassettes/bitstamp/orders/sell/failure.yml +60 -0
  27. data/spec/fixtures/vcr_cassettes/bitstamp/ticker.yml +63 -0
  28. data/spec/fixtures/vcr_cassettes/bitstamp/transactions.yml +244 -0
  29. data/spec/fixtures/vcr_cassettes/bitstamp/unconfirmed_user_deposits.yml +72 -0
  30. data/spec/fixtures/vcr_cassettes/bitstamp/user_transactions/all.yml +223 -0
  31. data/spec/fixtures/vcr_cassettes/bitstamp/withdraw_bitcoins/failure.yml +145 -0
  32. data/spec/orders_spec.rb +40 -0
  33. data/spec/spec_helper.rb +31 -0
  34. data/spec/support/bitstamp_setup.rb +19 -0
  35. data/spec/support/vcr.rb +15 -0
  36. data/spec/transactions_spec.rb +32 -0
  37. metadata +178 -0
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'byebug'
5
+ require 'rspec/its'
6
+
7
+ # This file was generated by the `rspec --init` command. Conventionally, all
8
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
9
+ # Require this file using `require "spec_helper"` to ensure that it is only
10
+ # loaded once.
11
+
12
+ require 'bitstamp'
13
+
14
+ # Requires supporting ruby files with custom matchers and macros, etc,
15
+ # in spec/support/ and its subdirectories.
16
+ Dir[File.expand_path("./spec/support/**/*.rb")].each { |f| require f }
17
+
18
+ RSpec::Expectations.configuration.on_potential_false_positives = :nothing
19
+
20
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+ RSpec.configure do |config|
22
+ config.run_all_when_everything_filtered = true
23
+ config.filter_run :focus
24
+ config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
25
+
26
+ # Run specs in random order to surface order dependencies. If you find an
27
+ # order dependency and want to debug it, you can fix the order by providing
28
+ # the seed, which is printed after each run.
29
+ # --seed 1234
30
+ config.order = 'random'
31
+ end
@@ -0,0 +1,19 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ # The famous singleton problem
4
+ Bitstamp.setup do |config|
5
+ config.key = nil
6
+ config.secret = nil
7
+ config.client_id = nil
8
+ end
9
+ end
10
+ end
11
+
12
+ def setup_bitstamp
13
+ Bitstamp.setup do |config|
14
+ raise "You must set environment variable BITSTAMP_KEY and BITSTAMP_SECRET with your username and password to run specs." if ENV['BITSTAMP_KEY'].nil? or ENV['BITSTAMP_SECRET'].nil?
15
+ config.key = ENV['BITSTAMP_KEY']
16
+ config.secret = ENV['BITSTAMP_SECRET']
17
+ config.client_id = ENV['BITSTAMP_CLIENT_ID']
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ require 'vcr'
2
+ require 'webmock/rspec'
3
+
4
+ VCR.configure do |c|
5
+ c.allow_http_connections_when_no_cassette = false
6
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
7
+ c.hook_into :webmock # or :fakeweb
8
+ c.configure_rspec_metadata!
9
+ c.filter_sensitive_data('BITSTAMP_KEY') do |interaction|
10
+ ENV['BITSTAMP_KEY']
11
+ end
12
+ c.filter_sensitive_data('BITSTAMP_SECRET') do |interaction|
13
+ ENV['BITSTAMP_SECRET']
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bitstamp::UserTransactions do
4
+ before { setup_bitstamp }
5
+
6
+ describe :all, vcr: {cassette_name: 'bitstamp/user_transactions/all'} do
7
+ subject { Bitstamp.user_transactions.all }
8
+ its(:count) { should == 47 }
9
+ context "first transaction" do
10
+ subject { Bitstamp.user_transactions.all.first }
11
+ it { should be_kind_of(Bitstamp::UserTransaction) }
12
+ its(:btc) { should == "-3.00781124" }
13
+ its(:btc_usd) { should == "0.00" }
14
+ its(:datetime) { should == "2013-09-26 13:46:59" }
15
+ its(:fee) { should == "0.00" }
16
+ its(:order_id) { should be_nil }
17
+ its(:type) { should == 1 }
18
+ its(:usd) { should == "0.00" }
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ describe Bitstamp::Transactions do
25
+ before { setup_bitstamp }
26
+
27
+ describe :all, vcr:{cassette_name: 'bitstamp/transactions'} do
28
+ subject { Bitstamp.transactions }
29
+ it { should be_kind_of Array }
30
+ end
31
+
32
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitex-bitstamp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.1
5
+ platform: ruby
6
+ authors:
7
+ - Jeffrey Wilcke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rest-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-hmac
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jeweler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Ruby API for use with bitstamp.
112
+ email: stygeo@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files:
116
+ - LICENSE.txt
117
+ - README.md
118
+ files:
119
+ - ".rspec"
120
+ - ".ruby-gemset"
121
+ - ".ruby-version"
122
+ - Gemfile
123
+ - Gemfile.lock
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - VERSION
128
+ - bitstamp.gemspec
129
+ - lib/bitstamp.rb
130
+ - lib/bitstamp/collection.rb
131
+ - lib/bitstamp/helper.rb
132
+ - lib/bitstamp/model.rb
133
+ - lib/bitstamp/net.rb
134
+ - lib/bitstamp/orders.rb
135
+ - lib/bitstamp/ticker.rb
136
+ - lib/bitstamp/transactions.rb
137
+ - spec/bitstamp_spec.rb
138
+ - spec/collection_spec.rb
139
+ - spec/fixtures/vcr_cassettes/bitstamp/balance.yml
140
+ - spec/fixtures/vcr_cassettes/bitstamp/order_book.yml
141
+ - spec/fixtures/vcr_cassettes/bitstamp/orders/all.yml
142
+ - spec/fixtures/vcr_cassettes/bitstamp/orders/buy.yml
143
+ - spec/fixtures/vcr_cassettes/bitstamp/orders/sell/failure.yml
144
+ - spec/fixtures/vcr_cassettes/bitstamp/ticker.yml
145
+ - spec/fixtures/vcr_cassettes/bitstamp/transactions.yml
146
+ - spec/fixtures/vcr_cassettes/bitstamp/unconfirmed_user_deposits.yml
147
+ - spec/fixtures/vcr_cassettes/bitstamp/user_transactions/all.yml
148
+ - spec/fixtures/vcr_cassettes/bitstamp/withdraw_bitcoins/failure.yml
149
+ - spec/orders_spec.rb
150
+ - spec/spec_helper.rb
151
+ - spec/support/bitstamp_setup.rb
152
+ - spec/support/vcr.rb
153
+ - spec/transactions_spec.rb
154
+ homepage: http://github.com/kojnapp/bitstamp
155
+ licenses:
156
+ - MIT
157
+ metadata: {}
158
+ post_install_message:
159
+ rdoc_options: []
160
+ require_paths:
161
+ - lib
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ requirements: []
173
+ rubyforge_project:
174
+ rubygems_version: 2.6.11
175
+ signing_key:
176
+ specification_version: 4
177
+ summary: Bitstamp Ruby API
178
+ test_files: []