Method: Trend::Client#initialize

Defined in:
lib/trend/client.rb

#initialize(url: nil, api_key: nil, timeout: 30) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
16
17
18
# File 'lib/trend/client.rb', line 11

def initialize(url: nil, api_key: nil, timeout: 30)
  @api_key = api_key || Trend.api_key
  @uri = URI.parse(url || Trend.url)
  @http = Net::HTTP.new(@uri.host, @uri.port)
  @http.use_ssl = true if @uri.scheme == "https"
  @http.open_timeout = timeout
  @http.read_timeout = timeout
end