class IBM::Cloud::SDK::BaseService

Public Class Methods

endpoint() click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 5
def self.endpoint
  raise NotImplementedError
end

Public Instance Methods

delete(path) click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 13
def delete(path)
  JSON.parse(RestClient.delete(url(path), headers))
end
endpoint() click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 9
def endpoint
  raise NotImplementedError
end
get(path) click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 17
def get(path)
  JSON.parse(RestClient.get(url(path), headers))
end
post(path, payload) click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 21
def post(path, payload)
  JSON.parse(RestClient.post(url(path), payload, headers))
end

Private Instance Methods

headers() click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 31
def headers
  {"Authorization" => token.authorization_header}
end
url(path) click to toggle source
# File lib/ibm/cloud/sdk/base_service.rb, line 27
def url(path)
  "#{endpoint}/#{path}"
end