Class: Bitreserve::Client
- Inherits:
-
Object
- Object
- Bitreserve::Client
- Includes:
- API
- Defined in:
- lib/bitreserve/client.rb
Instance Attribute Summary collapse
-
#bearer_token ⇒ Object
readonly
Returns the value of attribute bearer_token.
Instance Method Summary collapse
- #authorization_header ⇒ Object
- #bearer_token? ⇒ Boolean
-
#initialize(token: ENV['BITRESERVE_AUTH_TOKEN']) ⇒ Client
constructor
A new instance of Client.
Methods included from API::User
Methods included from API::Transparency
Methods included from API::Ticker
Methods included from API::PublicTransaction
#all_public_transactions, #find_public_transaction
Methods included from API::PrivateTransaction
#all_card_transactions, #all_user_transactions, #cancel_transaction, #commit_transaction, #create_transaction, #resend_transaction
Methods included from API::Contact
#all_contacts, #create_contact, #find_contact
Methods included from API::Card
#all_cards, #create_card, #find_card
Methods included from API::AuthToken
Constructor Details
#initialize(token: ENV['BITRESERVE_AUTH_TOKEN']) ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/bitreserve/client.rb', line 8 def initialize(token: ENV['BITRESERVE_AUTH_TOKEN']) @bearer_token = token end |
Instance Attribute Details
#bearer_token ⇒ Object (readonly)
Returns the value of attribute bearer_token.
6 7 8 |
# File 'lib/bitreserve/client.rb', line 6 def bearer_token @bearer_token end |
Instance Method Details
#authorization_header ⇒ Object
16 17 18 19 20 |
# File 'lib/bitreserve/client.rb', line 16 def return {} unless bearer_token? { 'Authorization' => "Bearer #{bearer_token}" } end |
#bearer_token? ⇒ Boolean
12 13 14 |
# File 'lib/bitreserve/client.rb', line 12 def bearer_token? !bearer_token.nil? end |