bitso 0.1.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.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +111 -0
- data/LICENSE.txt +20 -0
- data/README.md +98 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/bitso.gemspec +90 -0
- data/lib/bitso.rb +101 -0
- data/lib/bitso/collection.rb +30 -0
- data/lib/bitso/helper.rb +19 -0
- data/lib/bitso/model.rb +30 -0
- data/lib/bitso/net.rb +34 -0
- data/lib/bitso/orders.rb +41 -0
- data/lib/bitso/ticker.rb +16 -0
- data/lib/bitso/transactions.rb +37 -0
- data/spec/bitso_spec.rb +89 -0
- data/spec/collection_spec.rb +12 -0
- data/spec/fixtures/vcr_cassettes/bitso/balance.yml +63 -0
- data/spec/fixtures/vcr_cassettes/bitso/order_book.yml +1910 -0
- data/spec/fixtures/vcr_cassettes/bitso/orders/all.yml +62 -0
- data/spec/fixtures/vcr_cassettes/bitso/orders/buy.yml +62 -0
- data/spec/fixtures/vcr_cassettes/bitso/orders/sell/failure.yml +60 -0
- data/spec/fixtures/vcr_cassettes/bitso/ticker.yml +63 -0
- data/spec/fixtures/vcr_cassettes/bitso/transactions.yml +244 -0
- data/spec/fixtures/vcr_cassettes/bitso/unconfirmed_user_deposits.yml +72 -0
- data/spec/fixtures/vcr_cassettes/bitso/user_transactions/all.yml +223 -0
- data/spec/fixtures/vcr_cassettes/bitso/withdraw_bitcoins/failure.yml +145 -0
- data/spec/orders_spec.rb +40 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/bitso_setup.rb +19 -0
- data/spec/support/vcr.rb +21 -0
- data/spec/transactions_spec.rb +32 -0
- metadata +178 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
7
|
+
# loaded once.
|
8
|
+
|
9
|
+
require 'bitso'
|
10
|
+
|
11
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
12
|
+
# in spec/support/ and its subdirectories.
|
13
|
+
Dir[File.expand_path("./spec/support/**/*.rb")].each { |f| require f }
|
14
|
+
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
18
|
+
config.run_all_when_everything_filtered = true
|
19
|
+
config.filter_run :focus
|
20
|
+
|
21
|
+
# Run specs in random order to surface order dependencies. If you find an
|
22
|
+
# order dependency and want to debug it, you can fix the order by providing
|
23
|
+
# the seed, which is printed after each run.
|
24
|
+
# --seed 1234
|
25
|
+
config.order = 'random'
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:each) do
|
3
|
+
# The famous singleton problem
|
4
|
+
Bitso.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_bitso
|
13
|
+
Bitso.setup do |config|
|
14
|
+
raise "You must set environment variable BITSO_KEY and BITSO_SECRET with your username and password to run specs." if ENV['BITSO_KEY'].nil? or ENV['BITSO_SECRET'].nil?
|
15
|
+
config.key = ENV['BITSO_KEY']
|
16
|
+
config.secret = ENV['BITSO_SECRET']
|
17
|
+
config.client_id = ENV['BITSO_CLIENT_ID']
|
18
|
+
end
|
19
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,21 @@
|
|
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('BITSO_KEY') do |interaction|
|
10
|
+
ENV['BITSO_KEY']
|
11
|
+
end
|
12
|
+
c.filter_sensitive_data('BITSO_SECRET') do |interaction|
|
13
|
+
ENV['BITSO_SECRET']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
RSpec.configure do |c|
|
18
|
+
# so we can use :vcr rather than :vcr => true;
|
19
|
+
# in RSpec 3 this will no longer be necessary.
|
20
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bitso::UserTransactions do
|
4
|
+
before { setup_bitso }
|
5
|
+
|
6
|
+
describe :all, vcr: {cassette_name: 'bitso/user_transactions/all'} do
|
7
|
+
subject { Bitso.user_transactions.all }
|
8
|
+
its(:count) { should == 47 }
|
9
|
+
context "first transaction" do
|
10
|
+
subject { Bitso.user_transactions.all.first }
|
11
|
+
it { should be_kind_of(Bitso::UserTransaction) }
|
12
|
+
its(:btc) { should == "-3.00781124" }
|
13
|
+
its(:btc_mxn) { 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(:mxn) { should == "0.00" }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
describe Bitso::Transactions do
|
25
|
+
before { setup_bitso }
|
26
|
+
|
27
|
+
describe :all, vcr:{cassette_name: 'bitso/transactions'} do
|
28
|
+
subject { Bitso.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: bitso
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Arturo Diaz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-18 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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
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: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
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 bitso.
|
112
|
+
email: me@arturodz.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
|
+
- bitso.gemspec
|
129
|
+
- lib/bitso.rb
|
130
|
+
- lib/bitso/collection.rb
|
131
|
+
- lib/bitso/helper.rb
|
132
|
+
- lib/bitso/model.rb
|
133
|
+
- lib/bitso/net.rb
|
134
|
+
- lib/bitso/orders.rb
|
135
|
+
- lib/bitso/ticker.rb
|
136
|
+
- lib/bitso/transactions.rb
|
137
|
+
- spec/bitso_spec.rb
|
138
|
+
- spec/collection_spec.rb
|
139
|
+
- spec/fixtures/vcr_cassettes/bitso/balance.yml
|
140
|
+
- spec/fixtures/vcr_cassettes/bitso/order_book.yml
|
141
|
+
- spec/fixtures/vcr_cassettes/bitso/orders/all.yml
|
142
|
+
- spec/fixtures/vcr_cassettes/bitso/orders/buy.yml
|
143
|
+
- spec/fixtures/vcr_cassettes/bitso/orders/sell/failure.yml
|
144
|
+
- spec/fixtures/vcr_cassettes/bitso/ticker.yml
|
145
|
+
- spec/fixtures/vcr_cassettes/bitso/transactions.yml
|
146
|
+
- spec/fixtures/vcr_cassettes/bitso/unconfirmed_user_deposits.yml
|
147
|
+
- spec/fixtures/vcr_cassettes/bitso/user_transactions/all.yml
|
148
|
+
- spec/fixtures/vcr_cassettes/bitso/withdraw_bitcoins/failure.yml
|
149
|
+
- spec/orders_spec.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
- spec/support/bitso_setup.rb
|
152
|
+
- spec/support/vcr.rb
|
153
|
+
- spec/transactions_spec.rb
|
154
|
+
homepage: http://github.com/arturodz/bitso
|
155
|
+
licenses:
|
156
|
+
- GPL
|
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.4.8
|
175
|
+
signing_key:
|
176
|
+
specification_version: 4
|
177
|
+
summary: Bitso Ruby API Wrapper
|
178
|
+
test_files: []
|