Class: Marathon::Connection
- Inherits:
-
Object
- Object
- Marathon::Connection
- Includes:
- HTTParty, Error
- Defined in:
- lib/marathon/connection.rb
Overview
This class represents a Marathon API Connection.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, options = {}) ⇒ Connection
constructor
Create a new API connection.
- #to_s ⇒ Object
Methods included from Error
error_class, error_message, from_response
Constructor Details
#initialize(url, options = {}) ⇒ Connection
Create a new API connection. url
: URL of the marathon API. options
: Hash with options for marathon API.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/marathon/connection.rb', line 21 def initialize(url, = {}) @url = url @options = if @options[:username] and @options[:password] @options[:basic_auth] = { :username => @options[:username], :password => @options[:password] } @options.delete(:username) @options.delete(:password) end # The insecure option allows ignoring bad (or self-signed) SSL # certificates. if @options[:insecure] @options[:verify] = false @options.delete(:insecure) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/marathon/connection.rb', line 16 def @options end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
16 17 18 |
# File 'lib/marathon/connection.rb', line 16 def url @url end |
Instance Method Details
#to_s ⇒ Object
46 47 48 |
# File 'lib/marathon/connection.rb', line 46 def to_s "Marathon::Connection { :url => #{url} :options => #{} }" end |