Module: ThreeScale::Core
- Extended by:
- Core
- Defined in:
- lib/3scale/core.rb,
lib/3scale/core/event.rb,
lib/3scale/core/errors.rb,
lib/3scale/core/logger.rb,
lib/3scale/core/metric.rb,
lib/3scale/core/service.rb,
lib/3scale/core/version.rb,
lib/3scale/core/alert_limit.rb,
lib/3scale/core/application.rb,
lib/3scale/core/usage_limit.rb,
lib/3scale/core/utilization.rb,
lib/3scale/core/service_error.rb,
lib/3scale/core/service_token.rb,
lib/3scale/core/application_key.rb,
lib/3scale/core/api_client/support.rb,
lib/3scale/core/api_client/resource.rb,
lib/3scale/core/api_client/attributes.rb,
lib/3scale/core/api_client/collection.rb,
lib/3scale/core/api_client/operations.rb,
lib/3scale/core/application_referrer_filter.rb
Defined Under Namespace
Modules: APIClient, Logger Classes: AlertLimit, Application, ApplicationHasInconsistentData, ApplicationKey, ApplicationReferrerFilter, Error, Event, InvalidPerPage, InvalidProviderKeys, Metric, ProviderKeyExists, ProviderKeyNotFound, Service, ServiceError, ServiceIsDefaultService, ServiceRequiresRegisteredUser, ServiceToken, ServiceTokenMissingParameter, ServiceTokenRequiresServiceId, ServiceTokenRequiresToken, UnknownAPIEndpoint, UsageLimit, UsageLimitInvalidPeriods, Utilization
Constant Summary collapse
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
- #url ⇒ Object
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
27 28 29 |
# File 'lib/3scale/core.rb', line 27 def password @password end |
#url ⇒ Object
56 57 58 59 |
# File 'lib/3scale/core.rb', line 56 def url ENV['THREESCALE_CORE_INTERNAL_API'] || @url || raise(UnknownAPIEndpoint) end |
#username ⇒ Object
Returns the value of attribute username.
27 28 29 |
# File 'lib/3scale/core.rb', line 27 def username @username end |
Instance Method Details
#faraday ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/3scale/core.rb', line 30 def faraday return @faraday if @faraday url = self.url @faraday = Faraday.new(url: url) do |f| f.adapter :net_http_persistent end @faraday.headers = { 'User-Agent' => "pisoni v#{ThreeScale::Core::VERSION}", 'Accept' => 'application/json', 'Content-Type' => 'application/json' } if @username.nil? && @password.nil? # even though the url may contain the user info, turns out Faraday is # not really picking it up, so must fill it in if present in the URL and # no previous setting was done (ie. assigning username or password). uri = URI.parse url @username = uri.user @password = uri.password end @faraday.set_basic_auth(@username, @password) if @username || @password @faraday end |