Class: Chatoperastore::QuotaWdClient

Inherits:
AbstractClient show all
Includes:
Requests
Defined in:
lib/chatoperastore.rb

Instance Attribute Summary

Attributes inherited from AbstractClient

#base_url

Instance Method Summary collapse

Methods included from Requests

#getRequestBypassSSLChecks, #postRequestBypassSSLChecks

Constructor Details

#initializeQuotaWdClient

Returns a new instance of QuotaWdClient.



55
56
57
# File 'lib/chatoperastore.rb', line 55

def initialize
  super
end

Instance Method Details

#getLicenseBasics(license_id) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/chatoperastore.rb', line 59

def getLicenseBasics(license_id)
  req_values = nil
  if license_id.kind_of?(String)
    req_values = license_id
  elsif license_id.kind_of?(Array)
    req_values = license_id.join(',')
  else
    raise ArgumentError.new("Expected string or array<string>")
  end

  req_url = @base_url + BASE_PATH + "/quotawd/license/basics/" + req_values
  resp_body = getRequestBypassSSLChecks(req_url)
  if resp_body.include?("rc")
    return resp_body
  else
    raise InvalidStoreResponseError.new "Invalid response"
  end
end

#getLicenseStatus(license_id) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/chatoperastore.rb', line 78

def getLicenseStatus(license_id)
  req_values = nil
  if license_id.kind_of?(String)
    req_values = license_id
  elsif license_id.kind_of?(Array)
    req_values = license_id.join(',')
  else
    raise ArgumentError.new("Expected string or array<string>")
  end

  req_url = @base_url + BASE_PATH + "/quotawd/license/status/" + req_values
  resp_body = getRequestBypassSSLChecks(req_url)
  if resp_body.include?("rc")
    return resp_body
  else
    raise InvalidStoreResponseError.new "Invalid response"
  end
end

#write(license_id, serverinst_id, servicename, consumes) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/chatoperastore.rb', line 97

def write(license_id, serverinst_id, servicename, consumes)
  body = { licenseId: license_id, serverinstId: serverinst_id, servicename: servicename, requestlangorsdk: "rubysdk" }

  if consumes.kind_of?(Integer)
    c = [consumes]
    body["consumes"] = c
  elsif consumes.kind_of?(Array)
    body["consumes"] = consumes
  end

  req_url = @base_url + BASE_PATH + "/quotawd/write"
  resp_body = postRequestBypassSSLChecks(req_url, body)
  return resp_body
end