Class: Commands::Screenshot
- Inherits:
-
Object
- Object
- Commands::Screenshot
- Defined in:
- lib/commands/screenshot.rb
Constant Summary collapse
- FILE_LOCATION =
"/tmp/tmp.jpg"
Class Method Summary collapse
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize(args, settings) ⇒ Screenshot
constructor
A new instance of Screenshot.
- #media? ⇒ Boolean
- #respond ⇒ Object
Constructor Details
#initialize(args, settings) ⇒ Screenshot
Returns a new instance of Screenshot.
7 8 9 |
# File 'lib/commands/screenshot.rb', line 7 def initialize(args, settings) @api_root = settings.get('api_root') end |
Class Method Details
.matches ⇒ Object
25 26 27 |
# File 'lib/commands/screenshot.rb', line 25 def self.matches ['screenshot'] end |
Instance Method Details
#go ⇒ Object
11 12 13 14 15 |
# File 'lib/commands/screenshot.rb', line 11 def go `screencapture -t jpg -x #{FILE_LOCATION}` response = RestClient.post "#{@api_root}/upload", file: File.new(FILE_LOCATION, 'rb') @url = JSON.load(response)['url'] end |
#media? ⇒ Boolean
21 22 23 |
# File 'lib/commands/screenshot.rb', line 21 def media? true end |
#respond ⇒ Object
17 18 19 |
# File 'lib/commands/screenshot.rb', line 17 def respond @url end |