Class: SemaphoreClient::Api::SharedConfig
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::SharedConfig
- Defined in:
- lib/semaphore_client/api/shared_config.rb
Instance Method Summary collapse
- #attach_to_project(shared_config_id, project_id) ⇒ Object
- #attach_to_project!(shared_config_id, project_id) ⇒ Object
- #attach_to_team(shared_config_id, team_id) ⇒ Object
- #attach_to_team!(shared_config_id, team_id) ⇒ Object
- #create_for_org(org_id, params) ⇒ Object
- #create_for_org!(org_id, params) ⇒ Object
- #delete(id) ⇒ Object
- #delete!(id) ⇒ Object
- #detach_from_project(shared_config_id, project_id) ⇒ Object
- #detach_from_project!(shared_config_id, project_id) ⇒ Object
- #detach_from_team(shared_config_id, team_id) ⇒ Object
- #detach_from_team!(shared_config_id, team_id) ⇒ Object
- #get(id) ⇒ Object
- #get!(id) ⇒ Object
-
#initialize(http_client) ⇒ SharedConfig
constructor
A new instance of SharedConfig.
- #list_for_org(org_id) ⇒ Object
- #list_for_org!(org_id) ⇒ Object
- #list_for_project(project_id) ⇒ Object
- #list_for_project!(project_id) ⇒ Object
- #list_for_team(team_id) ⇒ Object
- #list_for_team!(team_id) ⇒ Object
- #update(id, params) ⇒ Object
- #update!(id, params) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ SharedConfig
Returns a new instance of SharedConfig.
4 5 6 |
# File 'lib/semaphore_client/api/shared_config.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#attach_to_project(shared_config_id, project_id) ⇒ Object
38 39 40 41 |
# File 'lib/semaphore_client/api/shared_config.rb', line 38 def attach_to_project(shared_config_id, project_id) attach_to_project!(shared_config_id, project_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#attach_to_project!(shared_config_id, project_id) ⇒ Object
121 122 123 124 125 |
# File 'lib/semaphore_client/api/shared_config.rb', line 121 def attach_to_project!(shared_config_id, project_id) response = @http_client.post([:projects, project_id, :shared_configs, shared_config_id]) assert_response_status(response, 204) end |
#attach_to_team(shared_config_id, team_id) ⇒ Object
23 24 25 26 |
# File 'lib/semaphore_client/api/shared_config.rb', line 23 def attach_to_team(shared_config_id, team_id) attach_to_team!(shared_config_id, team_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#attach_to_team!(shared_config_id, team_id) ⇒ Object
97 98 99 100 101 |
# File 'lib/semaphore_client/api/shared_config.rb', line 97 def attach_to_team!(shared_config_id, team_id) response = @http_client.post([:teams, team_id, :shared_configs, shared_config_id]) assert_response_status(response, 204) end |
#create_for_org(org_id, params) ⇒ Object
13 14 15 16 |
# File 'lib/semaphore_client/api/shared_config.rb', line 13 def create_for_org(org_id, params) create_for_org!(org_id, params) rescue SemaphoreClient::Exceptions::RequestFailed end |
#create_for_org!(org_id, params) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/semaphore_client/api/shared_config.rb', line 75 def create_for_org!(org_id, params) response = @http_client.post([:orgs, org_id, :shared_configs], params.to_json) assert_response_status(response, 200) content = JSON.parse(response.body) SemaphoreClient::Model::SharedConfig.load(content) end |
#delete(id) ⇒ Object
53 54 55 56 |
# File 'lib/semaphore_client/api/shared_config.rb', line 53 def delete(id) delete!(id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#delete!(id) ⇒ Object
143 144 145 146 147 |
# File 'lib/semaphore_client/api/shared_config.rb', line 143 def delete!(id) response = @http_client.delete([:shared_configs, id]) assert_response_status(response, 200) end |
#detach_from_project(shared_config_id, project_id) ⇒ Object
43 44 45 46 |
# File 'lib/semaphore_client/api/shared_config.rb', line 43 def detach_from_project(shared_config_id, project_id) detach_from_project!(shared_config_id, project_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#detach_from_project!(shared_config_id, project_id) ⇒ Object
127 128 129 130 131 |
# File 'lib/semaphore_client/api/shared_config.rb', line 127 def detach_from_project!(shared_config_id, project_id) response = @http_client.delete([:projects, project_id, :shared_configs, shared_config_id]) assert_response_status(response, 204) end |
#detach_from_team(shared_config_id, team_id) ⇒ Object
28 29 30 31 |
# File 'lib/semaphore_client/api/shared_config.rb', line 28 def detach_from_team(shared_config_id, team_id) detach_from_team!(shared_config_id, team_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#detach_from_team!(shared_config_id, team_id) ⇒ Object
103 104 105 106 107 |
# File 'lib/semaphore_client/api/shared_config.rb', line 103 def detach_from_team!(shared_config_id, team_id) response = @http_client.delete([:teams, team_id, :shared_configs, shared_config_id]) assert_response_status(response, 204) end |
#get(id) ⇒ Object
48 49 50 51 |
# File 'lib/semaphore_client/api/shared_config.rb', line 48 def get(id) get!(id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#get!(id) ⇒ Object
133 134 135 136 137 138 139 140 141 |
# File 'lib/semaphore_client/api/shared_config.rb', line 133 def get!(id) response = @http_client.get([:shared_configs, id]) assert_response_status(response, 200) content = JSON.parse(response.body) SemaphoreClient::Model::SharedConfig.load(content) end |
#list_for_org(org_id) ⇒ Object
8 9 10 11 |
# File 'lib/semaphore_client/api/shared_config.rb', line 8 def list_for_org(org_id) list_for_org!(org_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#list_for_org!(org_id) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/semaphore_client/api/shared_config.rb', line 63 def list_for_org!(org_id) response = @http_client.get([:orgs, org_id, :shared_configs]) assert_response_status(response, 200) content = JSON.parse(response.body) content.map do |entity| SemaphoreClient::Model::SharedConfig.load(entity) end end |
#list_for_project(project_id) ⇒ Object
33 34 35 36 |
# File 'lib/semaphore_client/api/shared_config.rb', line 33 def list_for_project(project_id) list_for_project!(project_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#list_for_project!(project_id) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/semaphore_client/api/shared_config.rb', line 109 def list_for_project!(project_id) response = @http_client.get([:projects, project_id, :shared_configs]) assert_response_status(response, 200) content = JSON.parse(response.body) content.map do |entity| SemaphoreClient::Model::SharedConfig.load(entity) end end |
#list_for_team(team_id) ⇒ Object
18 19 20 21 |
# File 'lib/semaphore_client/api/shared_config.rb', line 18 def list_for_team(team_id) list_for_team!(team_id) rescue SemaphoreClient::Exceptions::RequestFailed end |
#list_for_team!(team_id) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/semaphore_client/api/shared_config.rb', line 85 def list_for_team!(team_id) response = @http_client.get([:teams, team_id, :shared_configs]) assert_response_status(response, 200) content = JSON.parse(response.body) content.map do |entity| SemaphoreClient::Model::SharedConfig.load(entity) end end |
#update(id, params) ⇒ Object
58 59 60 61 |
# File 'lib/semaphore_client/api/shared_config.rb', line 58 def update(id, params) update!(id, params) rescue SemaphoreClient::Exceptions::RequestFailed end |
#update!(id, params) ⇒ Object
149 150 151 152 153 154 155 156 157 |
# File 'lib/semaphore_client/api/shared_config.rb', line 149 def update!(id, params) response = @http_client.patch([:shared_configs, id], params.to_json) assert_response_status(response, 200) content = JSON.parse(response.body) SemaphoreClient::Model::SharedConfig.load(content) end |