Class: MT::DataAPI::Client::EndpointManager
- Inherits:
-
Object
- Object
- MT::DataAPI::Client::EndpointManager
- Defined in:
- lib/mt/data_api/client/endpoint_manager.rb
Overview
Retrieve and find endpoints
Constant Summary collapse
- DEFAULT_API_VERSION =
3- LIST_ENDPOINTS_HASH =
{ 'id' => 'list_endpoints', 'route' => '/endpoints', 'version' => 1, 'verb' => 'GET' }.freeze
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#endpoints ⇒ Object
Returns the value of attribute endpoints.
Instance Method Summary collapse
- #find_endpoint(id) ⇒ Object
-
#initialize(opts) ⇒ EndpointManager
constructor
A new instance of EndpointManager.
Constructor Details
#initialize(opts) ⇒ EndpointManager
Returns a new instance of EndpointManager.
21 22 23 24 25 26 |
# File 'lib/mt/data_api/client/endpoint_manager.rb', line 21 def initialize(opts) raise parameter_should_be_hash unless opts.is_a? Hash initialize_parameters(opts.symbolize_keys) raise invalid_parameter unless @base_url && @client_id Endpoint.api_url = api_url end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
19 20 21 |
# File 'lib/mt/data_api/client/endpoint_manager.rb', line 19 def access_token @access_token end |
#endpoints ⇒ Object
Returns the value of attribute endpoints.
18 19 20 |
# File 'lib/mt/data_api/client/endpoint_manager.rb', line 18 def endpoints @endpoints end |
Instance Method Details
#find_endpoint(id) ⇒ Object
28 29 30 31 |
# File 'lib/mt/data_api/client/endpoint_manager.rb', line 28 def find_endpoint(id) hash = find_endpoint_hash(id) hash ? Endpoint.new(hash) : nil end |