sz-apimatic-sdk 0.0.1

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 (95) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +153 -0
  4. data/bin/console +15 -0
  5. data/lib/seltz_api/api_helper.rb +10 -0
  6. data/lib/seltz_api/apis/agent_api.rb +140 -0
  7. data/lib/seltz_api/apis/answer_api.rb +61 -0
  8. data/lib/seltz_api/apis/base_api.rb +67 -0
  9. data/lib/seltz_api/apis/fetch_api.rb +48 -0
  10. data/lib/seltz_api/apis/monitors_api.rb +161 -0
  11. data/lib/seltz_api/apis/records_api.rb +97 -0
  12. data/lib/seltz_api/apis/runs_api.rb +109 -0
  13. data/lib/seltz_api/apis/search_api.rb +55 -0
  14. data/lib/seltz_api/client.rb +111 -0
  15. data/lib/seltz_api/configuration.rb +165 -0
  16. data/lib/seltz_api/exceptions/api_exception.rb +21 -0
  17. data/lib/seltz_api/exceptions/error_envelope_exception.rb +46 -0
  18. data/lib/seltz_api/http/api_response.rb +19 -0
  19. data/lib/seltz_api/http/auth/custom_header_authentication.rb +52 -0
  20. data/lib/seltz_api/http/http_call_back.rb +10 -0
  21. data/lib/seltz_api/http/http_method_enum.rb +10 -0
  22. data/lib/seltz_api/http/http_request.rb +10 -0
  23. data/lib/seltz_api/http/http_response.rb +10 -0
  24. data/lib/seltz_api/http/proxy_settings.rb +22 -0
  25. data/lib/seltz_api/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/seltz_api/logging/sdk_logger.rb +17 -0
  27. data/lib/seltz_api/models/agent_run.rb +161 -0
  28. data/lib/seltz_api/models/agent_run_citation.rb +85 -0
  29. data/lib/seltz_api/models/agent_run_grounding.rb +94 -0
  30. data/lib/seltz_api/models/agent_run_output.rb +131 -0
  31. data/lib/seltz_api/models/agent_run_output2.rb +131 -0
  32. data/lib/seltz_api/models/agent_run_request.rb +100 -0
  33. data/lib/seltz_api/models/agent_run_request2.rb +100 -0
  34. data/lib/seltz_api/models/agent_run_source.rb +86 -0
  35. data/lib/seltz_api/models/agent_run_status.rb +49 -0
  36. data/lib/seltz_api/models/agent_run_status2.rb +48 -0
  37. data/lib/seltz_api/models/agent_run_stop_reason.rb +53 -0
  38. data/lib/seltz_api/models/agent_run_stop_reason2.rb +52 -0
  39. data/lib/seltz_api/models/answer_http_request.rb +172 -0
  40. data/lib/seltz_api/models/answer_http_response.rb +93 -0
  41. data/lib/seltz_api/models/base_model.rb +110 -0
  42. data/lib/seltz_api/models/content_options.rb +99 -0
  43. data/lib/seltz_api/models/create_agent_run_request.rb +104 -0
  44. data/lib/seltz_api/models/create_monitor_request.rb +143 -0
  45. data/lib/seltz_api/models/create_monitor_response.rb +90 -0
  46. data/lib/seltz_api/models/document.rb +128 -0
  47. data/lib/seltz_api/models/envelope_error.rb +83 -0
  48. data/lib/seltz_api/models/envelope_error1.rb +82 -0
  49. data/lib/seltz_api/models/fetch_error.rb +107 -0
  50. data/lib/seltz_api/models/fetch_error1.rb +108 -0
  51. data/lib/seltz_api/models/fetch_request.rb +144 -0
  52. data/lib/seltz_api/models/fetch_response.rb +87 -0
  53. data/lib/seltz_api/models/fetch_result.rb +176 -0
  54. data/lib/seltz_api/models/fetch_status.rb +36 -0
  55. data/lib/seltz_api/models/fetch_status2.rb +40 -0
  56. data/lib/seltz_api/models/fields.rb +108 -0
  57. data/lib/seltz_api/models/fields2.rb +101 -0
  58. data/lib/seltz_api/models/get_monitor_response.rb +87 -0
  59. data/lib/seltz_api/models/get_run_response.rb +76 -0
  60. data/lib/seltz_api/models/http_citation.rb +86 -0
  61. data/lib/seltz_api/models/list_agent_runs_response.rb +96 -0
  62. data/lib/seltz_api/models/list_monitors_response.rb +97 -0
  63. data/lib/seltz_api/models/list_records_response.rb +96 -0
  64. data/lib/seltz_api/models/list_run_records_response.rb +96 -0
  65. data/lib/seltz_api/models/list_run_requests_response.rb +84 -0
  66. data/lib/seltz_api/models/list_runs_response.rb +96 -0
  67. data/lib/seltz_api/models/monitor.rb +157 -0
  68. data/lib/seltz_api/models/monitor_search_request.rb +110 -0
  69. data/lib/seltz_api/models/monitor_status.rb +47 -0
  70. data/lib/seltz_api/models/monitor_status2.rb +45 -0
  71. data/lib/seltz_api/models/payload.rb +74 -0
  72. data/lib/seltz_api/models/record.rb +116 -0
  73. data/lib/seltz_api/models/record_type.rb +26 -0
  74. data/lib/seltz_api/models/request_status.rb +36 -0
  75. data/lib/seltz_api/models/run.rb +200 -0
  76. data/lib/seltz_api/models/run_request.rb +127 -0
  77. data/lib/seltz_api/models/run_state.rb +40 -0
  78. data/lib/seltz_api/models/run_state2.rb +41 -0
  79. data/lib/seltz_api/models/run_status.rb +47 -0
  80. data/lib/seltz_api/models/schedule.rb +73 -0
  81. data/lib/seltz_api/models/search_record.rb +101 -0
  82. data/lib/seltz_api/models/search_request.rb +208 -0
  83. data/lib/seltz_api/models/search_request_ref.rb +87 -0
  84. data/lib/seltz_api/models/search_response.rb +85 -0
  85. data/lib/seltz_api/models/snippet.rb +76 -0
  86. data/lib/seltz_api/models/snippet_options.rb +151 -0
  87. data/lib/seltz_api/models/update_monitor_request.rb +153 -0
  88. data/lib/seltz_api/models/update_monitor_response.rb +77 -0
  89. data/lib/seltz_api/models/webhook.rb +113 -0
  90. data/lib/seltz_api/models/webhook1.rb +114 -0
  91. data/lib/seltz_api/utilities/date_time_helper.rb +11 -0
  92. data/lib/seltz_api/utilities/file_wrapper.rb +28 -0
  93. data/lib/seltz_api/utilities/union_type_lookup.rb +62 -0
  94. data/lib/seltz_api.rb +115 -0
  95. metadata +178 -0
@@ -0,0 +1,157 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Monitor Model.
8
+ class Monitor < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :cadence
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :created_at
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :monitor_id
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :name
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [Array[MonitorSearchRequest]]
30
+ attr_accessor :search_requests
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [MonitorStatus]
34
+ attr_accessor :status
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [String]
38
+ attr_accessor :updated_at
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [Webhook]
42
+ attr_accessor :webhook
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['cadence'] = 'cadence'
48
+ @_hash['created_at'] = 'created_at'
49
+ @_hash['monitor_id'] = 'monitor_id'
50
+ @_hash['name'] = 'name'
51
+ @_hash['search_requests'] = 'search_requests'
52
+ @_hash['status'] = 'status'
53
+ @_hash['updated_at'] = 'updated_at'
54
+ @_hash['webhook'] = 'webhook'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def self.optionals
60
+ %w[
61
+ created_at
62
+ monitor_id
63
+ name
64
+ search_requests
65
+ updated_at
66
+ webhook
67
+ ]
68
+ end
69
+
70
+ # An array for nullable fields
71
+ def self.nullables
72
+ %w[
73
+ created_at
74
+ updated_at
75
+ webhook
76
+ ]
77
+ end
78
+
79
+ def initialize(cadence:, status: MonitorStatus::ACTIVE, created_at: SKIP,
80
+ monitor_id: SKIP, name: SKIP, search_requests: SKIP,
81
+ updated_at: SKIP, webhook: SKIP, additional_properties: nil)
82
+ # Add additional model properties to the instance
83
+ additional_properties = {} if additional_properties.nil?
84
+
85
+ @cadence = cadence
86
+ @created_at = created_at unless created_at == SKIP
87
+ @monitor_id = monitor_id unless monitor_id == SKIP
88
+ @name = name unless name == SKIP
89
+ @search_requests = search_requests unless search_requests == SKIP
90
+ @status = status
91
+ @updated_at = updated_at unless updated_at == SKIP
92
+ @webhook = webhook unless webhook == SKIP
93
+ @additional_properties = additional_properties
94
+ end
95
+
96
+ # Creates an instance of the object from a hash.
97
+ def self.from_hash(hash)
98
+ return nil unless hash
99
+
100
+ # Extract variables from the hash.
101
+ cadence = hash.key?('cadence') ? hash['cadence'] : nil
102
+ status = hash['status'] ||= MonitorStatus::ACTIVE
103
+ created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
104
+ monitor_id = hash.key?('monitor_id') ? hash['monitor_id'] : SKIP
105
+ name = hash.key?('name') ? hash['name'] : SKIP
106
+ # Parameter is an array, so we need to iterate through it
107
+ search_requests = nil
108
+ unless hash['search_requests'].nil?
109
+ search_requests = []
110
+ hash['search_requests'].each do |structure|
111
+ search_requests << (MonitorSearchRequest.from_hash(structure) if structure)
112
+ end
113
+ end
114
+
115
+ search_requests = SKIP unless hash.key?('search_requests')
116
+ updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP
117
+ webhook = Webhook.from_hash(hash['webhook']) if hash['webhook']
118
+
119
+ # Create a new hash for additional properties, removing known properties.
120
+ new_hash = hash.reject { |k, _| names.value?(k) }
121
+
122
+ additional_properties = APIHelper.get_additional_properties(
123
+ new_hash, proc { |value| value }
124
+ )
125
+
126
+ # Create object from extracted values.
127
+ Monitor.new(cadence: cadence,
128
+ status: status,
129
+ created_at: created_at,
130
+ monitor_id: monitor_id,
131
+ name: name,
132
+ search_requests: search_requests,
133
+ updated_at: updated_at,
134
+ webhook: webhook,
135
+ additional_properties: additional_properties)
136
+ end
137
+
138
+ # Provides a human-readable string representation of the object.
139
+ def to_s
140
+ class_name = self.class.name.split('::').last
141
+ "<#{class_name} cadence: #{@cadence}, created_at: #{@created_at}, monitor_id:"\
142
+ " #{@monitor_id}, name: #{@name}, search_requests: #{@search_requests}, status: #{@status},"\
143
+ " updated_at: #{@updated_at}, webhook: #{@webhook}, additional_properties:"\
144
+ " #{@additional_properties}>"
145
+ end
146
+
147
+ # Provides a debugging-friendly string with detailed object information.
148
+ def inspect
149
+ class_name = self.class.name.split('::').last
150
+ "<#{class_name} cadence: #{@cadence.inspect}, created_at: #{@created_at.inspect},"\
151
+ " monitor_id: #{@monitor_id.inspect}, name: #{@name.inspect}, search_requests:"\
152
+ " #{@search_requests.inspect}, status: #{@status.inspect}, updated_at:"\
153
+ " #{@updated_at.inspect}, webhook: #{@webhook.inspect}, additional_properties:"\
154
+ " #{@additional_properties}>"
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,110 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # A search request stored on a monitor, with its server-assigned id.
8
+ class MonitorSearchRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Consecutive failed runs for this request.
13
+ # @return [Integer]
14
+ attr_accessor :consecutive_failures
15
+
16
+ # Consecutive failed runs for this request.
17
+ # @return [String]
18
+ attr_accessor :last_success_at
19
+
20
+ # Consecutive failed runs for this request.
21
+ # @return [SearchRequest]
22
+ attr_accessor :request
23
+
24
+ # Consecutive failed runs for this request.
25
+ # @return [String]
26
+ attr_accessor :request_id
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['consecutive_failures'] = 'consecutive_failures'
32
+ @_hash['last_success_at'] = 'last_success_at'
33
+ @_hash['request'] = 'request'
34
+ @_hash['request_id'] = 'request_id'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ consecutive_failures
42
+ last_success_at
43
+ request
44
+ request_id
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ %w[
51
+ last_success_at
52
+ request
53
+ ]
54
+ end
55
+
56
+ def initialize(consecutive_failures: 0, last_success_at: SKIP,
57
+ request: SKIP, request_id: SKIP, additional_properties: nil)
58
+ # Add additional model properties to the instance
59
+ additional_properties = {} if additional_properties.nil?
60
+
61
+ @consecutive_failures = consecutive_failures unless consecutive_failures == SKIP
62
+ @last_success_at = last_success_at unless last_success_at == SKIP
63
+ @request = request unless request == SKIP
64
+ @request_id = request_id unless request_id == SKIP
65
+ @additional_properties = additional_properties
66
+ end
67
+
68
+ # Creates an instance of the object from a hash.
69
+ def self.from_hash(hash)
70
+ return nil unless hash
71
+
72
+ # Extract variables from the hash.
73
+ consecutive_failures = hash['consecutive_failures'] ||= 0
74
+ last_success_at =
75
+ hash.key?('last_success_at') ? hash['last_success_at'] : SKIP
76
+ request = SearchRequest.from_hash(hash['request']) if hash['request']
77
+ request_id = hash.key?('request_id') ? hash['request_id'] : SKIP
78
+
79
+ # Create a new hash for additional properties, removing known properties.
80
+ new_hash = hash.reject { |k, _| names.value?(k) }
81
+
82
+ additional_properties = APIHelper.get_additional_properties(
83
+ new_hash, proc { |value| value }
84
+ )
85
+
86
+ # Create object from extracted values.
87
+ MonitorSearchRequest.new(consecutive_failures: consecutive_failures,
88
+ last_success_at: last_success_at,
89
+ request: request,
90
+ request_id: request_id,
91
+ additional_properties: additional_properties)
92
+ end
93
+
94
+ # Provides a human-readable string representation of the object.
95
+ def to_s
96
+ class_name = self.class.name.split('::').last
97
+ "<#{class_name} consecutive_failures: #{@consecutive_failures}, last_success_at:"\
98
+ " #{@last_success_at}, request: #{@request}, request_id: #{@request_id},"\
99
+ " additional_properties: #{@additional_properties}>"
100
+ end
101
+
102
+ # Provides a debugging-friendly string with detailed object information.
103
+ def inspect
104
+ class_name = self.class.name.split('::').last
105
+ "<#{class_name} consecutive_failures: #{@consecutive_failures.inspect}, last_success_at:"\
106
+ " #{@last_success_at.inspect}, request: #{@request.inspect}, request_id:"\
107
+ " #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,47 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # A monitor's lifecycle state. `active` is scheduled and running. `paused`
8
+ # runs nothing and keeps its records and its record of what it has already
9
+ # delivered. Only those two can be set through the API; `disabled` and
10
+ # `deleted` are set by Seltz.
11
+ class MonitorStatus
12
+ MONITOR_STATUS = [
13
+ # TODO: Write general description for ACTIVE
14
+ ACTIVE = 'active'.freeze,
15
+
16
+ # TODO: Write general description for PAUSED
17
+ PAUSED = 'paused'.freeze,
18
+
19
+ # TODO: Write general description for DISABLED
20
+ DISABLED = 'disabled'.freeze,
21
+
22
+ # TODO: Write general description for DELETED
23
+ DELETED = 'deleted'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ MONITOR_STATUS.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = ACTIVE)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'active' then ACTIVE
39
+ when 'paused' then PAUSED
40
+ when 'disabled' then DISABLED
41
+ when 'deleted' then DELETED
42
+ else
43
+ default_value
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,45 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Set to `paused` to create the monitor without starting it. Only `active` and
8
+ # `paused` are accepted. Defaults to `active`.
9
+ class MonitorStatus2
10
+ MONITOR_STATUS2 = [
11
+ # TODO: Write general description for ACTIVE
12
+ ACTIVE = 'active'.freeze,
13
+
14
+ # TODO: Write general description for PAUSED
15
+ PAUSED = 'paused'.freeze,
16
+
17
+ # TODO: Write general description for DISABLED
18
+ DISABLED = 'disabled'.freeze,
19
+
20
+ # TODO: Write general description for DELETED
21
+ DELETED = 'deleted'.freeze
22
+ ].freeze
23
+
24
+ def self.validate(value)
25
+ return false if value.nil?
26
+
27
+ MONITOR_STATUS2.include?(value)
28
+ end
29
+
30
+ def self.from_value(value, default_value = ACTIVE)
31
+ return default_value if value.nil?
32
+
33
+ str = value.to_s.strip
34
+
35
+ case str.downcase
36
+ when 'active' then ACTIVE
37
+ when 'paused' then PAUSED
38
+ when 'disabled' then DISABLED
39
+ when 'deleted' then DELETED
40
+ else
41
+ default_value
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,74 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Payload Model.
8
+ class Payload < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [SearchRecord]
14
+ attr_accessor :search_result
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['search_result'] = 'search_result'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(search_result:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @search_result = search_result
38
+ @additional_properties = additional_properties
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ search_result = SearchRecord.from_hash(hash['search_result']) if hash['search_result']
47
+
48
+ # Create a new hash for additional properties, removing known properties.
49
+ new_hash = hash.reject { |k, _| names.value?(k) }
50
+
51
+ additional_properties = APIHelper.get_additional_properties(
52
+ new_hash, proc { |value| value }
53
+ )
54
+
55
+ # Create object from extracted values.
56
+ Payload.new(search_result: search_result,
57
+ additional_properties: additional_properties)
58
+ end
59
+
60
+ # Provides a human-readable string representation of the object.
61
+ def to_s
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} search_result: #{@search_result}, additional_properties:"\
64
+ " #{@additional_properties}>"
65
+ end
66
+
67
+ # Provides a debugging-friendly string with detailed object information.
68
+ def inspect
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} search_result: #{@search_result.inspect}, additional_properties:"\
71
+ " #{@additional_properties}>"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,116 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Record Model.
8
+ class Record < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [SearchRecord]
14
+ attr_accessor :search_result
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :first_seen_at
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :record_id
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :run_id
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [RecordType]
30
+ attr_accessor :type
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['search_result'] = 'search_result'
36
+ @_hash['first_seen_at'] = 'first_seen_at'
37
+ @_hash['record_id'] = 'record_id'
38
+ @_hash['run_id'] = 'run_id'
39
+ @_hash['type'] = 'type'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ first_seen_at
47
+ record_id
48
+ run_id
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ %w[
55
+ first_seen_at
56
+ ]
57
+ end
58
+
59
+ def initialize(search_result:, type: RecordType::SEARCH_RESULT,
60
+ first_seen_at: SKIP, record_id: '0', run_id: '0',
61
+ additional_properties: nil)
62
+ # Add additional model properties to the instance
63
+ additional_properties = {} if additional_properties.nil?
64
+
65
+ @search_result = search_result
66
+ @first_seen_at = first_seen_at unless first_seen_at == SKIP
67
+ @record_id = record_id unless record_id == SKIP
68
+ @run_id = run_id unless run_id == SKIP
69
+ @type = type
70
+ @additional_properties = additional_properties
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ search_result = SearchRecord.from_hash(hash['search_result']) if hash['search_result']
79
+ type = hash['type'] ||= RecordType::SEARCH_RESULT
80
+ first_seen_at = hash.key?('first_seen_at') ? hash['first_seen_at'] : SKIP
81
+ record_id = hash['record_id'] ||= '0'
82
+ run_id = hash['run_id'] ||= '0'
83
+
84
+ # Create a new hash for additional properties, removing known properties.
85
+ new_hash = hash.reject { |k, _| names.value?(k) }
86
+
87
+ additional_properties = APIHelper.get_additional_properties(
88
+ new_hash, proc { |value| value }
89
+ )
90
+
91
+ # Create object from extracted values.
92
+ Record.new(search_result: search_result,
93
+ type: type,
94
+ first_seen_at: first_seen_at,
95
+ record_id: record_id,
96
+ run_id: run_id,
97
+ additional_properties: additional_properties)
98
+ end
99
+
100
+ # Provides a human-readable string representation of the object.
101
+ def to_s
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} search_result: #{@search_result}, first_seen_at: #{@first_seen_at},"\
104
+ " record_id: #{@record_id}, run_id: #{@run_id}, type: #{@type}, additional_properties:"\
105
+ " #{@additional_properties}>"
106
+ end
107
+
108
+ # Provides a debugging-friendly string with detailed object information.
109
+ def inspect
110
+ class_name = self.class.name.split('::').last
111
+ "<#{class_name} search_result: #{@search_result.inspect}, first_seen_at:"\
112
+ " #{@first_seen_at.inspect}, record_id: #{@record_id.inspect}, run_id: #{@run_id.inspect},"\
113
+ " type: #{@type.inspect}, additional_properties: #{@additional_properties}>"
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,26 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # What a record carries.
8
+ class RecordType
9
+ RECORD_TYPE = [
10
+ # TODO: Write general description for SEARCH_RESULT
11
+ SEARCH_RESULT = 'search_result'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ RECORD_TYPE.include?(value)
18
+ end
19
+
20
+ def self.from_value(value, default_value = SEARCH_RESULT)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,36 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Whether one search request succeeded in a run.
8
+ class RequestStatus
9
+ REQUEST_STATUS = [
10
+ # TODO: Write general description for OK
11
+ OK = 'ok'.freeze,
12
+
13
+ # TODO: Write general description for FAILED
14
+ FAILED = 'failed'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ REQUEST_STATUS.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = OK)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'ok' then OK
30
+ when 'failed' then FAILED
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end