bittrex 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cd849c0f70e937b817ebf384aba50c95749106e
4
- data.tar.gz: 11d2cb28dd38cfc46e2c66b5ecc28ab94eb0704b
3
+ metadata.gz: 3deff4d67afa6d177474b50f61c96555e01d4237
4
+ data.tar.gz: 0a0b94bf9f4577c679da4a52a8c0c85d7c4064a1
5
5
  SHA512:
6
- metadata.gz: 711d86b97047ae0deb9d2979990d3fef5245c0d580da6b8ceeb0eaccb2dcb07499ad041e0eb04870c3624b59f46c0e67f0575c1faa31f8599d3e79d118726f00
7
- data.tar.gz: d9d64dba3ac81e59faaf4de5ac19683884e634058d2a236a9cfd00665eee3a0dac0048778e1f1b52f28748b2e5c0cae79d83c755ecbcff3948b9202c6524fd45
6
+ metadata.gz: 9139ad753901cc960de237d182ee302023fa37c0d4aabca9f3654d085012869fe9a5dd720952ab68163154e95361dbd7f70e159cf4e8a12abc4e724c6b9518aa
7
+ data.tar.gz: 81491a2f5d641e957287ec4341b4adee5a2919f2b548da9f9cab0a18aa1028a131c8223f54329a479c2674e82fcbdb10545d3b0d05035ba19b8345d504ebfdb6
data/.gitignore CHANGED
@@ -23,3 +23,6 @@ tmp
23
23
  *.a
24
24
  mkmf.log
25
25
  script
26
+
27
+ # Ignore application configuration
28
+ /config/application.yml
@@ -0,0 +1 @@
1
+ 2.3.3
data/README.md CHANGED
@@ -16,6 +16,34 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install bittrex
18
18
 
19
+ ## Usage
20
+
21
+ The gem uses a simple mapping of API resources to models, with a majority of the attributes mapped to corresponding attributes on the corresponding class. There are some translations into a more "rubyish" verbage, but for the most part things are directly mapped.
22
+
23
+ require 'rubygems'
24
+ require 'bittrex'
25
+ >> Quote.current('BTC-LTC')
26
+ #=> #<Bittrex::Quote:0x000001015cd058 @market="BTC-LTC", @bid=0.015792, @ask=0.01602899, @last=0.015792, @raw={"Bid"=>0.015792, "Ask"=>0.01602899, "Last"=>0.015792}>
27
+
28
+ ## Authentication
29
+
30
+ You can authenticate access to your Bittrex account by configuring your implementation of the bittrex gem. This is accomplished by using a config block at the top of your application.
31
+
32
+ Set up your keys at: https://bittrex.com/Manage#sectionApi
33
+
34
+ Bittrex.config do |c|
35
+ c.key = 'my_api_key'
36
+ c.secret = 'my_api_secret'
37
+ end
38
+
39
+ ## Development
40
+
41
+ You can test out public API calls any time by running `bundle exec rake bittrex:console` and inputting your method.
42
+
43
+ If you want to test private API calls, you will need to create `config/application.yml` and add your Bittrex keys to it (`config/application.yml.example` provides a template for this).
44
+
45
+ Once you've added the API keys, run `bundle exec rake bittrex:console`
46
+
19
47
  ## Contributing
20
48
 
21
49
  1. Fork it ( https://github.com/[my-github-username]/bittrex/fork )
data/Rakefile CHANGED
@@ -1,2 +1,11 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'figaro'
2
3
 
4
+ Figaro.application.path = File.expand_path('../config/application.yml', __FILE__)
5
+ Figaro.load
6
+
7
+ namespace :bittrex do
8
+ task :console do
9
+ exec "irb -r bittrex -I ./lib"
10
+ end
11
+ end
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rspec"
26
26
  spec.add_development_dependency "simplecov"
27
27
  spec.add_development_dependency "mocha"
28
+ spec.add_development_dependency "figaro"
28
29
  end
@@ -0,0 +1,2 @@
1
+ bittrex_api_key: xxx
2
+ bittrex_api_secret: xxx
@@ -10,7 +10,7 @@ module Bittrex
10
10
  autoload :Quote, 'bittrex/quote'
11
11
  autoload :Summary, 'bittrex/summary'
12
12
  autoload :Wallet, 'bittrex/wallet'
13
- autoload :Withdrawl, 'bittrex/withdrawl'
13
+ autoload :Withdrawal, 'bittrex/withdrawal'
14
14
 
15
15
  def self.client
16
16
  @client ||= Client.new(configuration.auth)
@@ -1,5 +1,6 @@
1
1
  require 'faraday'
2
2
  require 'base64'
3
+ require 'json'
3
4
 
4
5
  module Bittrex
5
6
  class Client
@@ -7,8 +7,8 @@ module Bittrex
7
7
  attr_accessor :key, :secret
8
8
 
9
9
  @@defaults = {
10
- key: nil,
11
- secret: nil
10
+ key: ENV['bittrex_api_key'],
11
+ secret: ENV['bittrex_api_secret']
12
12
  }
13
13
 
14
14
  def self.defaults
@@ -1,3 +1,5 @@
1
+ require 'time'
2
+
1
3
  module Bittrex
2
4
  class Market
3
5
  attr_reader :name, :currency, :base, :currency_name, :base_name, :minimum_trade, :active, :created_at, :raw
@@ -1,3 +1,3 @@
1
1
  module Bittrex
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -14,7 +14,7 @@ module Bittrex
14
14
  end
15
15
 
16
16
  def self.all
17
- client.get('account/getbalances').values.map{|data| new(data) }
17
+ client.get('account/getbalances').map{|data| new(data) }
18
18
  end
19
19
 
20
20
  private
@@ -1,5 +1,5 @@
1
1
  module Bittrex
2
- class Withdrawl
2
+ class Withdrawal
3
3
  attr_reader :id, :currency, :quantity, :address, :authorized,
4
4
  :pending, :canceled, :invalid_address,
5
5
  :transaction_cost, :transaction_id, :executed_at
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Bittrex::Withdrawl do
4
- let(:data){ fixture(:withdrawl) }
5
- let(:subject){ Bittrex::Withdrawl.new(data) }
3
+ describe Bittrex::Withdrawal do
4
+ let(:data){ fixture(:withdrawal) }
5
+ let(:subject){ Bittrex::Withdrawal.new(data) }
6
6
 
7
7
  describe '#initialization' do
8
8
  it { should_assign_attribute(subject, :id, 'c7f7b806-36cf-4xxx-b198-fcdeb1220762') }
@@ -10,7 +10,7 @@ Dir[File.join(Bittrex.root, 'spec/support/**/*.rb')].each {|f| require f}
10
10
 
11
11
  RSpec.configure do |config|
12
12
  config.before(:each) do
13
- Bittrex.stub(:client)
13
+ allow(Bittrex).to receive(:client)
14
14
  end
15
15
  end
16
16
 
@@ -20,5 +20,5 @@ def fixture(resource)
20
20
  end
21
21
 
22
22
  def should_assign_attribute(subject, method, value)
23
- subject.send(method).should eq(value)
23
+ expect(subject.send(method)).to eq(value)
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bittrex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-26 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: figaro
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'
97
111
  description: API Client for the Bittrex API
98
112
  email:
99
113
  - m@mjw.io
@@ -102,11 +116,13 @@ extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
104
118
  - ".gitignore"
119
+ - ".ruby-version"
105
120
  - Gemfile
106
121
  - LICENSE.txt
107
122
  - README.md
108
123
  - Rakefile
109
124
  - bittrex.gemspec
125
+ - config/application.yml.example
110
126
  - lib/bittrex.rb
111
127
  - lib/bittrex/client.rb
112
128
  - lib/bittrex/configuration.rb
@@ -118,7 +134,7 @@ files:
118
134
  - lib/bittrex/summary.rb
119
135
  - lib/bittrex/version.rb
120
136
  - lib/bittrex/wallet.rb
121
- - lib/bittrex/withdrawl.rb
137
+ - lib/bittrex/withdrawal.rb
122
138
  - spec/fixtures/currency.json
123
139
  - spec/fixtures/deposit.json
124
140
  - spec/fixtures/market.json
@@ -126,7 +142,7 @@ files:
126
142
  - spec/fixtures/quote.json
127
143
  - spec/fixtures/summary.json
128
144
  - spec/fixtures/wallet.json
129
- - spec/fixtures/withdrawl.json
145
+ - spec/fixtures/withdrawal.json
130
146
  - spec/models/configuration_spec.rb
131
147
  - spec/models/currency_spec.rb
132
148
  - spec/models/deposit_spec.rb
@@ -135,7 +151,7 @@ files:
135
151
  - spec/models/quote_spec.rb
136
152
  - spec/models/summary_spec.rb
137
153
  - spec/models/wallet_spec.rb
138
- - spec/models/withdrawl_spec.rb
154
+ - spec/models/withdrawal_spec.rb
139
155
  - spec/spec_helper.rb
140
156
  - spec/support/api_helper.rb
141
157
  homepage: https://github.com/mwerner/bittrex
@@ -158,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
174
  version: '0'
159
175
  requirements: []
160
176
  rubyforge_project:
161
- rubygems_version: 2.2.2
177
+ rubygems_version: 2.6.13
162
178
  signing_key:
163
179
  specification_version: 4
164
180
  summary: API Client for the Bittrex API
@@ -170,7 +186,7 @@ test_files:
170
186
  - spec/fixtures/quote.json
171
187
  - spec/fixtures/summary.json
172
188
  - spec/fixtures/wallet.json
173
- - spec/fixtures/withdrawl.json
189
+ - spec/fixtures/withdrawal.json
174
190
  - spec/models/configuration_spec.rb
175
191
  - spec/models/currency_spec.rb
176
192
  - spec/models/deposit_spec.rb
@@ -179,6 +195,6 @@ test_files:
179
195
  - spec/models/quote_spec.rb
180
196
  - spec/models/summary_spec.rb
181
197
  - spec/models/wallet_spec.rb
182
- - spec/models/withdrawl_spec.rb
198
+ - spec/models/withdrawal_spec.rb
183
199
  - spec/spec_helper.rb
184
200
  - spec/support/api_helper.rb