Method: HaveAPI::Client::Client#initialize

Defined in:
lib/haveapi/client/client.rb

#initialize(url, v = nil, identity: 'haveapi-client', communicator: nil) ⇒ Client

Create an instance of client. The client by default uses the default version of the API. API is asked for description only when needed or by calling #setup. identity is sent in each request to the API in User-Agent header.



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

def initialize(url, v = nil, identity: 'haveapi-client', communicator: nil)
  @setup = false
  @version = v

  if communicator
    @api = communicator

  else
    @api = HaveAPI::Client::Communicator.new(url, v)
    @api.identity = identity
  end
end