Class: CompaniesHouseClient::Configuration
- Inherits:
-
Object
- Object
- CompaniesHouseClient::Configuration
- Defined in:
- lib/companies_house_client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#ssl_options ⇒ Object
Returns the value of attribute ssl_options.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #configure_connection ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 29 30 31 32 33 |
# File 'lib/companies_house_client.rb', line 25 def initialize @connection ||= Her::API.new @api_key = "" @url = CompaniesHouseClient::API_URL @ssl_options = { ca_path: CompaniesHouseClient::CAPath.platform_path } @proxy end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
22 23 24 |
# File 'lib/companies_house_client.rb', line 22 def api_key @api_key end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
23 24 25 |
# File 'lib/companies_house_client.rb', line 23 def connection @connection end |
#proxy ⇒ Object
Returns the value of attribute proxy.
22 23 24 |
# File 'lib/companies_house_client.rb', line 22 def proxy @proxy end |
#ssl_options ⇒ Object
Returns the value of attribute ssl_options.
22 23 24 |
# File 'lib/companies_house_client.rb', line 22 def @ssl_options end |
#url ⇒ Object
Returns the value of attribute url.
22 23 24 |
# File 'lib/companies_house_client.rb', line 22 def url @url end |
Instance Method Details
#configure_connection ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/companies_house_client.rb', line 35 def configure_connection @connection.setup url: @url, ssl: @ssl_options, proxy: @proxy do |c| #Auth c.use Faraday::Request::BasicAuthentication, @api_key, '' # Request c.use Faraday::Request::UrlEncoded # Parse collections c.use CompaniesHouseClient::CollectionParser # c.use Her::Middleware::DefaultParseJSON # Adapter c.use Faraday::Adapter::NetHttp end end |