Class: SemaApiRuby::Client

Inherits:
Object
  • Object
show all
Includes:
Ocr
Defined in:
lib/sema_api_ruby/client.rb,
lib/sema_api_ruby/client/ocr.rb,
lib/sema_api_ruby/exceptions.rb

Defined Under Namespace

Modules: Ocr Classes: EmptyResponse, NoTokenError

Instance Method Summary collapse

Methods included from Ocr

#post_ocr_image, #text_to_image_ratio

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sema_api_ruby/client.rb', line 15

def initialize(options = {})
  # Use options passed in, but fall back to config module defaults
  merged_options = SemaApiRuby.options.merge(options)

  # Copy the merged values to this client and ignore those
  # not part of our configuration
  SemaApiRuby::Configuration::VALID_CONFIG_KEYS.each do |key|
    public_send("#{key}=", merged_options[key])
  end

  if access_token.nil?
    raise NoTokenError, 'you must provide an access token'
  end
end