Class: Travis::Client
- Inherits:
-
Object
- Object
- Travis::Client
- Defined in:
- lib/travis/client.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#fetch_config(job_id) ⇒ Object
TODO: this needs to be fixed before going too far, returning body without ability to inspect response or returning nil on any failure are not the best ways to deal with API client.
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/travis/client.rb', line 8 def initialize @connection = create_connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection
6 7 8 |
# File 'lib/travis/client.rb', line 6 def connection @connection end |
Instance Method Details
#fetch_config(job_id) ⇒ Object
TODO: this needs to be fixed before going too far, returning body without
ability to inspect response or returning nil on any failure are not
the best ways to deal with API client
15 16 17 18 19 20 21 22 23 |
# File 'lib/travis/client.rb', line 15 def fetch_config(job_id) response = get("/jobs/#{job_id}") if (200..299).include?(response.status) response.body['job']['config'] else # TODO: I should probably raise here nil end end |