paytunia 0.1.1 → 0.1.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.
@@ -6,11 +6,4 @@ Signal.trap("INT") { exit 1 }
6
6
 
7
7
  require 'paytunia'
8
8
 
9
- print "Account ID : "
10
- username = $stdin.gets.chomp
11
-
12
- print "Password : "
13
- password = STDIN.noecho { $stdin.gets }.chomp
14
- print "\n"
15
-
16
- puts Paytunia::Connection.send(ARGV[0])
9
+ puts Paytunia::Connection.send(ARGV[0]).to_json
@@ -22,6 +22,12 @@ module JSON
22
22
  end
23
23
  end
24
24
 
25
+ class BigDecimal
26
+ def to_json(*)
27
+ to_s('F')
28
+ end
29
+ end
30
+
25
31
  module HTTParty
26
32
  class Parser
27
33
  def json
@@ -1,7 +1,7 @@
1
1
  module Paytunia
2
2
  module Api
3
3
  class AccountOperation < Base
4
- attr_accessor :uuid, :amount, :currency, :created_at, :state, :type, :balance
4
+ attrs :uuid, :amount, :currency, :created_at, :state, :type, :balance
5
5
  end
6
6
  end
7
7
  end
@@ -7,6 +7,24 @@ module Paytunia
7
7
  send("#{k}=", val)
8
8
  end
9
9
  end
10
+
11
+ def self.inherited(child)
12
+ child.instance_eval do
13
+ def attrs(*args)
14
+ attr_accessor *args
15
+ @attr_list = args
16
+ end
17
+ end
18
+ end
19
+
20
+ def to_json(*args)
21
+ h = self.class.instance_variable_get(:@attr_list).inject({}) do |memo, att|
22
+ memo[att] = send(att)
23
+ memo
24
+ end
25
+
26
+ JSON.generate(h)
27
+ end
10
28
  end
11
29
  end
12
30
  end
@@ -1,7 +1,7 @@
1
1
  module Paytunia
2
2
  module Api
3
3
  class Depth < Base
4
- attr_accessor :amount, :price, :timestamp, :currency
4
+ attrs :amount, :price, :timestamp, :currency
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Paytunia
2
2
  module Api
3
3
  class Ticker < Base
4
- attr_accessor :high, :low, :volume, :bid, :ask, :midpoint, :at, :price, :variation, :currency
4
+ attrs :high, :low, :volume, :bid, :ask, :midpoint, :at, :price, :variation, :currency
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Paytunia
2
2
  module Api
3
3
  class Trade < Base
4
- attr_accessor :uuid, :traded_currency, :traded_btc, :currency, :price, :created_at
4
+ attrs :uuid, :traded_currency, :traded_btc, :currency, :price, :created_at
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Paytunia
2
2
  module Api
3
3
  class TradeOrder < Base
4
- attr_accessor :uuid, :amount, :currency, :price, :type, :state, :instructed_amount, :created_at, :updated_at
4
+ attrs :uuid, :amount, :currency, :price, :type, :state, :instructed_amount, :created_at, :updated_at
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Paytunia
2
2
 
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paytunia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-28 00:00:00.000000000 Z
13
+ date: 2013-03-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: oauth2