Class: Imagga::BaseCommand
- Inherits:
-
Object
- Object
- Imagga::BaseCommand
- Includes:
- HTTParty, Exceptions
- Defined in:
- lib/imagga/commands.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
Instance Method Summary collapse
- #args(options) ⇒ Object
- #execute(options) ⇒ Object
-
#initialize(api_key, api_secret, base_uri) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
- #options_class ⇒ Object
Methods included from Exceptions
#raise_if_request_failed!, #raise_missing
Constructor Details
#initialize(api_key, api_secret, base_uri) ⇒ BaseCommand
Returns a new instance of BaseCommand.
11 12 13 14 |
# File 'lib/imagga/commands.rb', line 11 def initialize(api_key, api_secret, base_uri) @api_key, @api_secret, @base_uri = api_key, api_secret, base_uri self.class.base_uri @base_uri end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/imagga/commands.rb', line 9 def api_key @api_key end |
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
9 10 11 |
# File 'lib/imagga/commands.rb', line 9 def api_secret @api_secret end |
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
9 10 11 |
# File 'lib/imagga/commands.rb', line 9 def base_uri @base_uri end |
Instance Method Details
#args(options) ⇒ Object
22 23 24 |
# File 'lib/imagga/commands.rb', line 22 def args() .new(api_key, api_secret).() end |
#execute(options) ⇒ Object
16 17 18 19 20 |
# File 'lib/imagga/commands.rb', line 16 def execute() JSON.parse(self.class.post(service_path, body: args())).tap do |result| raise_if_request_failed!(result) end end |
#options_class ⇒ Object
26 |
# File 'lib/imagga/commands.rb', line 26 def ; BaseOptions; end |