bitstamp-2 0.7.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1182acafa8d898c11c64b9e365cc1d6e8a8e1786
4
- data.tar.gz: f84bdca5f51de2607c9a357ee5e540a73a26f03c
3
+ metadata.gz: 0bd43f1e1aec7becfe4ebe4c8a3413df6029c1b4
4
+ data.tar.gz: 4f6e67757fd35fcdf9927f4cd70de30996c43b6e
5
5
  SHA512:
6
- metadata.gz: 049d4f8e52b48bd7153f47915cfc1c472f7f746907a0bd2d3aee0140102d415f8b1d22485fc4ee938a906ae9ba15b1416be0e37c84ce29d1b0dcb6bb672b3abb
7
- data.tar.gz: 5a092c8ba4994543f7a80e8cf85a16fd7cfb03add66408bccbba1f785fe53fcfe33a73b5b32173944d4303457975e6fc290b170533b81a20f748ccdb09e61c3e
6
+ metadata.gz: 7534c7d965f05ad4fd1a5862896f5b8f0aa14fc9b1c0b7d655b461ce506aae01267f727b67827be0ce217eb4e58a1472cc1da1bb03ac11b3b6c43d1b2a614345
7
+ data.tar.gz: ce927331dc9418a41444b824a495e6fd8a0817591303d67af119809dab5cea99d808e64b77a486e4f0fc526677ea5ed9264a46d699539507b7aa6cbdf20e3043
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitstamp-2 (0.7.0)
4
+ bitstamp-2 (0.7.1)
5
5
  activemodel (>= 3.1)
6
6
  activesupport (>= 3.1)
7
7
  httpi (~> 2.4.1)
@@ -6,7 +6,7 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bitstamp-2"
9
- s.version = "0.7.0"
9
+ s.version = "0.7.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Jeffrey Wilcke", "Codelitt Inc."]
@@ -84,7 +84,7 @@ module Bitstamp
84
84
  SELL = 1
85
85
 
86
86
  attr_accessor :type, :amount, :price, :id, :datetime, :status
87
- attr_accessor :error, :message
87
+ attr_accessor :error, :message, :reason
88
88
 
89
89
  def cancel!
90
90
  Bitstamp::Net.post('/cancel_order', {id: self.id}).body
@@ -26,8 +26,6 @@ describe Bitstamp::Orders do
26
26
  describe 'market orders' do
27
27
  before do
28
28
  VCR.turn_off!
29
- stub_request(:post, "https://www.bitstamp.net/api/v2/buy/market/btcusd/")
30
- .to_return(status: 200, body: fixture('successful_order_bitstamp.json'), headers: { 'Content-Type' => 'application/json' })
31
29
  end
32
30
 
33
31
  after do
@@ -35,10 +33,21 @@ describe Bitstamp::Orders do
35
33
  end
36
34
 
37
35
  it 'is successfully executed' do
36
+ stub_request(:post, "https://www.bitstamp.net/api/v2/buy/market/btcusd/")
37
+ .to_return(status: 200, body: fixture('successful_order_bitstamp.json'), headers: { 'Content-Type' => 'application/json' })
38
38
  executed_order = Bitstamp.orders.market_buy(:amount => 1, :price => 1000)
39
39
  expect(executed_order).to be_kind_of Bitstamp::Order
40
40
  expect(executed_order.price).to eq "1.25"
41
41
  end
42
+
43
+ it 'throws an error' do
44
+ stub_request(:post, "https://www.bitstamp.net/api/v2/buy/market/btcusd/")
45
+ .to_return(status: 200, body: fixture('market_order_error.json'), headers: { 'Content-Type' => 'application/json' })
46
+ executed_order = Bitstamp.orders.market_buy(:amount => 1, :price => 1000)
47
+ expect(executed_order.price).to be_nil
48
+ expect(executed_order.reason).not_to be_nil
49
+ expect(executed_order.status).to eq 'error'
50
+ end
42
51
  end
43
52
 
44
53
  describe :buy, vcr: {cassette_name: 'bitstamp/orders/buy'} do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitstamp-2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Wilcke