Class: SemaphoreClient::Api::Org
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::Org
- Defined in:
- lib/semaphore_client/api/org.rb
Instance Method Summary collapse
- #get(id) ⇒ Object
- #get!(id) ⇒ Object
-
#initialize(http_client) ⇒ Org
constructor
A new instance of Org.
- #list ⇒ Object
- #list! ⇒ 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) ⇒ Object
13 14 15 16 |
# File 'lib/semaphore_client/api/org.rb', line 13 def get(id) get!(id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#get!(id) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/semaphore_client/api/org.rb', line 30 def get!(id) response = @http_client.get([:orgs, id]) assert_response_status(response, 200) content = JSON.parse(response.body) SemaphoreClient::Model::Org.load(content) end |
#list ⇒ Object
8 9 10 11 |
# File 'lib/semaphore_client/api/org.rb', line 8 def list list! rescue SemaphoreClient::Exceptions::RequestFailed end |
#list! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/semaphore_client/api/org.rb', line 18 def list! response = @http_client.get([:orgs]) assert_response_status(response, 200) content = JSON.parse(response.body) content.map do |entity| SemaphoreClient::Model::Org.load(entity) end end |