Class: OandaAPI::Client::UsernameClient
- Inherits:
-
Object
- Object
- OandaAPI::Client::UsernameClient
- Includes:
- OandaAPI::Client
- Defined in:
- lib/oanda_api/client/username_client.rb
Overview
Makes requests to the API. Instances access the Oanda sandbox environment. Most client requests require a valid Oanda sandbox account username. See the Oanda Development Guide for information about creating a test account.
Constant Summary
Constants included from OandaAPI::Client
Instance Attribute Summary collapse
-
#default_params ⇒ Hash
Parameters that are included with every API request as either query or url_form encoded parameters.
-
#domain ⇒ Symbol
readonly
Identifies the Oanda subdomain (+:sandbox+) which the client accesses.
-
#headers ⇒ Hash
Parameters that are included with every API request as HTTP headers.
-
#username ⇒ String
readonly
The username used for authentication.
Instance Method Summary collapse
-
#auth ⇒ Hash
Parameters used for authentication.
-
#initialize(username) ⇒ UsernameClient
constructor
A new instance of UsernameClient.
Methods included from OandaAPI::Client
#api_uri, #execute_request, last_throttled_at, map_method_to_http_verb, #proc, throttle_request_rate
Constructor Details
#initialize(username) ⇒ UsernameClient
Returns a new instance of UsernameClient.
38 39 40 41 42 43 44 |
# File 'lib/oanda_api/client/username_client.rb', line 38 def initialize(username) super() @domain = :sandbox @username = username @default_params = auth @headers = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OandaAPI::Client
Instance Attribute Details
#default_params ⇒ Hash
Returns parameters that are included with every API request as either query or url_form encoded parameters.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/oanda_api/client/username_client.rb', line 31 class UsernameClient include Client attr_reader :domain, :username attr_accessor :default_params, :headers # @param [String] username used for authentication. def initialize(username) super() @domain = :sandbox @username = username @default_params = auth @headers = {} end # Parameters used for authentication. # @return [Hash] def auth { "username" => @username } end end |
#domain ⇒ Symbol (readonly)
Returns identifies the Oanda subdomain (+:sandbox+) which the client accesses.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/oanda_api/client/username_client.rb', line 31 class UsernameClient include Client attr_reader :domain, :username attr_accessor :default_params, :headers # @param [String] username used for authentication. def initialize(username) super() @domain = :sandbox @username = username @default_params = auth @headers = {} end # Parameters used for authentication. # @return [Hash] def auth { "username" => @username } end end |
#headers ⇒ Hash
Returns parameters that are included with every API request as HTTP headers.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/oanda_api/client/username_client.rb', line 31 class UsernameClient include Client attr_reader :domain, :username attr_accessor :default_params, :headers # @param [String] username used for authentication. def initialize(username) super() @domain = :sandbox @username = username @default_params = auth @headers = {} end # Parameters used for authentication. # @return [Hash] def auth { "username" => @username } end end |
#username ⇒ String (readonly)
Returns the username used for authentication.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/oanda_api/client/username_client.rb', line 31 class UsernameClient include Client attr_reader :domain, :username attr_accessor :default_params, :headers # @param [String] username used for authentication. def initialize(username) super() @domain = :sandbox @username = username @default_params = auth @headers = {} end # Parameters used for authentication. # @return [Hash] def auth { "username" => @username } end end |
Instance Method Details
#auth ⇒ Hash
Parameters used for authentication.
48 49 50 |
# File 'lib/oanda_api/client/username_client.rb', line 48 def auth { "username" => @username } end |