Class: CampactUserService::Client
- Inherits:
-
Object
- Object
- CampactUserService::Client
- Defined in:
- lib/campact_user_service/client.rb
Constant Summary collapse
- TIMEOUT =
5.freeze
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/campact_user_service/client.rb', line 13 def initialize() @scheme = .fetch(:scheme, 'https') @host = .fetch(:host) @port = [:port] = .merge(.delete(:faraday) || {}) adapter = .delete(:adapter) || Faraday.default_adapter @connection = Faraday.new(endpoint, ) do |faraday| if .has_key?(:enable_auth) faraday.basic_auth [:username], [:password] end faraday.adapter adapter end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/campact_user_service/client.rb', line 11 def connection @connection end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
11 12 13 |
# File 'lib/campact_user_service/client.rb', line 11 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
11 12 13 |
# File 'lib/campact_user_service/client.rb', line 11 def port @port end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
11 12 13 |
# File 'lib/campact_user_service/client.rb', line 11 def scheme @scheme end |