Class: WrAPI::API
- Inherits:
-
Object
- Object
- WrAPI::API
- Includes:
- Authentication, Connection, Request
- Defined in:
- lib/wrapi/api.rb
Overview
The API class is responsible for managing the configuration and connections for the WrAPI library. It includes modules for handling connections, requests, and authentication.
Constant Summary
Constants included from Request
Instance Method Summary collapse
-
#config ⇒ Hash
Returns a hash of configuration options and their values.
-
#initialize(options = {}) ⇒ WrAPI::API
constructor
Initializes a new API object with the given options.
Methods included from Authentication
Methods included from Request
#delete, #get, #get_paged, #is_json?, #post, #put
Constructor Details
#initialize(options = {}) ⇒ WrAPI::API
Initializes a new API object with the given options.
41 42 43 44 45 46 |
# File 'lib/wrapi/api.rb', line 41 def initialize( = {}) = WrAPI..merge() WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#config ⇒ Hash
Returns a hash of configuration options and their values. Iterates over each valid configuration key defined in WrAPI::Configuration::VALID_OPTIONS_KEYS, and assigns the corresponding value by calling the method with the same name as the key.
53 54 55 56 57 58 59 |
# File 'lib/wrapi/api.rb', line 53 def config conf = {} WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key| conf[key] = send key end conf end |