Class: Commands::Picture
- Inherits:
-
Object
- Object
- Commands::Picture
- Defined in:
- lib/commands/picture.rb
Class Method Summary collapse
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize(args, settings) ⇒ Picture
constructor
A new instance of Picture.
- #media? ⇒ Boolean
- #respond ⇒ Object
Constructor Details
#initialize(args, settings) ⇒ Picture
Returns a new instance of Picture.
7 8 9 10 |
# File 'lib/commands/picture.rb', line 7 def initialize(args, settings) @api_root = settings.get('api_root') @file = Tempfile.new(['picture', '.jpg']) end |
Class Method Details
.matches ⇒ Object
26 27 28 |
# File 'lib/commands/picture.rb', line 26 def self.matches ['picture', 'snap'] end |
Instance Method Details
#go ⇒ Object
12 13 14 15 16 |
# File 'lib/commands/picture.rb', line 12 def go `#{File.("#{File.dirname(__FILE__)}/../../sbin/controlio-imagesnap")} -q #{@file.path}` response = RestClient.post "#{@api_root}/upload", file: File.new(@file.path, 'rb') @url = JSON.load(response)['url'] end |
#media? ⇒ Boolean
22 23 24 |
# File 'lib/commands/picture.rb', line 22 def media? true end |
#respond ⇒ Object
18 19 20 |
# File 'lib/commands/picture.rb', line 18 def respond @url end |