Class: Cex::Apifr
- Inherits:
-
Object
- Object
- Cex::Apifr
- Defined in:
- lib/cex/apifr.rb
Overview
classe para processar dados no paymium
Instance Attribute Summary collapse
-
#aky ⇒ String
readonly
API key.
-
#asc ⇒ String
readonly
API secret.
-
#urb ⇒ String
readonly
API url base.
Instance Method Summary collapse
-
#account ⇒ Hash
Saldos no paymium.
-
#initialize(pky: ENV['PAYMIUM_API_KEY'], psc: ENV['PAYMIUM_API_SECRET'], ops: { www: 'https://paymium.com', ver: 1 }) ⇒ Apius
constructor
API paymium base.
-
#ledger(pag = 0, ary = []) ⇒ Hash
Ledger no paymium.
Constructor Details
#initialize(pky: ENV['PAYMIUM_API_KEY'], psc: ENV['PAYMIUM_API_SECRET'], ops: { www: 'https://paymium.com', ver: 1 }) ⇒ Apius
Returns API paymium base.
23 24 25 26 27 28 29 30 31 |
# File 'lib/cex/apifr.rb', line 23 def initialize( pky: ENV['PAYMIUM_API_KEY'], psc: ENV['PAYMIUM_API_SECRET'], ops: { www: 'https://paymium.com', ver: 1 } ) @aky = pky @asc = psc @urb = "#{ops[:www]}/api/v#{ops[:ver]}" end |
Instance Attribute Details
#aky ⇒ String (readonly)
Returns API key.
13 14 15 |
# File 'lib/cex/apifr.rb', line 13 def aky @aky end |
#asc ⇒ String (readonly)
Returns API secret.
15 16 17 |
# File 'lib/cex/apifr.rb', line 15 def asc @asc end |
#urb ⇒ String (readonly)
Returns API url base.
17 18 19 |
# File 'lib/cex/apifr.rb', line 17 def urb @urb end |
Instance Method Details
#account ⇒ Hash
Returns saldos no paymium.
48 49 50 |
# File 'lib/cex/apifr.rb', line 48 def account api_get('user') end |
#ledger(pag = 0, ary = []) ⇒ Hash
Returns ledger no paymium.
78 79 80 81 82 83 |
# File 'lib/cex/apifr.rb', line 78 def ledger(pag = 0, ary = []) r = api_get('user/orders', offset: pag) r.empty? ? ary : ledger(pag + r.size, ary + r) rescue StandardError ary end |