Class: ThreeScale::Core::ServiceToken
- Inherits:
-
APIClient::Resource
- Object
- APIClient::Resource
- ThreeScale::Core::ServiceToken
- Defined in:
- lib/3scale/core/service_token.rb
Class Method Summary collapse
Methods inherited from APIClient::Resource
Methods included from APIClient::Operations
Methods included from APIClient::Support
Methods included from APIClient::Attributes
#attributes, #dirty?, included, #update_attributes
Constructor Details
This class inherits a constructor from ThreeScale::Core::APIClient::Resource
Class Method Details
.delete(attributes) ⇒ Object
31 32 33 34 35 |
# File 'lib/3scale/core/service_token.rb', line 31 def delete(attributes) result = api_do_delete(attributes, uri: default_uri, prefix: :service_tokens) result[:response_json][:count] end |
.save!(attributes) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/3scale/core/service_token.rb', line 9 def save!(attributes) api_do_post(attributes, prefix: :service_tokens) do |result| status = result[:response].status if status == 400 raise ServiceTokenMissingParameter, result[:response_json][:error] end if status == 422 case result[:response_json][:error] when /Service ID/ raise ServiceTokenRequiresServiceId when /Service token/ raise ServiceTokenRequiresToken end end true end end |