Class: ArtikCloud::RulesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/artikcloud/api/rules_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RulesApi

Returns a new instance of RulesApi.



18
19
20
# File 'lib/artikcloud/api/rules_api.rb', line 18

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/artikcloud/api/rules_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#create_rule(rule_info, user_id, opts = {}) ⇒ RuleEnvelope

Create Rule Create a new Rule

Parameters:

  • rule_info

    Rule object that needs to be added

  • user_id

    User ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/artikcloud/api/rules_api.rb', line 28

def create_rule(rule_info, user_id, opts = {})
  data, _status_code, _headers = create_rule_with_http_info(rule_info, user_id, opts)
  return data
end

#create_rule_with_http_info(rule_info, user_id, opts = {}) ⇒ Array<(RuleEnvelope, Fixnum, Hash)>

Create Rule Create a new Rule

Parameters:

  • rule_info

    Rule object that needs to be added

  • user_id

    User ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RuleEnvelope, Fixnum, Hash)>)

    RuleEnvelope data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/artikcloud/api/rules_api.rb', line 39

def create_rule_with_http_info(rule_info, user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RulesApi.create_rule ..."
  end
  # verify the required parameter 'rule_info' is set
  fail ArgumentError, "Missing the required parameter 'rule_info' when calling RulesApi.create_rule" if rule_info.nil?
  # verify the required parameter 'user_id' is set
  fail ArgumentError, "Missing the required parameter 'user_id' when calling RulesApi.create_rule" if user_id.nil?
  # resource path
  local_var_path = "/rules".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'userId'] = user_id

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(rule_info)
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RuleEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RulesApi#create_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_rule(rule_id, opts = {}) ⇒ RuleEnvelope

Delete Rule Delete a Rule

Parameters:

  • rule_id

    Rule ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



83
84
85
86
# File 'lib/artikcloud/api/rules_api.rb', line 83

def delete_rule(rule_id, opts = {})
  data, _status_code, _headers = delete_rule_with_http_info(rule_id, opts)
  return data
end

#delete_rule_with_http_info(rule_id, opts = {}) ⇒ Array<(RuleEnvelope, Fixnum, Hash)>

Delete Rule Delete a Rule

Parameters:

  • rule_id

    Rule ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RuleEnvelope, Fixnum, Hash)>)

    RuleEnvelope data, response status code and response headers



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/artikcloud/api/rules_api.rb', line 93

def delete_rule_with_http_info(rule_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RulesApi.delete_rule ..."
  end
  # verify the required parameter 'rule_id' is set
  fail ArgumentError, "Missing the required parameter 'rule_id' when calling RulesApi.delete_rule" if rule_id.nil?
  # resource path
  local_var_path = "/rules/{ruleId}".sub('{format}','json').sub('{' + 'ruleId' + '}', rule_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RuleEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RulesApi#delete_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_rule(rule_id, opts = {}) ⇒ RuleEnvelope

Get Rule Get a rule using the Rule ID

Parameters:

  • rule_id

    Rule ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



134
135
136
137
# File 'lib/artikcloud/api/rules_api.rb', line 134

def get_rule(rule_id, opts = {})
  data, _status_code, _headers = get_rule_with_http_info(rule_id, opts)
  return data
end

#get_rule_with_http_info(rule_id, opts = {}) ⇒ Array<(RuleEnvelope, Fixnum, Hash)>

Get Rule Get a rule using the Rule ID

Parameters:

  • rule_id

    Rule ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RuleEnvelope, Fixnum, Hash)>)

    RuleEnvelope data, response status code and response headers



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/artikcloud/api/rules_api.rb', line 144

def get_rule_with_http_info(rule_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RulesApi.get_rule ..."
  end
  # verify the required parameter 'rule_id' is set
  fail ArgumentError, "Missing the required parameter 'rule_id' when calling RulesApi.get_rule" if rule_id.nil?
  # resource path
  local_var_path = "/rules/{ruleId}".sub('{format}','json').sub('{' + 'ruleId' + '}', rule_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RuleEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RulesApi#get_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_rule(rule_id, rule_info, opts = {}) ⇒ RuleEnvelope

Update Rule Update an existing Rule

Parameters:

  • rule_id

    Rule ID.

  • rule_info

    Rule object that needs to be updated

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



186
187
188
189
# File 'lib/artikcloud/api/rules_api.rb', line 186

def update_rule(rule_id, rule_info, opts = {})
  data, _status_code, _headers = update_rule_with_http_info(rule_id, rule_info, opts)
  return data
end

#update_rule_with_http_info(rule_id, rule_info, opts = {}) ⇒ Array<(RuleEnvelope, Fixnum, Hash)>

Update Rule Update an existing Rule

Parameters:

  • rule_id

    Rule ID.

  • rule_info

    Rule object that needs to be updated

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RuleEnvelope, Fixnum, Hash)>)

    RuleEnvelope data, response status code and response headers



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/artikcloud/api/rules_api.rb', line 197

def update_rule_with_http_info(rule_id, rule_info, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RulesApi.update_rule ..."
  end
  # verify the required parameter 'rule_id' is set
  fail ArgumentError, "Missing the required parameter 'rule_id' when calling RulesApi.update_rule" if rule_id.nil?
  # verify the required parameter 'rule_info' is set
  fail ArgumentError, "Missing the required parameter 'rule_info' when calling RulesApi.update_rule" if rule_info.nil?
  # resource path
  local_var_path = "/rules/{ruleId}".sub('{format}','json').sub('{' + 'ruleId' + '}', rule_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(rule_info)
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RuleEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RulesApi#update_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end