ittybit 0.7.5.1 → 0.7.6

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ittybit/automations/client.rb +14 -6
  3. data/lib/ittybit/files/client.rb +67 -77
  4. data/lib/ittybit/media/client.rb +78 -34
  5. data/lib/ittybit/signatures/client.rb +20 -24
  6. data/lib/ittybit/signatures/types/signatures_create_request_method.rb +0 -3
  7. data/lib/ittybit/types/automation.rb +17 -27
  8. data/lib/ittybit/types/automation_list_response.rb +15 -2
  9. data/lib/ittybit/types/automation_response.rb +15 -2
  10. data/lib/ittybit/types/automation_status.rb +0 -1
  11. data/lib/ittybit/types/automation_trigger.rb +11 -16
  12. data/lib/ittybit/types/{confirmation_response_data.rb → confirmation.rb} +11 -9
  13. data/lib/ittybit/types/confirmation_response.rb +20 -7
  14. data/lib/ittybit/types/file.rb +64 -68
  15. data/lib/ittybit/types/file_kind.rb +0 -1
  16. data/lib/ittybit/types/file_list_response.rb +15 -2
  17. data/lib/ittybit/types/file_object.rb +0 -1
  18. data/lib/ittybit/types/file_response.rb +15 -2
  19. data/lib/ittybit/types/file_status.rb +0 -1
  20. data/lib/ittybit/types/links.rb +4 -4
  21. data/lib/ittybit/types/links_list.rb +17 -32
  22. data/lib/ittybit/types/media.rb +34 -56
  23. data/lib/ittybit/types/media_kind.rb +0 -1
  24. data/lib/ittybit/types/media_list_response.rb +15 -2
  25. data/lib/ittybit/types/media_response.rb +15 -2
  26. data/lib/ittybit/types/media_source.rb +52 -53
  27. data/lib/ittybit/types/media_source_kind.rb +0 -1
  28. data/lib/ittybit/types/media_source_object.rb +0 -1
  29. data/lib/ittybit/types/media_source_orientation.rb +9 -0
  30. data/lib/ittybit/types/media_source_status.rb +0 -1
  31. data/lib/ittybit/types/meta_list.rb +40 -15
  32. data/lib/ittybit/types/meta_list_type.rb +8 -0
  33. data/lib/ittybit/types/signature.rb +14 -14
  34. data/lib/ittybit/types/signature_response.rb +15 -2
  35. data/lib/ittybit/types/task.rb +30 -50
  36. data/lib/ittybit/types/task_list_response.rb +15 -2
  37. data/lib/ittybit/types/task_response.rb +15 -2
  38. data/lib/ittybit/types/task_status.rb +0 -1
  39. data/lib/ittybit/types/task_summary.rb +20 -20
  40. data/lib/ittybit/types/task_summary_kind.rb +9 -13
  41. data/lib/ittybit/types/task_summary_status.rb +0 -1
  42. data/lib/ittybit/types/workflow_task_step.rb +61 -29
  43. data/lib/ittybit/types/workflow_task_step_kind.rb +9 -13
  44. data/lib/requests.rb +2 -2
  45. data/lib/types_export.rb +3 -6
  46. metadata +5 -8
  47. data/lib/ittybit/files/types/files_delete_response.rb +0 -89
  48. data/lib/ittybit/files/types/files_delete_response_data.rb +0 -60
  49. data/lib/ittybit/types/automation_trigger_conditions_item.rb +0 -65
  50. data/lib/ittybit/types/error_response.rb +0 -74
  51. data/lib/ittybit/types/media_urls.rb +0 -70
@@ -16,17 +16,15 @@ module Ittybit
16
16
  @request_client = request_client
17
17
  end
18
18
 
19
- # Creates a cryptographically signed URL that provides temporary and restricted
20
- # access to a file. The URL can expire after a specified time and be limited to
21
- # specific HTTP methods.
19
+ # You can use signatures to create signed URLs which grant access to your
20
+ # project's resources, without revealing your project's API key. URLs can expire
21
+ # after a specified time and be limited to HTTP `GET` method for read-only access,
22
+ # or HTTP `PUT` method for client-side uploads.
22
23
  #
23
- # @param filename [String] The name of the file to generate a signature for. Special characters will be
24
- # sanitised.
25
- # @param folder [String] Optional folder path where the file resides. Special characters will be
26
- # sanitised.
27
- # @param expiry [Long] Optional expiry time for the signature in seconds since epoch. Defaults to 60
28
- # minutes from now. Must be a positive integer and in the future.
29
- # @param method [Ittybit::Signatures::SignaturesCreateRequestMethod] Optional HTTP method allowed for the signed URL. Defaults to 'get'.
24
+ # @param filename [String]
25
+ # @param folder [String]
26
+ # @param expiry [Integer]
27
+ # @param method [Ittybit::Signatures::SignaturesCreateRequestMethod]
30
28
  # @param request_options [Ittybit::RequestOptions]
31
29
  # @return [Ittybit::SignatureResponse]
32
30
  # @example
@@ -37,9 +35,9 @@ module Ittybit
37
35
  # )
38
36
  # api.signatures.create(
39
37
  # filename: "video.mp4",
40
- # folder: "private/user_123",
38
+ # folder: "example",
41
39
  # expiry: 1735689600,
42
- # method: GET
40
+ # method: PUT
43
41
  # )
44
42
  def create(filename:, folder: nil, expiry: nil, method: nil, request_options: nil)
45
43
  response = @request_client.conn.post do |req|
@@ -77,17 +75,15 @@ module Ittybit
77
75
  @request_client = request_client
78
76
  end
79
77
 
80
- # Creates a cryptographically signed URL that provides temporary and restricted
81
- # access to a file. The URL can expire after a specified time and be limited to
82
- # specific HTTP methods.
78
+ # You can use signatures to create signed URLs which grant access to your
79
+ # project's resources, without revealing your project's API key. URLs can expire
80
+ # after a specified time and be limited to HTTP `GET` method for read-only access,
81
+ # or HTTP `PUT` method for client-side uploads.
83
82
  #
84
- # @param filename [String] The name of the file to generate a signature for. Special characters will be
85
- # sanitised.
86
- # @param folder [String] Optional folder path where the file resides. Special characters will be
87
- # sanitised.
88
- # @param expiry [Long] Optional expiry time for the signature in seconds since epoch. Defaults to 60
89
- # minutes from now. Must be a positive integer and in the future.
90
- # @param method [Ittybit::Signatures::SignaturesCreateRequestMethod] Optional HTTP method allowed for the signed URL. Defaults to 'get'.
83
+ # @param filename [String]
84
+ # @param folder [String]
85
+ # @param expiry [Integer]
86
+ # @param method [Ittybit::Signatures::SignaturesCreateRequestMethod]
91
87
  # @param request_options [Ittybit::RequestOptions]
92
88
  # @return [Ittybit::SignatureResponse]
93
89
  # @example
@@ -98,9 +94,9 @@ module Ittybit
98
94
  # )
99
95
  # api.signatures.create(
100
96
  # filename: "video.mp4",
101
- # folder: "private/user_123",
97
+ # folder: "example",
102
98
  # expiry: 1735689600,
103
- # method: GET
99
+ # method: PUT
104
100
  # )
105
101
  def create(filename:, folder: nil, expiry: nil, method: nil, request_options: nil)
106
102
  Async do
@@ -2,12 +2,9 @@
2
2
 
3
3
  module Ittybit
4
4
  class Signatures
5
- # Optional HTTP method allowed for the signed URL. Defaults to 'get'.
6
5
  class SignaturesCreateRequestMethod
7
6
  GET = "get"
8
7
  PUT = "put"
9
- POST = "post"
10
- DELETE = "delete"
11
8
  end
12
9
  end
13
10
  end
@@ -9,24 +9,21 @@ require "json"
9
9
 
10
10
  module Ittybit
11
11
  class Automation
12
- # @return [String] Unique identifier for the automation
12
+ # @return [String]
13
13
  attr_reader :id
14
- # @return [String] User-defined name for the automation
14
+ # @return [String]
15
15
  attr_reader :name
16
- # @return [String] Optional description for the automation
16
+ # @return [String]
17
17
  attr_reader :description
18
- # @return [Hash{String => Object}] User-defined key-value metadata for the automation.
19
- attr_reader :metadata
20
- # @return [Ittybit::AutomationTrigger] The event and conditions that trigger this automation.
18
+ # @return [Ittybit::AutomationTrigger]
21
19
  attr_reader :trigger
22
- # @return [Array<Ittybit::WorkflowTaskStep>] The sequence of tasks to be executed when the automation is triggered. The
23
- # structure of each task object varies depending on its 'kind'.
20
+ # @return [Array<Ittybit::WorkflowTaskStep>]
24
21
  attr_reader :workflow
25
- # @return [Ittybit::AutomationStatus] Current status of the automation
22
+ # @return [Ittybit::AutomationStatus]
26
23
  attr_reader :status
27
- # @return [DateTime] Timestamp when the automation was created
24
+ # @return [DateTime]
28
25
  attr_reader :created
29
- # @return [DateTime] Timestamp when the automation was last updated
26
+ # @return [DateTime]
30
27
  attr_reader :updated
31
28
  # @return [OpenStruct] Additional properties unmapped to the current class definition
32
29
  attr_reader :additional_properties
@@ -36,24 +33,21 @@ module Ittybit
36
33
 
37
34
  OMIT = Object.new
38
35
 
39
- # @param id [String] Unique identifier for the automation
40
- # @param name [String] User-defined name for the automation
41
- # @param description [String] Optional description for the automation
42
- # @param metadata [Hash{String => Object}] User-defined key-value metadata for the automation.
43
- # @param trigger [Ittybit::AutomationTrigger] The event and conditions that trigger this automation.
44
- # @param workflow [Array<Ittybit::WorkflowTaskStep>] The sequence of tasks to be executed when the automation is triggered. The
45
- # structure of each task object varies depending on its 'kind'.
46
- # @param status [Ittybit::AutomationStatus] Current status of the automation
47
- # @param created [DateTime] Timestamp when the automation was created
48
- # @param updated [DateTime] Timestamp when the automation was last updated
36
+ # @param id [String]
37
+ # @param name [String]
38
+ # @param description [String]
39
+ # @param trigger [Ittybit::AutomationTrigger]
40
+ # @param workflow [Array<Ittybit::WorkflowTaskStep>]
41
+ # @param status [Ittybit::AutomationStatus]
42
+ # @param created [DateTime]
43
+ # @param updated [DateTime]
49
44
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
50
45
  # @return [Ittybit::Automation]
51
- def initialize(id:, name:, trigger:, workflow:, status:, created:, updated:, description: OMIT, metadata: OMIT,
46
+ def initialize(id:, name:, trigger:, workflow:, status:, created:, updated:, description: OMIT,
52
47
  additional_properties: nil)
53
48
  @id = id
54
49
  @name = name
55
50
  @description = description if description != OMIT
56
- @metadata = metadata if metadata != OMIT
57
51
  @trigger = trigger
58
52
  @workflow = workflow
59
53
  @status = status
@@ -64,7 +58,6 @@ module Ittybit
64
58
  "id": id,
65
59
  "name": name,
66
60
  "description": description,
67
- "metadata": metadata,
68
61
  "trigger": trigger,
69
62
  "workflow": workflow,
70
63
  "status": status,
@@ -85,7 +78,6 @@ module Ittybit
85
78
  id = parsed_json["id"]
86
79
  name = parsed_json["name"]
87
80
  description = parsed_json["description"]
88
- metadata = parsed_json["metadata"]
89
81
  if parsed_json["trigger"].nil?
90
82
  trigger = nil
91
83
  else
@@ -103,7 +95,6 @@ module Ittybit
103
95
  id: id,
104
96
  name: name,
105
97
  description: description,
106
- metadata: metadata,
107
98
  trigger: trigger,
108
99
  workflow: workflow,
109
100
  status: status,
@@ -130,7 +121,6 @@ module Ittybit
130
121
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
131
122
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
132
123
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
133
- obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
134
124
  Ittybit::AutomationTrigger.validate_raw(obj: obj.trigger)
135
125
  obj.workflow.is_a?(Array) != false || raise("Passed value for field obj.workflow is not the expected type, validation failed.")
136
126
  obj.status.is_a?(Ittybit::AutomationStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "meta_list"
4
4
  require_relative "automation"
5
+ require_relative "error"
5
6
  require_relative "links_list"
6
7
  require "ostruct"
7
8
  require "json"
@@ -12,6 +13,8 @@ module Ittybit
12
13
  attr_reader :meta
13
14
  # @return [Array<Ittybit::Automation>]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::LinksList]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,15 +27,17 @@ module Ittybit
24
27
 
25
28
  # @param meta [Ittybit::MetaList]
26
29
  # @param data [Array<Ittybit::Automation>]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::LinksList]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::AutomationListResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -54,6 +59,12 @@ module Ittybit
54
59
  item = item.to_json
55
60
  Ittybit::Automation.from_json(json_object: item)
56
61
  end
62
+ if parsed_json["error"].nil?
63
+ error = nil
64
+ else
65
+ error = parsed_json["error"].to_json
66
+ error = Ittybit::Error.from_json(json_object: error)
67
+ end
57
68
  if parsed_json["links"].nil?
58
69
  links = nil
59
70
  else
@@ -63,6 +74,7 @@ module Ittybit
63
74
  new(
64
75
  meta: meta,
65
76
  data: data,
77
+ error: error,
66
78
  links: links,
67
79
  additional_properties: struct
68
80
  )
@@ -84,6 +96,7 @@ module Ittybit
84
96
  def self.validate_raw(obj:)
85
97
  obj.meta.nil? || Ittybit::MetaList.validate_raw(obj: obj.meta)
86
98
  obj.data&.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
99
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
87
100
  obj.links.nil? || Ittybit::LinksList.validate_raw(obj: obj.links)
88
101
  end
89
102
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "meta"
4
4
  require_relative "automation"
5
+ require_relative "error"
5
6
  require_relative "links"
6
7
  require "ostruct"
7
8
  require "json"
@@ -12,6 +13,8 @@ module Ittybit
12
13
  attr_reader :meta
13
14
  # @return [Ittybit::Automation]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::Links]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,15 +27,17 @@ module Ittybit
24
27
 
25
28
  # @param meta [Ittybit::META]
26
29
  # @param data [Ittybit::Automation]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::Links]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::AutomationResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -51,6 +56,12 @@ module Ittybit
51
56
  data = parsed_json["data"].to_json
52
57
  data = Ittybit::Automation.from_json(json_object: data)
53
58
  end
59
+ if parsed_json["error"].nil?
60
+ error = nil
61
+ else
62
+ error = parsed_json["error"].to_json
63
+ error = Ittybit::Error.from_json(json_object: error)
64
+ end
54
65
  if parsed_json["links"].nil?
55
66
  links = nil
56
67
  else
@@ -60,6 +71,7 @@ module Ittybit
60
71
  new(
61
72
  meta: meta,
62
73
  data: data,
74
+ error: error,
63
75
  links: links,
64
76
  additional_properties: struct
65
77
  )
@@ -81,6 +93,7 @@ module Ittybit
81
93
  def self.validate_raw(obj:)
82
94
  obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
83
95
  obj.data.nil? || Ittybit::Automation.validate_raw(obj: obj.data)
96
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
84
97
  obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
85
98
  end
86
99
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ittybit
4
- # Current status of the automation
5
4
  class AutomationStatus
6
5
  ACTIVE = "active"
7
6
  INACTIVE = "inactive"
@@ -1,16 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "automation_trigger_conditions_item"
4
3
  require "ostruct"
5
4
  require "json"
6
5
 
7
6
  module Ittybit
8
- # The event and conditions that trigger this automation.
9
7
  class AutomationTrigger
10
- # @return [String] The event that triggers the automation
8
+ # @return [String]
9
+ attr_reader :kind
10
+ # @return [String]
11
11
  attr_reader :event
12
- # @return [Array<Ittybit::AutomationTriggerConditionsItem>] Conditions that must be met for the trigger to activate.
13
- attr_reader :conditions
14
12
  # @return [OpenStruct] Additional properties unmapped to the current class definition
15
13
  attr_reader :additional_properties
16
14
  # @return [Object]
@@ -19,15 +17,15 @@ module Ittybit
19
17
 
20
18
  OMIT = Object.new
21
19
 
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.
20
+ # @param kind [String]
21
+ # @param event [String]
24
22
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
23
  # @return [Ittybit::AutomationTrigger]
26
- def initialize(event:, conditions: OMIT, additional_properties: nil)
24
+ def initialize(event:, kind: OMIT, additional_properties: nil)
25
+ @kind = kind if kind != OMIT
27
26
  @event = event
28
- @conditions = conditions if conditions != OMIT
29
27
  @additional_properties = additional_properties
30
- @_field_set = { "event": event, "conditions": conditions }.reject do |_k, v|
28
+ @_field_set = { "kind": kind, "event": event }.reject do |_k, v|
31
29
  v == OMIT
32
30
  end
33
31
  end
@@ -39,14 +37,11 @@ module Ittybit
39
37
  def self.from_json(json_object:)
40
38
  struct = JSON.parse(json_object, object_class: OpenStruct)
41
39
  parsed_json = JSON.parse(json_object)
40
+ kind = parsed_json["kind"]
42
41
  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
42
  new(
43
+ kind: kind,
48
44
  event: event,
49
- conditions: conditions,
50
45
  additional_properties: struct
51
46
  )
52
47
  end
@@ -65,8 +60,8 @@ module Ittybit
65
60
  # @param obj [Object]
66
61
  # @return [Void]
67
62
  def self.validate_raw(obj:)
63
+ obj.kind&.is_a?(String) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
68
64
  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
65
  end
71
66
  end
72
67
  end
@@ -4,7 +4,7 @@ require "ostruct"
4
4
  require "json"
5
5
 
6
6
  module Ittybit
7
- class ConfirmationResponseData
7
+ class Confirmation
8
8
  # @return [String]
9
9
  attr_reader :message
10
10
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -17,17 +17,19 @@ module Ittybit
17
17
 
18
18
  # @param message [String]
19
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
20
+ # @return [Ittybit::Confirmation]
21
+ def initialize(message: OMIT, additional_properties: nil)
22
+ @message = message if message != OMIT
23
23
  @additional_properties = additional_properties
24
- @_field_set = { "message": message }
24
+ @_field_set = { "message": message }.reject do |_k, v|
25
+ v == OMIT
26
+ end
25
27
  end
26
28
 
27
- # Deserialize a JSON object to an instance of ConfirmationResponseData
29
+ # Deserialize a JSON object to an instance of Confirmation
28
30
  #
29
31
  # @param json_object [String]
30
- # @return [Ittybit::ConfirmationResponseData]
32
+ # @return [Ittybit::Confirmation]
31
33
  def self.from_json(json_object:)
32
34
  struct = JSON.parse(json_object, object_class: OpenStruct)
33
35
  parsed_json = JSON.parse(json_object)
@@ -35,7 +37,7 @@ module Ittybit
35
37
  new(message: message, additional_properties: struct)
36
38
  end
37
39
 
38
- # Serialize an instance of ConfirmationResponseData to a JSON object
40
+ # Serialize an instance of Confirmation to a JSON object
39
41
  #
40
42
  # @return [String]
41
43
  def to_json(*_args)
@@ -49,7 +51,7 @@ module Ittybit
49
51
  # @param obj [Object]
50
52
  # @return [Void]
51
53
  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.")
54
+ obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
53
55
  end
54
56
  end
55
57
  end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "meta"
4
- require_relative "confirmation_response_data"
4
+ require_relative "confirmation"
5
+ require_relative "error"
5
6
  require_relative "links"
6
7
  require "ostruct"
7
8
  require "json"
@@ -10,8 +11,10 @@ module Ittybit
10
11
  class ConfirmationResponse
11
12
  # @return [Ittybit::META]
12
13
  attr_reader :meta
13
- # @return [Ittybit::ConfirmationResponseData]
14
+ # @return [Ittybit::Confirmation]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::Links]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -23,16 +26,18 @@ module Ittybit
23
26
  OMIT = Object.new
24
27
 
25
28
  # @param meta [Ittybit::META]
26
- # @param data [Ittybit::ConfirmationResponseData]
29
+ # @param data [Ittybit::Confirmation]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::Links]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::ConfirmationResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -49,7 +54,13 @@ module Ittybit
49
54
  data = nil
50
55
  else
51
56
  data = parsed_json["data"].to_json
52
- data = Ittybit::ConfirmationResponseData.from_json(json_object: data)
57
+ data = Ittybit::Confirmation.from_json(json_object: data)
58
+ end
59
+ if parsed_json["error"].nil?
60
+ error = nil
61
+ else
62
+ error = parsed_json["error"].to_json
63
+ error = Ittybit::Error.from_json(json_object: error)
53
64
  end
54
65
  if parsed_json["links"].nil?
55
66
  links = nil
@@ -60,6 +71,7 @@ module Ittybit
60
71
  new(
61
72
  meta: meta,
62
73
  data: data,
74
+ error: error,
63
75
  links: links,
64
76
  additional_properties: struct
65
77
  )
@@ -80,7 +92,8 @@ module Ittybit
80
92
  # @return [Void]
81
93
  def self.validate_raw(obj:)
82
94
  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)
95
+ obj.data.nil? || Ittybit::Confirmation.validate_raw(obj: obj.data)
96
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
84
97
  obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
85
98
  end
86
99
  end