Class: BandCampBX::Client
- Inherits:
-
Object
- Object
- BandCampBX::Client
- Defined in:
- lib/bandcampbx/client.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
- #balance ⇒ Object
- #buy!(quantity, price, order_type) ⇒ Object
- #cancel(id, type) ⇒ Object
-
#initialize(key = nil, secret = nil) ⇒ Client
constructor
A new instance of Client.
- #orders ⇒ Object
- #sell!(quantity, price, order_type) ⇒ Object
Constructor Details
#initialize(key = nil, secret = nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/bandcampbx/client.rb', line 10 def initialize(key = nil, secret = nil) @key = key @secret = secret end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
7 8 9 |
# File 'lib/bandcampbx/client.rb', line 7 def key @key end |
#secret ⇒ Object
Returns the value of attribute secret.
8 9 10 |
# File 'lib/bandcampbx/client.rb', line 8 def secret @secret end |
Instance Method Details
#balance ⇒ Object
15 16 17 |
# File 'lib/bandcampbx/client.rb', line 15 def balance mapper.map_balance(net.post("myfunds.php")) end |
#buy!(quantity, price, order_type) ⇒ Object
23 24 25 |
# File 'lib/bandcampbx/client.rb', line 23 def buy!(quantity, price, order_type) trade!("tradeenter.php", quantity, price, order_type) end |
#cancel(id, type) ⇒ Object
31 32 33 34 35 |
# File 'lib/bandcampbx/client.rb', line 31 def cancel(id, type) wrapping_standard_error do mapper.map_cancel(net.post("tradecancel.php", { id: id.to_s, type: type.to_s })) end end |
#orders ⇒ Object
19 20 21 |
# File 'lib/bandcampbx/client.rb', line 19 def orders mapper.map_orders(net.post("myorders.php")) end |
#sell!(quantity, price, order_type) ⇒ Object
27 28 29 |
# File 'lib/bandcampbx/client.rb', line 27 def sell!(quantity, price, order_type) trade!("tradeenter.php", quantity, price, order_type) end |