Class: Phrase::AutomationEventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/phrase/api/automation_events_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AutomationEventsApi

Returns a new instance of AutomationEventsApi.



7
8
9
# File 'lib/phrase/api/automation_events_api.rb', line 7

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



5
6
7
# File 'lib/phrase/api/automation_events_api.rb', line 5

def api_client
  @api_client
end

Instance Method Details

#account_automation_events_list(account_id, opts = {}) ⇒ Array<AutomationEvent>

List automation events for an account Returns the run history across all automations in the account, newest-first. Use automation_id to narrow results to a single automation. Use project_id or project_ids to narrow by project. For feature availability, see Jobs (Strings).

Parameters:

  • account_id (String)

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :x_phrase_app_otp (String)

    Two-Factor-Authentication token (optional)

  • :page (Integer)

    Page number

  • :per_page (Integer)

    Limit on the number of objects to be returned, between 1 and 100. 25 by default

  • :automation_id (String)

    Filter events to a single automation by its ID.

  • :state (String)

    Filter events by outcome state. Unrecognized values are ignored.

  • :triggered_by (String)

    Filter events by what triggered the automation run. Unrecognized values are ignored.

  • :project_id (String)

    Filter events by project ID. Accepts a single ID or a comma-separated list of IDs.

  • :project_ids (Array<String>)

    Filter events by one or more project IDs.

  • :created_after (String)

    Return only events created after this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

  • :created_before (String)

    Return only events created before this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

Returns:



25
26
27
28
# File 'lib/phrase/api/automation_events_api.rb', line 25

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#account_automation_events_list_with_http_info(account_id, opts = {}) ⇒ Array<(Response<(Array<AutomationEvent>)>, Integer, Hash)>

List automation events for an account Returns the run history across all automations in the account, newest-first. Use `automation_id` to narrow results to a single automation. Use `project_id` or `project_ids` to narrow by project. For feature availability, see Jobs (Strings).

Parameters:

  • account_id (String)

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :x_phrase_app_otp (String)

    Two-Factor-Authentication token (optional)

  • :page (Integer)

    Page number

  • :per_page (Integer)

    Limit on the number of objects to be returned, between 1 and 100. 25 by default

  • :automation_id (String)

    Filter events to a single automation by its ID.

  • :state (String)

    Filter events by outcome state. Unrecognized values are ignored.

  • :triggered_by (String)

    Filter events by what triggered the automation run. Unrecognized values are ignored.

  • :project_id (String)

    Filter events by project ID. Accepts a single ID or a comma-separated list of IDs.

  • :project_ids (Array<String>)

    Filter events by one or more project IDs.

  • :created_after (String)

    Return only events created after this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

  • :created_before (String)

    Return only events created before this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

Returns:

  • (Array<(Response<(Array<AutomationEvent>)>, Integer, Hash)>)

    Response<(Array)> data, response status code and response headers



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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/phrase/api/automation_events_api.rb', line 45

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AutomationEventsApi.account_automation_events_list ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AutomationEventsApi.account_automation_events_list"
  end
  allowable_values = ["success", "failure", "in_progress"]
  if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
    fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
  end
  allowable_values = ["manual", "schedule", "upload", "upload_batch"]
  if @api_client.config.client_side_validation && opts[:'triggered_by'] && !allowable_values.include?(opts[:'triggered_by'])
    fail ArgumentError, "invalid value for \"triggered_by\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/automation_events'.sub('{' + 'account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'automation_id'] = opts[:'automation_id'] if !opts[:'automation_id'].nil?
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
  query_params[:'triggered_by'] = opts[:'triggered_by'] if !opts[:'triggered_by'].nil?
  query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?
  query_params[:'project_ids'] = @api_client.build_collection_param(opts[:'project_ids'], :multi) if !opts[:'project_ids'].nil?
  query_params[:'created_after'] = opts[:'created_after'] if !opts[:'created_after'].nil?
  query_params[:'created_before'] = opts[:'created_before'] if !opts[:'created_before'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<AutomationEvent>' 

  # auth_names
  auth_names = opts[:auth_names] || ['Basic', 'Token']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AutomationEventsApi#account_automation_events_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  response = ::Phrase::Response.new(data, headers)
  return response, status_code, headers
end

#automation_events_list(account_id, id, opts = {}) ⇒ Array<AutomationEvent>

List events for an automation Returns the run history for a specific automation, newest-first. For feature availability, see Jobs (Strings).

Parameters:

  • account_id (String)

    Account ID

  • id (String)

    ID

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

    the optional parameters

Options Hash (opts):

  • :x_phrase_app_otp (String)

    Two-Factor-Authentication token (optional)

  • :page (Integer)

    Page number

  • :per_page (Integer)

    Limit on the number of objects to be returned, between 1 and 100. 25 by default

  • :state (String)

    Filter events by outcome state. Unrecognized values are ignored.

  • :triggered_by (String)

    Filter events by what triggered the automation run. Unrecognized values are ignored.

  • :project_id (String)

    Filter events by project ID. Accepts a single ID or a comma-separated list of IDs.

  • :project_ids (Array<String>)

    Filter events by one or more project IDs.

  • :created_after (String)

    Return only events created after this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

  • :created_before (String)

    Return only events created before this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

Returns:



126
127
128
129
# File 'lib/phrase/api/automation_events_api.rb', line 126

def automation_events_list(, id, opts = {})
  data, _status_code, _headers = automation_events_list_with_http_info(, id, opts)
  data
end

#automation_events_list_with_http_info(account_id, id, opts = {}) ⇒ Array<(Response<(Array<AutomationEvent>)>, Integer, Hash)>

List events for an automation Returns the run history for a specific automation, newest-first. For feature availability, see Jobs (Strings).

Parameters:

  • account_id (String)

    Account ID

  • id (String)

    ID

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

    the optional parameters

Options Hash (opts):

  • :x_phrase_app_otp (String)

    Two-Factor-Authentication token (optional)

  • :page (Integer)

    Page number

  • :per_page (Integer)

    Limit on the number of objects to be returned, between 1 and 100. 25 by default

  • :state (String)

    Filter events by outcome state. Unrecognized values are ignored.

  • :triggered_by (String)

    Filter events by what triggered the automation run. Unrecognized values are ignored.

  • :project_id (String)

    Filter events by project ID. Accepts a single ID or a comma-separated list of IDs.

  • :project_ids (Array<String>)

    Filter events by one or more project IDs.

  • :created_after (String)

    Return only events created after this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

  • :created_before (String)

    Return only events created before this ISO 8601 timestamp. Returns 400 if the value is not a valid date-time.

Returns:

  • (Array<(Response<(Array<AutomationEvent>)>, Integer, Hash)>)

    Response<(Array)> data, response status code and response headers



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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/phrase/api/automation_events_api.rb', line 146

def automation_events_list_with_http_info(, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AutomationEventsApi.automation_events_list ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AutomationEventsApi.automation_events_list"
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AutomationEventsApi.automation_events_list"
  end
  allowable_values = ["success", "failure", "in_progress"]
  if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
    fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
  end
  allowable_values = ["manual", "schedule", "upload", "upload_batch"]
  if @api_client.config.client_side_validation && opts[:'triggered_by'] && !allowable_values.include?(opts[:'triggered_by'])
    fail ArgumentError, "invalid value for \"triggered_by\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/automations/{automation_id}/events'.sub('{' + 'account_id' + '}', CGI.escape(.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
  query_params[:'triggered_by'] = opts[:'triggered_by'] if !opts[:'triggered_by'].nil?
  query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil?
  query_params[:'project_ids'] = @api_client.build_collection_param(opts[:'project_ids'], :multi) if !opts[:'project_ids'].nil?
  query_params[:'created_after'] = opts[:'created_after'] if !opts[:'created_after'].nil?
  query_params[:'created_before'] = opts[:'created_before'] if !opts[:'created_before'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<AutomationEvent>' 

  # auth_names
  auth_names = opts[:auth_names] || ['Basic', 'Token']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AutomationEventsApi#automation_events_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  response = ::Phrase::Response.new(data, headers)
  return response, status_code, headers
end