Class: Imagga::BaseOptions
- Inherits:
-
Object
- Object
- Imagga::BaseOptions
- Defined in:
- lib/imagga/extract_options.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
Instance Method Summary collapse
- #base_options ⇒ Object
-
#initialize(api_key, api_secret) ⇒ BaseOptions
constructor
A new instance of BaseOptions.
- #sign(options) ⇒ Object
Constructor Details
#initialize(api_key, api_secret) ⇒ BaseOptions
Returns a new instance of BaseOptions.
5 6 7 8 9 |
# File 'lib/imagga/extract_options.rb', line 5 def initialize(api_key, api_secret) @version = '1.0' @api_key = api_key || raise_missing(:api_key) @api_secret = api_secret || raise_missing(:api_secret) end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/imagga/extract_options.rb', line 3 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
3 4 5 |
# File 'lib/imagga/extract_options.rb', line 3 def api_secret @api_secret end |
Instance Method Details
#base_options ⇒ Object
11 12 13 |
# File 'lib/imagga/extract_options.rb', line 11 def { v: @version, api_key: @api_key } end |
#sign(options) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/imagga/extract_options.rb', line 15 def sign() = .keys.sort.map do |key| "%s=%s" % [key.to_s, [key]] end.join('') << @api_secret Digest::MD5.hexdigest() end |