excoin 0.0.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.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +32 -0
  3. data/Gemfile +13 -0
  4. data/LICENSE.txt +674 -0
  5. data/README.md +278 -0
  6. data/Rakefile +9 -0
  7. data/config/config.example.yml +16 -0
  8. data/excoin.gemspec +26 -0
  9. data/lib/account/account.rb +116 -0
  10. data/lib/account/deposit.rb +20 -0
  11. data/lib/account/order.rb +43 -0
  12. data/lib/account/orders.rb +138 -0
  13. data/lib/account/trade.rb +26 -0
  14. data/lib/account/trades.rb +59 -0
  15. data/lib/account/wallet.rb +72 -0
  16. data/lib/account/withdrawal.rb +27 -0
  17. data/lib/exchange/candlestick_chart.rb +33 -0
  18. data/lib/exchange/candlestick_data.rb +20 -0
  19. data/lib/exchange/exchange.rb +75 -0
  20. data/lib/exchange/market.rb +50 -0
  21. data/lib/exchange/order.rb +23 -0
  22. data/lib/exchange/order_depth_chart.rb +41 -0
  23. data/lib/exchange/order_depth_data.rb +23 -0
  24. data/lib/exchange/orders.rb +119 -0
  25. data/lib/exchange/trade.rb +26 -0
  26. data/lib/exchange/trades.rb +68 -0
  27. data/lib/excoin.rb +45 -0
  28. data/lib/excoin/api.rb +212 -0
  29. data/lib/excoin/version.rb +10 -0
  30. data/spec/fixtures/cassette_library/account_cancel_order_erb.yml +59 -0
  31. data/spec/fixtures/cassette_library/account_issue_order_erb.yml +59 -0
  32. data/spec/fixtures/cassette_library/account_view_order_erb.yml +59 -0
  33. data/spec/fixtures/cassette_library/exc_recent_trades.yml +157 -0
  34. data/spec/fixtures/cassette_library/exc_recent_trades_count.yml +62 -0
  35. data/spec/fixtures/cassette_library/exc_recent_trades_timestamp.yml +142 -0
  36. data/spec/fixtures/cassette_library/exchange_candlestick_chart_data.yml +58 -0
  37. data/spec/fixtures/cassette_library/exchange_candlestick_chart_data_duration.yml +58 -0
  38. data/spec/fixtures/cassette_library/exchange_open_orders.yml +58 -0
  39. data/spec/fixtures/cassette_library/exchange_open_orders_type.yml +58 -0
  40. data/spec/fixtures/cassette_library/exchange_order_depth_chart_data.yml +58 -0
  41. data/spec/fixtures/cassette_library/excoin_wallet_reserves.yml +59 -0
  42. data/spec/fixtures/cassette_library/excoin_wallets_summary.yml +65 -0
  43. data/spec/fixtures/cassette_library/excoin_wallets_summary_coin.yml +59 -0
  44. data/spec/fixtures/cassette_library/multi_exchange_summ.yml +58 -0
  45. data/spec/fixtures/cassette_library/multi_exchange_summ_currency.yml +58 -0
  46. data/spec/fixtures/cassette_library/single_exchange_summ.yml +58 -0
  47. data/spec/fixtures/cassette_library/single_exchange_summary.yml +58 -0
  48. data/spec/lib/account/account_spec.rb +136 -0
  49. data/spec/lib/account/orders_spec.rb +51 -0
  50. data/spec/lib/account/trades_spec.rb +52 -0
  51. data/spec/lib/account/wallet_spec.rb +67 -0
  52. data/spec/lib/exchange/candlestick_chart_spec.rb +23 -0
  53. data/spec/lib/exchange/exchange_spec.rb +38 -0
  54. data/spec/lib/exchange/market_spec.rb +23 -0
  55. data/spec/lib/exchange/order_depth_chart_spec.rb +20 -0
  56. data/spec/lib/exchange/orders_spec.rb +47 -0
  57. data/spec/lib/exchange/trades_spec.rb +50 -0
  58. data/spec/lib/excoin/api_spec.rb +228 -0
  59. data/spec/lib/excoin_spec.rb +28 -0
  60. data/spec/spec_helper.rb +46 -0
  61. data/spec/support/vcr.rb +21 -0
  62. metadata +209 -0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/wallet/BTC/reserves?expire=1417298276
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - b70a9391b5178ffeeb06750137384f0be521aead4f3b85e7d5db68a0b323ecdb
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sat, 29 Nov 2014 21:47:56 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - 3e3fa000-8c2e-452c-9c85-9e0919ee9678
49
+ X-Runtime:
50
+ - '0.011207'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"iso_code":"BTC","currency_name":"Bitcoin","hot_balance":"12.38711208","cold_balance":"0.00000000","block_height":"332186","last_updated":"2014-11-29
56
+ 13:19:48 UTC","hot_addresses":[{"address":"1F7GAG6KSLX8tmYH3hMqigarqmMQ3fkgtj","signature":"IFtUbxRpzuJOfzIIBWFuHYEYdCyeZ+wfjVZXIRAxJO03ohR6Cu8SpSiJEL36xkAmJLjgjxOv5GXDniAHEJLgkWE=","amount":{"fractional":"102424754.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"8.27"},{"address":"1EaG3qdk1oh2fvhwXTsv1ivxQN13C5bPUb","signature":"IBrD3/ndaalsSO7sp4tootr/GZhzl0h6nCDvqMruK226IvR5lAT7YUkDMEi9R+WoPUHnwDJgLr9UVHK7QOKqUDg=","amount":{"fractional":"7100000.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"0.57"},{"address":"12JYK2SqwKuL9qQjMynER9oKbNDH2NwYdY","signature":"H2cLtz84WGXea8g9OWbUQKvQ5h+UqdcjzHQIFkmJ9Ohen4hAr6kH2YmynsH4q4ap7jd0GlQiAsk+xO5TEimZPQw=","amount":{"fractional":"20000000.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"1.61"},{"address":"18zjLDYgiDTnF1GXauKiLcLdHeTtXKjcWa","signature":"HxB9aDS/oK025CsTPhZolixWeGHkRfGWnSHZirroORxDktACaWu7vT6R01MuR7EzadnnNlP864Ejc/CkkINROFA=","amount":{"fractional":"39771491.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"3.21"},{"address":"1GgcPkrg89KvFw6yrzPwYMN4SMJhPWQapf","signature":"IHSQ2+oiXbr+dM7LwVh2j5CHIITihY0Vc6cgXvLeIH8c/zb/6f16ZThLDKz20ff53N6QT4iZeoyJ/0PqC0vNTuo=","amount":{"fractional":"99990000.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"8.07"},{"address":"1M1scXc23JwkgyF4PjUTubT4zn8Mm6imjh","signature":"HzKRihtmLjIzNXqNkHcjuzQSlMJT6aw3IPlVHyzz48erqGejyMYImRG+FYGBhuxSFbS36F1tzdn9DLei4YFByEw=","amount":{"fractional":"826335110.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"66.71"},{"address":"1KwsPPv8ACeB7Y3ifzmNQJUBDzgXHkz2Y3","signature":"IAiGtI24JzosVgGMF1QbSGf18rNcMla5PXEHVz46vcKHiV3jMFQinOcodHwJcsJHs4n8UQ/aI8ZN4Cn8y9dkvA8=","amount":{"fractional":"1000209.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"0.08"},{"address":"1KfG5E6b6vNX7bbk7YBpV4BTny5eMRJUZD","signature":"IKmDpaW5XB9ru+yMxc9bi4YtF60r7pc5TZzCEJWTRXTZkaNFdkfWUGijVv77N31z/V2t6Mnkz8PLjeV9+oMaSa8=","amount":{"fractional":"51775.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"0.0"},{"address":"18KHbs5ueMkwqvv5eNxJJ26CmHXJ6edRKL","signature":"HxS7bZ8l88S7qlXLVJdFg/LJGsHjYJROFublW9WzPL/hFeGp4hW6XPDo964kgzVjgNLof5EX2YyfN4L9K1RhRKI=","amount":{"fractional":"1037869.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"0.08"},{"address":"1NUsj7ZHWTxwvx6dHdwcZ8fmkQ2UabncDz","signature":"IEZ136+bj+JYeWrj5+6z+F8VPLjlmNVaXEi5IFVslH7t4akKKzAcKdIAH7JtsTyiWnRzxK7ANj70LnRLqfpZSx0=","amount":{"fractional":"6000000.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"0.48"},{"address":"1Es1C8gCbCWHcse796BgBsSH2jizmdZZ6Q","signature":"IFof3zo9yio6knXs8dT1qS+4GENSegKY3jFgSY7Uqym1qIkpF4DnpBSGIqmkvY7pBzgV3/V7Io5ZAFaPbCO8/xQ=","amount":{"fractional":"130000000.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"10.49"},{"address":"13PdDaEkrikczqaHsRR7hTC118PGWgYrzx","signature":"IGjLjrk89SWlXcVcpHqhH1aT2W1Hzac3z9PhrjmR4skcS+5RxZy3W16p9PaVW8PMn7CDvDW85gYY3ylSluo6Zn8=","amount":{"fractional":"5000000.0","currency":{"id":"blk","priority":1,"iso_code":"BLK","name":"Blackcoin","symbol":"BLK","disambiguate_symbol":null,"alternate_symbols":null,"subunit":"Blackcent","subunit_to_unit":100000000,"symbol_first":true,"html_entity":null,"decimal_mark":".","thousands_separator":",","iso_numeric":null,"smallest_denomination":null},"bank":{"rounding_method":null,"rates":{"BLK_TO_BTC":1,"BTC_TO_BLK":1,"LTC_TO_BTC":1,"BTC_TO_LTC":1,"DRK_TO_BTC":1,"BTC_TO_DRK":1,"PPC_TO_BTC":1,"BTC_TO_PPC":1,"DOGE_TO_BTC":1,"BTC_TO_DOGE":1,"NBT_TO_BTC":1,"BTC_TO_NBT":1,"NSR_TO_BTC":1,"BTC_TO_NSR":1,"BLK_TO_LTC":1,"LTC_TO_BLK":1,"BLK_TO_DRK":1,"DRK_TO_BLK":1,"BLK_TO_PPC":1,"PPC_TO_BLK":1,"BLK_TO_DOGE":1,"DOGE_TO_BLK":1,"BLK_TO_NBT":1,"NBT_TO_BLK":1,"BLK_TO_NSR":1,"NSR_TO_BLK":1},"mutex":{}}},"percent_total":"0.4"}],"cold_addresses":[]}'
57
+ http_version:
58
+ recorded_at: Sat, 29 Nov 2014 21:47:56 GMT
59
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/wallets/summary?expire=1417298274
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - eb0d4e3f0fee598797b1dbc6b8a779ff7ce0ca6c2f80655d146f061607a1587b
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sat, 29 Nov 2014 21:47:55 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - c331c6ca-3e7a-4601-b597-6c6797444797
49
+ X-Runtime:
50
+ - '0.010109'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '[{"iso_code":"PPC","currency_name":"Peercoin","hot_balance":"1.88999200","cold_balance":"0.00000000","block_height":"145832","transaction_fee":"0.01000000","confirmations":"6","last_updated":"2014-11-26
56
+ 05:56:53 UTC"},{"iso_code":"NSR","currency_name":"NuShare","hot_balance":"12000.00000000","cold_balance":"0.00000000","block_height":"112339","transaction_fee":"1.00000000","confirmations":"6","last_updated":"2014-11-29
57
+ 14:44:21 UTC"},{"iso_code":"DRK","currency_name":"Darkcoin","hot_balance":"15.22592304","cold_balance":"0.00000000","block_height":"177953","transaction_fee":"0.00200000","confirmations":"6","last_updated":"2014-11-28
58
+ 00:01:25 UTC"},{"iso_code":"LTC","currency_name":"Litecoin","hot_balance":"74.41561788","cold_balance":"0.00000000","block_height":"685498","transaction_fee":"0.00200000","confirmations":"6","last_updated":"2014-11-28
59
+ 10:32:03 UTC"},{"iso_code":"DOGE","currency_name":"Dogecoin","hot_balance":"43458.00777262","cold_balance":"0.00000000","block_height":"479908","transaction_fee":"2.00000000","confirmations":"8","last_updated":"2014-11-28
60
+ 14:05:21 UTC"},{"iso_code":"BLK","currency_name":"Blackcoin","hot_balance":"165359.40579869","cold_balance":"0.00000000","block_height":"472273","transaction_fee":"0.00010000","confirmations":"10","last_updated":"2014-11-29
61
+ 18:04:16 UTC"},{"iso_code":"BTC","currency_name":"Bitcoin","hot_balance":"12.38711208","cold_balance":"0.00000000","block_height":"332186","transaction_fee":"0.00020000","confirmations":"3","last_updated":"2014-11-29
62
+ 13:19:48 UTC"}]'
63
+ http_version:
64
+ recorded_at: Sat, 29 Nov 2014 21:47:55 GMT
65
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/wallet/BTC?expire=1417298275
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - 269b5dee81a1f52978b4b18d29147c387456fdaf93cd38e654224f9ca2823eb9
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Sat, 29 Nov 2014 21:47:56 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - 9eac355c-93db-4b6e-8bd1-f9961531e0bb
49
+ X-Runtime:
50
+ - '0.007364'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"iso_code":"BTC","currency_name":"Bitcoin","hot_balance":"12.38711208","cold_balance":"0.00000000","block_height":"332186","transaction_fee":"0.00020000","confirmations":"3","last_updated":"2014-11-29
56
+ 13:19:48 UTC"}'
57
+ http_version:
58
+ recorded_at: Sat, 29 Nov 2014 21:47:56 GMT
59
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/summary?expire=1417128693
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - e2dc303854809079cd69c1ed7062416fb4fdd4372121e3b91c464b9e9d06fa99
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Thu, 27 Nov 2014 22:41:34 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - 5c85b6fd-6ba7-422f-8516-63b88809204a
49
+ X-Runtime:
50
+ - '0.187272'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '[{"currency":"BTC","commodity":"BLK","last_price":"0.00007428","high":"0.00007600","low":"0.00007200","volume":"3.23791014","top_bid":"0.00007200","lowest_ask":"0.00007423","ask_depth":"41984.31750071","ask_count":"135","bid_depth":"1.04151906","bid_count":"31"},{"currency":"BLK","commodity":"DRK","last_price":"76.00000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"76.00000000","lowest_ask":"95.00000000","ask_depth":"4.79653306","ask_count":"2","bid_depth":"3104.14482286","bid_count":"26"},{"currency":"BLK","commodity":"LTC","last_price":"175.00000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"100.00000000","lowest_ask":"106.00000000","ask_depth":"2.00000000","ask_count":"1","bid_depth":"1258.81100000","bid_count":"26"},{"currency":"BLK","commodity":"DOGE","last_price":"0.00750000","high":"0.00750000","low":"0.00700000","volume":"37.88043546","top_bid":"0.00700000","lowest_ask":"0.00000000","ask_depth":"0.00000000","ask_count":"0","bid_depth":"956.11652505","bid_count":"15"},{"currency":"BLK","commodity":"PPC","last_price":"31.99000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"31.99000000","lowest_ask":"0.00000000","ask_depth":"0.00000000","ask_count":"0","bid_depth":"763.71473219","bid_count":"16"},{"currency":"BTC","commodity":"DRK","last_price":"0.00632000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"0.00000000","lowest_ask":"0.00650000","ask_depth":"0.95598940","ask_count":"8","bid_depth":"0.00000000","bid_count":"0"},{"currency":"BTC","commodity":"LTC","last_price":"0.01000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"0.00800000","lowest_ask":"0.00999999","ask_depth":"14.13834314","ask_count":"13","bid_depth":"0.00080000","bid_count":"1"},{"currency":"BTC","commodity":"PPC","last_price":"0.00210000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"0.00000000","lowest_ask":"0.00210000","ask_depth":"1.87999200","ask_count":"12","bid_depth":"0.00000000","bid_count":"0"},{"currency":"BTC","commodity":"DOGE","last_price":"0.00000065","high":"0.00000071","low":"0.00000064","volume":"0.01002467","top_bid":"0.00000065","lowest_ask":"0.00000066","ask_depth":"1038.00000000","ask_count":"1","bid_depth":"0.00493461","bid_count":"5"}]'
56
+ http_version:
57
+ recorded_at: Thu, 27 Nov 2014 22:41:34 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/summary/BTC?expire=1417128694
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - 1ee8049724628cf6cd3e1e79a05d61935e6912ad19d25898228bbbd2308269a1
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Thu, 27 Nov 2014 22:41:34 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - 0ca843e5-7856-4067-8f86-e51a93e1455f
49
+ X-Runtime:
50
+ - '0.113758'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '[{"currency":"BTC","commodity":"BLK","last_price":"0.00007428","high":"0.00007600","low":"0.00007200","volume":"3.23791014","top_bid":"0.00007200","lowest_ask":"0.00007423","ask_depth":"41984.31750071","ask_count":"135","bid_depth":"1.04151906","bid_count":"31"},{"currency":"BTC","commodity":"DRK","last_price":"0.00632000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"0.00000000","lowest_ask":"0.00650000","ask_depth":"0.95598940","ask_count":"8","bid_depth":"0.00000000","bid_count":"0"},{"currency":"BTC","commodity":"LTC","last_price":"0.01000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"0.00800000","lowest_ask":"0.00999999","ask_depth":"14.13834314","ask_count":"13","bid_depth":"0.00080000","bid_count":"1"},{"currency":"BTC","commodity":"PPC","last_price":"0.00210000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","top_bid":"0.00000000","lowest_ask":"0.00210000","ask_depth":"1.87999200","ask_count":"12","bid_depth":"0.00000000","bid_count":"0"},{"currency":"BTC","commodity":"DOGE","last_price":"0.00000065","high":"0.00000071","low":"0.00000064","volume":"0.01002467","top_bid":"0.00000065","lowest_ask":"0.00000066","ask_depth":"1038.00000000","ask_count":"1","bid_depth":"0.00493461","bid_count":"5"}]'
56
+ http_version:
57
+ recorded_at: Thu, 27 Nov 2014 22:41:34 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/exchange/BTC/BLK/summary?expire=1417128694
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - ee66af07eae32f050bc26ce8bb78b3477e04e6970c64783e2a63fbd4ccd16d32
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Thu, 27 Nov 2014 22:41:35 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - bae57709-9f7a-411c-b526-68404d362b3d
49
+ X-Runtime:
50
+ - '0.025937'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"currency":"BTC","commodity":"BLK","last_price":"0.00007428","high":"0.00007600","low":"0.00007200","volume":"3.23791014","top_bid":"0.00007200","lowest_ask":"0.00007423","ask_depth":"41984.31750071","ask_count":"135","bid_depth":"1.04151906","bid_count":"31"}'
56
+ http_version:
57
+ recorded_at: Thu, 27 Nov 2014 22:41:35 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.exco.in/v1/exchange/BTC/BLK/summary?expire=1417461866
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Api-Key:
17
+ - 4Tas39EdsfAZ2rOFFY345wvIOMcD1IjLNdo9fudQfUdd
18
+ Api-Signature:
19
+ - ac7d301d4c007a812548710b1db5ac2cb3d30b6162a5f22ebb74af74751b8580
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Mon, 01 Dec 2014 19:14:26 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Vary:
36
+ - Accept-Encoding
37
+ Status:
38
+ - 200 OK
39
+ X-Frame-Options:
40
+ - SAMEORIGIN
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ X-Request-Id:
48
+ - cb300624-1716-4652-96d7-98ecd5db9843
49
+ X-Runtime:
50
+ - '0.031570'
51
+ Strict-Transport-Security:
52
+ - max-age=31536000; includeSubdomains;
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"currency":"BTC","commodity":"BLK","last_price":"0.00007600","high":"0.00008255","low":"0.00007050","volume":"8.36394459","top_bid":"0.00007600","lowest_ask":"0.00007810","ask_depth":"43342.28294509","ask_count":"37","bid_depth":"5.29800507","bid_count":"28"}'
56
+ http_version:
57
+ recorded_at: Mon, 01 Dec 2014 19:14:26 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,136 @@
1
+ require 'spec_helper'
2
+
3
+ describe Excoin::Account, vcr: { cassette_name: "account_summary", match_requests_on: [:method, :uri_without_timestamp], record: :new_episodes } do
4
+ subject {Excoin.account}
5
+
6
+ it "is a complete Excoin::Account object" do
7
+ expect(subject).to be_an(Excoin::Account)
8
+ expect(subject.name).to be_a(String)
9
+ expect(subject.active_wallet_count).to be_an(Integer)
10
+ expect(subject.active_wallets).to be_a(Hash)
11
+ expect(subject.inactive_wallet_count).to be_an(Integer)
12
+ expect(subject.inactive_wallets).to be_a(Hash)
13
+ expect(subject.deposit_count).to be_an(Integer)
14
+ expect(subject.withdrawal_count).to be_an(Integer)
15
+ expect(subject.orders).to be_an(Excoin::Account::Orders)
16
+ expect(subject.trades).to be_an(Excoin::Account::Trades)
17
+ end
18
+
19
+ it "active/inactive wallets in right wallets hash" do
20
+ subject.active_wallets.each_pair do |currency, wallet|
21
+ expect(wallet.status).to eq("active")
22
+ end
23
+ subject.inactive_wallets.each_pair do |currency, wallet|
24
+ expect(wallet.status).to eq("inactive")
25
+ end
26
+ end
27
+
28
+ context "transactions without currency param" do
29
+ # Passes if API doesn't connect because it makes the empty hash anyway
30
+ it ".deposits returns hash of all deposits" do
31
+ expect(subject.deposits).to be_a(Hash)
32
+ unless subject.deposits.empty?
33
+ subject.deposits.each_pair do |id, deposit_object|
34
+ expect(deposit_object).to be_a(Excoin::Account::Wallet::Deposit)
35
+ end
36
+ end
37
+ end
38
+
39
+ # Passes if API doesn't connect because it makes the empty hash anyway
40
+ it ".withdrawals returns hash of all withdrawals" do
41
+ expect(subject.withdrawals).to be_a(Hash)
42
+ unless subject.withdrawals.empty?
43
+ subject.withdrawals.each_pair do |id, withdrawal_object|
44
+ expect(withdrawal_object).to be_a(Excoin::Account::Wallet::Withdrawal)
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ context "transactions with currency param" do
51
+ it "returns hash of deposits matching currency" do
52
+ deposits_by_currency = subject.deposits($currency)
53
+ expect(deposits_by_currency).to be_a(Hash)
54
+ unless deposits_by_currency.empty?
55
+ deposits_by_currency.each_pair do |id, deposit_object|
56
+ expect(deposit_object).to be_a(Excoin::Account::Wallet::Deposit)
57
+ expect(deposit_object.currency).to eq($currency)
58
+ end
59
+ end
60
+ end
61
+
62
+ it "returns hash of withdrawals matching currency" do
63
+ withdrawals_by_currency = subject.withdrawals($currency)
64
+ expect(withdrawals_by_currency).to be_a(Hash)
65
+ unless withdrawals_by_currency.empty?
66
+ withdrawals_by_currency.each_pair do |id, withdrawal_object|
67
+ expect(withdrawal_object).to be_a(Excoin::Account::Wallet::Withdrawal)
68
+ expect(withdrawal_object.currency).to eq($currency)
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ it ".unconfirmed_deposits returns hash" do
75
+ subject.unconfirmed_deposits.each_pair do |id, deposit_object|
76
+ expect(deposit_object).to be_a(Excoin::Account::Wallet::Deposit)
77
+ expect(deposit_object.confirmed).to be false
78
+ end
79
+ end
80
+
81
+ it ".unconfirmed_withdrawals returns hash" do
82
+ subject.unconfirmed_withdrawals.each_pair do |id, withdrawal_object|
83
+ expect(withdrawal_object).to be_a(Excoin::Account::Wallet::Withdrawal)
84
+ expect(withdrawal_object.confirmed).to be false
85
+ end
86
+ end
87
+
88
+ it "has complete Wallet objects" do
89
+ unless subject.wallets.empty?
90
+ subject.wallets.each_value do |wallet|
91
+ expect(wallet).to be_an(Excoin::Account::Wallet)
92
+ expect(wallet.status).to be_a(String)
93
+ expect(wallet.currency).to be_a(String)
94
+ expect(wallet.deposit_address).to be_a(String)
95
+ if wallet.status == "active"
96
+ expect(wallet.confirmed_balance).to be_a(BigDecimal)
97
+ expect(wallet.available_balance).to be_a(BigDecimal)
98
+ expect(wallet.order_balance).to be_a(BigDecimal)
99
+ expect(wallet.pending_deposit_balance).to be_a(BigDecimal)
100
+ expect(wallet.pending_withdrawal_balance).to be_a(BigDecimal)
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ it ".wallets returns hash of all wallets" do
107
+ expect(subject.wallets.size).to eq(subject.active_wallet_count + subject.inactive_wallet_count)
108
+ end
109
+
110
+ it ".wallet(currency) returns Wallet object matching currency" do
111
+ expect(subject.wallet($currency)).to be_a(Excoin::Account::Wallet)
112
+ expect(subject.wallet($currency).currency).to eq($currency)
113
+ end
114
+
115
+ context "Excoin::Account::Order object actions" do
116
+ it ".order(id) returns an Order object matching id", vcr: { cassette_name: "account_view_order_erb", match_requests_on: [:method, :uri_without_timestamp], erb: { order_id: $order_id } } do
117
+ order = subject.order($order_id)
118
+ expect(order).to be_an(Excoin::Account::Order)
119
+ expect(order.id).to eq($order_id)
120
+ end
121
+
122
+ it "Order.refresh updates existing order with new data", vcr: { cassette_name: "account_view_order_erb", match_requests_on: [:method, :uri_without_timestamp], erb: { order_id: $order_id } } do
123
+ original_order_currency_amount = subject.order($order_id).currency_amount
124
+ subject.order($order_id).refresh
125
+ expect(subject.order($order_id).currency_amount).to_not eq(original_order_currency_amount)
126
+ end
127
+
128
+ it "Order.cancel cancels and updates selected order", vcr: { cassette_name: "account_cancel_order_erb", match_requests_on: [:method, :uri_without_timestamp], erb: { order_id: $order_id } } do
129
+ pp subject.order($order_id)
130
+ subject.order($order_id).cancel
131
+ pp subject.order($order_id)
132
+ expect(subject.order($order_id).status).to eq("CLOSED")
133
+ end
134
+ end
135
+
136
+ end