Class: Imagga::CoreClient

Inherits:
Object
  • Object
show all
Includes:
Exceptions
Defined in:
lib/imagga/core_client.rb

Direct Known Subclasses

Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Exceptions

#raise_if_request_failed!, #raise_missing

Constructor Details

#initialize(opts = {}) ⇒ CoreClient

Returns a new instance of CoreClient.



6
7
8
9
10
# File 'lib/imagga/core_client.rb', line 6

def initialize(opts={})
  @api_key     = opts[:api_key]    || raise_missing(:api_key)
  @api_secret  = opts[:api_secret] || raise_missing(:api_secret)
  @base_uri    = opts[:base_uri]   || raise_missing(:base_uri)
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



4
5
6
# File 'lib/imagga/core_client.rb', line 4

def api_key
  @api_key
end

#api_secretObject (readonly)

Returns the value of attribute api_secret.



4
5
6
# File 'lib/imagga/core_client.rb', line 4

def api_secret
  @api_secret
end

#base_uriObject (readonly)

Returns the value of attribute base_uri.



4
5
6
# File 'lib/imagga/core_client.rb', line 4

def base_uri
  @base_uri
end

Instance Method Details

#crop(options = {}) ⇒ Object



20
21
22
# File 'lib/imagga/core_client.rb', line 20

def crop(options={})
  CropCommand.new(api_key, api_secret, base_uri).execute(options)
end

#extract(options = {}) ⇒ Object



12
13
14
# File 'lib/imagga/core_client.rb', line 12

def extract(options={})
  ExtractCommand.new(api_key, api_secret, base_uri).execute(options)
end

#rank(options = {}) ⇒ Object



16
17
18
# File 'lib/imagga/core_client.rb', line 16

def rank(options={})
  RankCommand.new(api_key, api_secret, base_uri).execute(options)
end