Class: Paytunia::Connection
- Inherits:
-
Object
- Object
- Paytunia::Connection
show all
- Includes:
- HTTParty, Api, Singleton
- Defined in:
- lib/paytunia/connection.rb
Constant Summary
collapse
- APP_ID =
'6fcf1c32f6e14cd773a7a6640832bdbf83a5b2b8d4382e839c6aff83a8f1bb3b'
- APP_SECRET =
'55554ecad5627f0465034c4a116e59a38d9c3ab272487a18404078ccc0b64798'
- CA_FILE =
File.dirname(__FILE__) + '/../../certs/ca-certificates.crt'
- SITE =
'https://bitcoin-central.net/api/v1'
Instance Method Summary
collapse
Methods included from Api
#get_depth, #get_ledger, #get_operation, #get_ticker, #get_trade_order, #get_trades_for_order, #list_active_orders, #list_orders, #post_trade_order, #send_bitcoins
Instance Method Details
#account ⇒ Object
25
26
27
|
# File 'lib/paytunia/connection.rb', line 25
def account
@basic_auth_wrapper || @oauth2_wrapper || raise('No authenticated connection available')
end
|
#connect(credentials = nil) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/paytunia/connection.rb', line 29
def connect(credentials = nil)
if credentials[:basic_auth]
do_basic_auth_connect!(credentials[:basic_auth][:username], credentials[:basic_auth][:password])
end
if credentials[:oauth2] && !@basic_auth_wrapper
do_oauth2_connect!(credentials[:oauth2][:username],
credentials[:oauth2][:password],
credentials[:oauth2][:access_token]
)
end
unless @basic_auth_wrapper || @oauth2_wrapper
raise 'No credentials provided, unable to request them interactively'
end
self
end
|
#get(url) ⇒ Object
21
22
23
|
# File 'lib/paytunia/connection.rb', line 21
def get(url)
self.class.get(SITE + url)
end
|