btce 0.2.4 → 0.3.0

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.
@@ -39,7 +39,7 @@ module Btce
39
39
  end
40
40
 
41
41
  def trade
42
- json["trade"]
42
+ json[pair]
43
43
  end
44
44
  end
45
45
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013, Christopher Mark Gore,
1
+ # Copyright (c) 2013-2014, Christopher Mark Gore,
2
2
  # Soli Deo Gloria,
3
3
  # All rights reserved.
4
4
  #
@@ -38,20 +38,24 @@ module Btce
38
38
  super 'ticker', pair
39
39
  end
40
40
 
41
- JSON_METHODS = %w(high low avg vol vol_cur last buy sell server_time)
41
+ JSON_METHODS = %w(high low avg vol vol_cur last buy sell updated)
42
42
 
43
43
  JSON_METHODS.each do |method|
44
44
  class_eval %{
45
45
  def #{method}
46
- json["ticker"]["#{method}"] if json["ticker"] and json["ticker"].is_a? Hash
46
+ json[@pair]["#{method}"] if json[@pair] and json[@pair].is_a? Hash
47
47
  end
48
48
  }
49
49
  end
50
50
 
51
51
  alias_method :bid, :buy
52
52
  alias_method :offer, :sell
53
+
53
54
  alias_method :ask, :sell
54
55
  alias_method :average, :avg
56
+
57
+ alias_method :server_time, :updated
58
+
55
59
  alias_method :volume, :vol
56
60
  alias_method :volume_current, :vol_cur
57
61
 
@@ -38,9 +38,14 @@ module Btce
38
38
 
39
39
  class << self
40
40
  def get_pair_operation_json(pair, operation)
41
- raise ArgumentError if not API::CURRENCY_PAIRS.include? pair
41
+ list = pair.split('-')
42
+ i = 0
43
+ begin
44
+ raise ArgumentError if not API::CURRENCY_PAIRS.include? list[i]
45
+ i = i + 1
46
+ end while i < list.length
42
47
  raise ArgumentError if not OPERATIONS.include? operation
43
- get_json({ :url => "https://#{API::BTCE_DOMAIN}/api/2/#{pair}/#{operation}" })
48
+ get_json({ :url => "https://#{API::BTCE_DOMAIN}/api/3/#{operation}/#{pair}" })
44
49
  end
45
50
 
46
51
  OPERATIONS.each do |operation|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: btce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,12 +11,13 @@ authors:
11
11
  - Christopher Mark Gore
12
12
  - Stephan Kaag
13
13
  - Sami Laine
14
+ - Selvam Palanimalai
14
15
  - Jaime Quint
15
16
  - Michaël Witrant
16
17
  autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
- date: 2013-12-10 00:00:00.000000000 Z
20
+ date: 2014-01-04 00:00:00.000000000 Z
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: monkey-patch