Class: EmpireAvenue::Client
- Inherits:
-
Object
- Object
- EmpireAvenue::Client
- Includes:
- API::Portfolio, API::Profile, API::Search, API::Shares, Configurable
- Defined in:
- lib/empireavenue/client.rb
Overview
Wrapper for the Empire Avenue API
Instance Attribute Summary
Attributes included from Configurable
#client_id, #client_secret, #connection_options, #endpoint, #identity_map, #middleware, #oauth_token, #oauth_token_secret
Instance Method Summary collapse
-
#delete(path, params = {}) ⇒ Object
Perform an HTTP DELETE request.
-
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request.
-
#initialize(options = {}) ⇒ EmpireAvenue::Client
constructor
Initializes a new Client object.
-
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request.
-
#put(path, params = {}) ⇒ Object
Perform an HTTP PUT request.
Methods included from Configurable
#configure, #credentials?, keys, #reset!
Methods included from API::Search
Methods included from API::Shares
Methods included from API::Portfolio
#portfolio_base, #portfolio_get
Methods included from API::Profile
#profile_bank_balance, #profile_info, #profile_shareholders
Constructor Details
#initialize(options = {}) ⇒ EmpireAvenue::Client
Initializes a new Client object
31 32 33 34 35 |
# File 'lib/empireavenue/client.rb', line 31 def initialize(={}) EmpireAvenue::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || EmpireAvenue.instance_variable_get(:"@#{key}")) end end |
Instance Method Details
#delete(path, params = {}) ⇒ Object
Perform an HTTP DELETE request
38 39 40 |
# File 'lib/empireavenue/client.rb', line 38 def delete(path, params={}) request(:delete, path, params) end |
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request
43 44 45 |
# File 'lib/empireavenue/client.rb', line 43 def get(path, params={}) request(:get, path, params) end |
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request
48 49 50 51 |
# File 'lib/empireavenue/client.rb', line 48 def post(path, params={}) signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params request(:post, path, params, signature_params) end |
#put(path, params = {}) ⇒ Object
Perform an HTTP PUT request
54 55 56 |
# File 'lib/empireavenue/client.rb', line 54 def put(path, params={}) request(:put, path, params) end |