Class: Imagga::BaseOptions
- Inherits:
-
Object
- Object
- Imagga::BaseOptions
- Includes:
- Parametizer
- Defined in:
- lib/imagga/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.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #base_options ⇒ Object
-
#initialize(api_key, api_secret) ⇒ BaseOptions
constructor
A new instance of BaseOptions.
- #options(opts = {}) ⇒ Object
- #sign(options) ⇒ Object
Methods included from Parametizer
#build_boolean_options, #build_comma_separated_string
Constructor Details
#initialize(api_key, api_secret) ⇒ BaseOptions
Returns a new instance of BaseOptions.
6 7 8 9 10 |
# File 'lib/imagga/options.rb', line 6 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.
4 5 6 |
# File 'lib/imagga/options.rb', line 4 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
4 5 6 |
# File 'lib/imagga/options.rb', line 4 def api_secret @api_secret end |
#version ⇒ Object
Returns the value of attribute version.
4 5 6 |
# File 'lib/imagga/options.rb', line 4 def version @version end |
Instance Method Details
#base_options ⇒ Object
12 13 14 |
# File 'lib/imagga/options.rb', line 12 def { v: version, api_key: api_key } end |
#options(opts = {}) ⇒ Object
23 24 25 |
# File 'lib/imagga/options.rb', line 23 def (opts={}) {} end |
#sign(options) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/imagga/options.rb', line 16 def sign() = .keys.sort.map do |key| "%s=%s" % [key.to_s, [key]] end.join('') << api_secret Digest::MD5.hexdigest() end |