Class: Rawscsi::IndexHelpers::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/rawscsi/index_helpers/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Connection

Returns a new instance of Connection.



9
10
11
# File 'lib/rawscsi/index_helpers/connection.rb', line 9

def initialize(config)
  @url = config.index_domain || "http://doc-#{config.domain_name}-#{config.domain_id}.#{config.region}.cloudsearch.amazonaws.com"
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/rawscsi/index_helpers/connection.rb', line 7

def url
  @url
end

Instance Method Details

#buildObject



13
14
15
16
17
18
19
# File 'lib/rawscsi/index_helpers/connection.rb', line 13

def build
  connection = Faraday.new url do |builder|
    builder.use FaradayMiddleware::EncodeJson
    builder.adapter Faraday.default_adapter
  end
  connection
end