Class: SemaphoreClient::Api::Org
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::Org
- Defined in:
- lib/semaphore_client/api/org.rb
Instance Method Summary collapse
- #get(id, params = nil, options = {}) ⇒ Object
- #get!(id, params = nil, options = {}) ⇒ Object
-
#initialize(http_client) ⇒ Org
constructor
A new instance of Org.
- #list(params = nil, options = {}) ⇒ Object
- #list!(params = nil, options = {}) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ Org
Returns a new instance of Org.
4 5 6 |
# File 'lib/semaphore_client/api/org.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#get(id, params = nil, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/semaphore_client/api/org.rb', line 22 def get(id, params = nil, = {}) get!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#get!(id, params = nil, options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/semaphore_client/api/org.rb', line 27 def get!(id, params = nil, = {}) path = "/orgs/#{id}" response = @http_client.get(path, params = {}) SemaphoreClient::Model::Org.load(response.body) end |
#list(params = nil, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/semaphore_client/api/org.rb', line 9 def list(params = nil, = {}) list!(params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#list!(params = nil, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/semaphore_client/api/org.rb', line 14 def list!(params = nil, = {}) path = "/orgs" @http_client.get(path, params, ).body.map { |e| SemaphoreClient::Model::Org.load(e) } end |