Class: Jbcm::Client
- Inherits:
-
Object
- Object
- Jbcm::Client
- Defined in:
- lib/jbcm.rb
Defined Under Namespace
Classes: Job
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
Instance Method Summary collapse
- #conn ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #job(job_name) ⇒ Object
- #jobs(opts = {}) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 |
# File 'lib/jbcm.rb', line 10 def initialize(opts = {}) @user_name = opts[:user_name] @api_token = opts[:api_token] @api_token = opts[:password] if opts[:password] @scheme = opts[:scheme] || 'https' @hostname = opts[:hostname] @port = opts[:port] || '443' end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
8 9 10 |
# File 'lib/jbcm.rb', line 8 def api_token @api_token end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
8 9 10 |
# File 'lib/jbcm.rb', line 8 def hostname @hostname end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'lib/jbcm.rb', line 8 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
8 9 10 |
# File 'lib/jbcm.rb', line 8 def port @port end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
8 9 10 |
# File 'lib/jbcm.rb', line 8 def scheme @scheme end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
8 9 10 |
# File 'lib/jbcm.rb', line 8 def user_name @user_name end |
Instance Method Details
#conn ⇒ Object
19 20 21 22 23 24 |
# File 'lib/jbcm.rb', line 19 def conn conn ||= Faraday::Connection.new(url: "#{scheme}://#{user_name}:#{api_token}@#{hostname}:#{port}") do |builder| builder.use Faraday::Request::UrlEncoded builder.use Faraday::Adapter::NetHttp end end |