Class: LocalBitcoins::Client

Inherits:
Object
  • Object
show all
Includes:
Ads, Contacts, Escrows, Markets, Public, Request, Users, Wallet
Defined in:
lib/localbitcoins/client.rb

Constant Summary

Constants included from Public

Public::ROOT

Constants included from Markets

Markets::ROOT

Constants included from Request

Request::API_URL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Public

#currencies, #local_buy_ad, #local_sell_ad, #online_buy_ads_lookup, #online_sell_ads_lookup, #payment_methods, #places

Methods included from Wallet

#valid_pin?, #wallet, #wallet_addr, #wallet_balance, #wallet_pin_send, #wallet_send

Methods included from Markets

#orderbook, #ticker, #trades

Methods included from Contacts

#active_contacts, #cancel_contact, #canceled_contacts, #closed_contacts, #contact_info, #contacts_info, #create_contact, #dispute_contact, #fund_contact, #mark_contact_as_paid, #message_contact, #messages_from_contact, #released_contacts

Methods included from Users

#account_info, #logout, #myself

Methods included from Ads

#ad, #ad_list, #ads, #create_ad, #update_ad

Methods included from Escrows

#escrow_release, #escrows

Constructor Details

#initialize(options = {}) ⇒ Client

Initialize a LocalBitcoins::Client instance

options options options



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/localbitcoins/client.rb', line 31

def initialize(options={})
  unless options.kind_of?(Hash)
    raise ArgumentError, "Options hash required."
  end

  @oauth_client = OAuth2::Client.new(
    options[:client_id],
    options[:client_secret],
    authorize_url: "/oauth2/authorize",
    token_url: "/oauth2/access_token",
    site: "https://localbitcoins.com"
  )

  @access_token = OAuth2::AccessToken.new(
    oauth_client,
    options[:oauth_token]
  ) 
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



23
24
25
# File 'lib/localbitcoins/client.rb', line 23

def access_token
  @access_token
end

#oauth_clientObject (readonly)

Returns the value of attribute oauth_client.



23
24
25
# File 'lib/localbitcoins/client.rb', line 23

def oauth_client
  @oauth_client
end