Class: Heroku::Client::Cisaurus
- Inherits:
-
Object
- Object
- Heroku::Client::Cisaurus
show all
- Includes:
- Helpers
- Defined in:
- lib/heroku/client/cisaurus.rb
Instance Method Summary
collapse
Methods included from Helpers
#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #host_name, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty
Constructor Details
#initialize(uri) ⇒ Cisaurus
Returns a new instance of Cisaurus.
7
8
9
10
|
# File 'lib/heroku/client/cisaurus.rb', line 7
def initialize(uri)
require 'rest_client'
@uri = URI.parse(uri)
end
|
Instance Method Details
#authenticated_resource(path) ⇒ Object
12
13
14
15
16
|
# File 'lib/heroku/client/cisaurus.rb', line 12
def authenticated_resource(path)
host = "#{@uri.scheme}://#{@uri.host}"
host += ":#{@uri.port}" if @uri.port
RestClient::Resource.new("#{host}#{path}", "", Heroku::Auth.api_key)
end
|
#copy_slug(from, to) ⇒ Object
18
19
20
|
# File 'lib/heroku/client/cisaurus.rb', line 18
def copy_slug(from, to)
authenticated_resource("/v1/apps/#{CGI.escape from}/copy/#{CGI.escape to}").post(json_encode("description" => "Forked from #{from}"), :content_type => :json).[:location]
end
|
#job_done?(job_location) ⇒ Boolean
22
23
24
|
# File 'lib/heroku/client/cisaurus.rb', line 22
def job_done?(job_location)
202 != authenticated_resource(job_location).get.code
end
|