Method: HaveAPI::Client::Client#initialize
- Defined in:
- lib/haveapi/client/client.rb
#initialize(url, opts = {}) ⇒ 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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/haveapi/client/client.rb', line 19 def initialize(url, opts = {}) @setup = false @opts = opts @version = @opts[:version] @opts[:identity] ||= 'haveapi-client' @opts[:block] = true if @opts[:block].nil? if @opts[:communicator] @api = @opts[:communicator] else @api = HaveAPI::Client::Communicator.new(url, @version) @api.identity = @opts[:identity] end end |