Class: CampactUserService::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/campact_user_service/client.rb

Constant Summary collapse

TIMEOUT =
60.freeze
OPEN_TIMEOUT =
20.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/campact_user_service/client.rb', line 13

def initialize(options)
  @host = options.fetch(:host)
  @port = options[:port]
  @topt_authorization = options[:topt_authorization]
  faraday_options = default_faraday_options.merge(options.delete(:faraday) || {})
  adapter = faraday_options.delete(:adapter) || Faraday.default_adapter

  @connection = Faraday.new(endpoint, faraday_options) do |faraday|
    faraday.adapter adapter
  end
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



11
12
13
# File 'lib/campact_user_service/client.rb', line 11

def connection
  @connection
end

#hostObject (readonly)

Returns the value of attribute host.



11
12
13
# File 'lib/campact_user_service/client.rb', line 11

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



11
12
13
# File 'lib/campact_user_service/client.rb', line 11

def port
  @port
end

#topt_authorizationObject (readonly)

Returns the value of attribute topt_authorization.



11
12
13
# File 'lib/campact_user_service/client.rb', line 11

def topt_authorization
  @topt_authorization
end