ittybit 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/ittybit/automations/client.rb +412 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger.rb +75 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger_conditions_item.rb +69 -0
- data/lib/ittybit/files/client.rb +437 -0
- data/lib/ittybit/files/types/files_delete_response.rb +89 -0
- data/lib/ittybit/files/types/files_delete_response_data.rb +60 -0
- data/lib/ittybit/media/client.rb +367 -0
- data/lib/ittybit/signatures/client.rb +132 -0
- data/lib/ittybit/signatures/types/signatures_create_request_method.rb +13 -0
- data/lib/ittybit/tasks/client.rb +379 -0
- data/lib/ittybit/tasks/types/tasks_create_request_kind.rb +22 -0
- data/lib/ittybit/tasks/types/tasks_list_request_kind.rb +26 -0
- data/lib/ittybit/tasks/types/tasks_list_request_status.rb +16 -0
- data/lib/ittybit/types/api_response_base.rb +5 -0
- data/lib/ittybit/types/automation.rb +141 -0
- data/lib/ittybit/types/automation_list_response.rb +90 -0
- data/lib/ittybit/types/automation_response.rb +87 -0
- data/lib/ittybit/types/automation_status.rb +10 -0
- data/lib/ittybit/types/automation_trigger.rb +72 -0
- data/lib/ittybit/types/automation_trigger_conditions_item.rb +65 -0
- data/lib/ittybit/types/confirmation_response.rb +87 -0
- data/lib/ittybit/types/confirmation_response_data.rb +55 -0
- data/lib/ittybit/types/error.rb +57 -0
- data/lib/ittybit/types/error_response.rb +74 -0
- data/lib/ittybit/types/file.rb +319 -0
- data/lib/ittybit/types/file_kind.rb +10 -0
- data/lib/ittybit/types/file_list_response.rb +90 -0
- data/lib/ittybit/types/file_object.rb +10 -0
- data/lib/ittybit/types/file_response.rb +87 -0
- data/lib/ittybit/types/file_status.rb +11 -0
- data/lib/ittybit/types/links.rb +67 -0
- data/lib/ittybit/types/links_list.rb +103 -0
- data/lib/ittybit/types/media.rb +195 -0
- data/lib/ittybit/types/media_kind.rb +10 -0
- data/lib/ittybit/types/media_list_response.rb +90 -0
- data/lib/ittybit/types/media_response.rb +87 -0
- data/lib/ittybit/types/media_source.rb +261 -0
- data/lib/ittybit/types/media_source_kind.rb +10 -0
- data/lib/ittybit/types/media_source_object.rb +10 -0
- data/lib/ittybit/types/media_source_status.rb +11 -0
- data/lib/ittybit/types/media_urls.rb +70 -0
- data/lib/ittybit/types/meta.rb +5 -0
- data/lib/ittybit/types/meta_list.rb +103 -0
- data/lib/ittybit/types/signature.rb +110 -0
- data/lib/ittybit/types/signature_response.rb +87 -0
- data/lib/ittybit/types/task.rb +204 -0
- data/lib/ittybit/types/task_kind.rb +5 -0
- data/lib/ittybit/types/task_list_response.rb +90 -0
- data/lib/ittybit/types/task_response.rb +87 -0
- data/lib/ittybit/types/task_results.rb +74 -0
- data/lib/ittybit/types/task_status.rb +15 -0
- data/lib/ittybit/types/task_summary.rb +138 -0
- data/lib/ittybit/types/task_summary_kind.rb +25 -0
- data/lib/ittybit/types/task_summary_status.rb +15 -0
- data/lib/ittybit/types/workflow_task_step.rb +112 -0
- data/lib/ittybit/types/workflow_task_step_kind.rb +25 -0
- data/lib/ittybit.rb +86 -0
- data/lib/requests.rb +177 -0
- data/lib/types_export.rb +53 -0
- metadata +185 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "meta"
|
4
|
+
require_relative "automation"
|
5
|
+
require_relative "links"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class AutomationResponse
|
11
|
+
# @return [Ittybit::META]
|
12
|
+
attr_reader :meta
|
13
|
+
# @return [Ittybit::Automation]
|
14
|
+
attr_reader :data
|
15
|
+
# @return [Ittybit::Links]
|
16
|
+
attr_reader :links
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param meta [Ittybit::META]
|
26
|
+
# @param data [Ittybit::Automation]
|
27
|
+
# @param links [Ittybit::Links]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Ittybit::AutomationResponse]
|
30
|
+
def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
|
31
|
+
@meta = meta if meta != OMIT
|
32
|
+
@data = data if data != OMIT
|
33
|
+
@links = links if links != OMIT
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
@_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
|
36
|
+
v == OMIT
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Deserialize a JSON object to an instance of AutomationResponse
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Ittybit::AutomationResponse]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
meta = parsed_json["meta"]
|
48
|
+
if parsed_json["data"].nil?
|
49
|
+
data = nil
|
50
|
+
else
|
51
|
+
data = parsed_json["data"].to_json
|
52
|
+
data = Ittybit::Automation.from_json(json_object: data)
|
53
|
+
end
|
54
|
+
if parsed_json["links"].nil?
|
55
|
+
links = nil
|
56
|
+
else
|
57
|
+
links = parsed_json["links"].to_json
|
58
|
+
links = Ittybit::Links.from_json(json_object: links)
|
59
|
+
end
|
60
|
+
new(
|
61
|
+
meta: meta,
|
62
|
+
data: data,
|
63
|
+
links: links,
|
64
|
+
additional_properties: struct
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of AutomationResponse to a JSON object
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_json(*_args)
|
72
|
+
@_field_set&.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
76
|
+
# hash and check each fields type against the current object's property
|
77
|
+
# definitions.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
|
83
|
+
obj.data.nil? || Ittybit::Automation.validate_raw(obj: obj.data)
|
84
|
+
obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "automation_trigger_conditions_item"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Ittybit
|
8
|
+
# The event and conditions that trigger this automation.
|
9
|
+
class AutomationTrigger
|
10
|
+
# @return [String] The event that triggers the automation
|
11
|
+
attr_reader :event
|
12
|
+
# @return [Array<Ittybit::AutomationTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
|
13
|
+
attr_reader :conditions
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param event [String] The event that triggers the automation
|
23
|
+
# @param conditions [Array<Ittybit::AutomationTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
# @return [Ittybit::AutomationTrigger]
|
26
|
+
def initialize(event:, conditions: OMIT, additional_properties: nil)
|
27
|
+
@event = event
|
28
|
+
@conditions = conditions if conditions != OMIT
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "event": event, "conditions": conditions }.reject do |_k, v|
|
31
|
+
v == OMIT
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of AutomationTrigger
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [Ittybit::AutomationTrigger]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
parsed_json = JSON.parse(json_object)
|
42
|
+
event = parsed_json["event"]
|
43
|
+
conditions = parsed_json["conditions"]&.map do |item|
|
44
|
+
item = item.to_json
|
45
|
+
Ittybit::AutomationTriggerConditionsItem.from_json(json_object: item)
|
46
|
+
end
|
47
|
+
new(
|
48
|
+
event: event,
|
49
|
+
conditions: conditions,
|
50
|
+
additional_properties: struct
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Serialize an instance of AutomationTrigger to a JSON object
|
55
|
+
#
|
56
|
+
# @return [String]
|
57
|
+
def to_json(*_args)
|
58
|
+
@_field_set&.to_json
|
59
|
+
end
|
60
|
+
|
61
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
62
|
+
# hash and check each fields type against the current object's property
|
63
|
+
# definitions.
|
64
|
+
#
|
65
|
+
# @param obj [Object]
|
66
|
+
# @return [Void]
|
67
|
+
def self.validate_raw(obj:)
|
68
|
+
obj.event.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.")
|
69
|
+
obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class AutomationTriggerConditionsItem
|
8
|
+
# @return [String] The property to check (e.g., file.type, file.size)
|
9
|
+
attr_reader :prop
|
10
|
+
# @return [String] The value the property must match
|
11
|
+
attr_reader :value
|
12
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
attr_reader :additional_properties
|
14
|
+
# @return [Object]
|
15
|
+
attr_reader :_field_set
|
16
|
+
protected :_field_set
|
17
|
+
|
18
|
+
OMIT = Object.new
|
19
|
+
|
20
|
+
# @param prop [String] The property to check (e.g., file.type, file.size)
|
21
|
+
# @param value [String] The value the property must match
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
# @return [Ittybit::AutomationTriggerConditionsItem]
|
24
|
+
def initialize(prop:, value:, additional_properties: nil)
|
25
|
+
@prop = prop
|
26
|
+
@value = value
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
@_field_set = { "prop": prop, "value": value }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deserialize a JSON object to an instance of AutomationTriggerConditionsItem
|
32
|
+
#
|
33
|
+
# @param json_object [String]
|
34
|
+
# @return [Ittybit::AutomationTriggerConditionsItem]
|
35
|
+
def self.from_json(json_object:)
|
36
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
|
+
parsed_json = JSON.parse(json_object)
|
38
|
+
prop = parsed_json["prop"]
|
39
|
+
value = parsed_json["value"]
|
40
|
+
new(
|
41
|
+
prop: prop,
|
42
|
+
value: value,
|
43
|
+
additional_properties: struct
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Serialize an instance of AutomationTriggerConditionsItem to a JSON object
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
def to_json(*_args)
|
51
|
+
@_field_set&.to_json
|
52
|
+
end
|
53
|
+
|
54
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
55
|
+
# hash and check each fields type against the current object's property
|
56
|
+
# definitions.
|
57
|
+
#
|
58
|
+
# @param obj [Object]
|
59
|
+
# @return [Void]
|
60
|
+
def self.validate_raw(obj:)
|
61
|
+
obj.prop.is_a?(String) != false || raise("Passed value for field obj.prop is not the expected type, validation failed.")
|
62
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "meta"
|
4
|
+
require_relative "confirmation_response_data"
|
5
|
+
require_relative "links"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class ConfirmationResponse
|
11
|
+
# @return [Ittybit::META]
|
12
|
+
attr_reader :meta
|
13
|
+
# @return [Ittybit::ConfirmationResponseData]
|
14
|
+
attr_reader :data
|
15
|
+
# @return [Ittybit::Links]
|
16
|
+
attr_reader :links
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param meta [Ittybit::META]
|
26
|
+
# @param data [Ittybit::ConfirmationResponseData]
|
27
|
+
# @param links [Ittybit::Links]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Ittybit::ConfirmationResponse]
|
30
|
+
def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
|
31
|
+
@meta = meta if meta != OMIT
|
32
|
+
@data = data if data != OMIT
|
33
|
+
@links = links if links != OMIT
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
@_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
|
36
|
+
v == OMIT
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Deserialize a JSON object to an instance of ConfirmationResponse
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Ittybit::ConfirmationResponse]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
meta = parsed_json["meta"]
|
48
|
+
if parsed_json["data"].nil?
|
49
|
+
data = nil
|
50
|
+
else
|
51
|
+
data = parsed_json["data"].to_json
|
52
|
+
data = Ittybit::ConfirmationResponseData.from_json(json_object: data)
|
53
|
+
end
|
54
|
+
if parsed_json["links"].nil?
|
55
|
+
links = nil
|
56
|
+
else
|
57
|
+
links = parsed_json["links"].to_json
|
58
|
+
links = Ittybit::Links.from_json(json_object: links)
|
59
|
+
end
|
60
|
+
new(
|
61
|
+
meta: meta,
|
62
|
+
data: data,
|
63
|
+
links: links,
|
64
|
+
additional_properties: struct
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of ConfirmationResponse to a JSON object
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_json(*_args)
|
72
|
+
@_field_set&.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
76
|
+
# hash and check each fields type against the current object's property
|
77
|
+
# definitions.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
|
83
|
+
obj.data.nil? || Ittybit::ConfirmationResponseData.validate_raw(obj: obj.data)
|
84
|
+
obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class ConfirmationResponseData
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :message
|
10
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
attr_reader :additional_properties
|
12
|
+
# @return [Object]
|
13
|
+
attr_reader :_field_set
|
14
|
+
protected :_field_set
|
15
|
+
|
16
|
+
OMIT = Object.new
|
17
|
+
|
18
|
+
# @param message [String]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [Ittybit::ConfirmationResponseData]
|
21
|
+
def initialize(message:, additional_properties: nil)
|
22
|
+
@message = message
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
@_field_set = { "message": message }
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of ConfirmationResponseData
|
28
|
+
#
|
29
|
+
# @param json_object [String]
|
30
|
+
# @return [Ittybit::ConfirmationResponseData]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
message = parsed_json["message"]
|
35
|
+
new(message: message, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of ConfirmationResponseData to a JSON object
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
def to_json(*_args)
|
42
|
+
@_field_set&.to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
46
|
+
# hash and check each fields type against the current object's property
|
47
|
+
# definitions.
|
48
|
+
#
|
49
|
+
# @param obj [Object]
|
50
|
+
# @return [Void]
|
51
|
+
def self.validate_raw(obj:)
|
52
|
+
obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class Error
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :message
|
10
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
attr_reader :additional_properties
|
12
|
+
# @return [Object]
|
13
|
+
attr_reader :_field_set
|
14
|
+
protected :_field_set
|
15
|
+
|
16
|
+
OMIT = Object.new
|
17
|
+
|
18
|
+
# @param message [String]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [Ittybit::Error]
|
21
|
+
def initialize(message: OMIT, additional_properties: nil)
|
22
|
+
@message = message if message != OMIT
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
@_field_set = { "message": message }.reject do |_k, v|
|
25
|
+
v == OMIT
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of Error
|
30
|
+
#
|
31
|
+
# @param json_object [String]
|
32
|
+
# @return [Ittybit::Error]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
message = parsed_json["message"]
|
37
|
+
new(message: message, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of Error to a JSON object
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
def to_json(*_args)
|
44
|
+
@_field_set&.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
48
|
+
# hash and check each fields type against the current object's property
|
49
|
+
# definitions.
|
50
|
+
#
|
51
|
+
# @param obj [Object]
|
52
|
+
# @return [Void]
|
53
|
+
def self.validate_raw(obj:)
|
54
|
+
obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "meta"
|
4
|
+
require_relative "error"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Ittybit
|
9
|
+
class ErrorResponse
|
10
|
+
# @return [Ittybit::META]
|
11
|
+
attr_reader :meta
|
12
|
+
# @return [Ittybit::Error]
|
13
|
+
attr_reader :error
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param meta [Ittybit::META]
|
23
|
+
# @param error [Ittybit::Error]
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
# @return [Ittybit::ErrorResponse]
|
26
|
+
def initialize(meta: OMIT, error: OMIT, additional_properties: nil)
|
27
|
+
@meta = meta if meta != OMIT
|
28
|
+
@error = error if error != OMIT
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "meta": meta, "error": error }.reject do |_k, v|
|
31
|
+
v == OMIT
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of ErrorResponse
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [Ittybit::ErrorResponse]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
parsed_json = JSON.parse(json_object)
|
42
|
+
meta = parsed_json["meta"]
|
43
|
+
if parsed_json["error"].nil?
|
44
|
+
error = nil
|
45
|
+
else
|
46
|
+
error = parsed_json["error"].to_json
|
47
|
+
error = Ittybit::Error.from_json(json_object: error)
|
48
|
+
end
|
49
|
+
new(
|
50
|
+
meta: meta,
|
51
|
+
error: error,
|
52
|
+
additional_properties: struct
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Serialize an instance of ErrorResponse to a JSON object
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
def to_json(*_args)
|
60
|
+
@_field_set&.to_json
|
61
|
+
end
|
62
|
+
|
63
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
64
|
+
# hash and check each fields type against the current object's property
|
65
|
+
# definitions.
|
66
|
+
#
|
67
|
+
# @param obj [Object]
|
68
|
+
# @return [Void]
|
69
|
+
def self.validate_raw(obj:)
|
70
|
+
obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
|
71
|
+
obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|