Class: Merge::Ticketing::SyncStatus
- Inherits:
-
Object
- Object
- Merge::Ticketing::SyncStatus
- Defined in:
- lib/merge_ruby_client/ticketing/types/sync_status.rb
Overview
# The SyncStatus Object
### Description
The `SyncStatus` object is used to represent the syncing state of an account
### Usage Example
View the `SyncStatus` for an account to see how recently its models were synced.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #is_initial_sync ⇒ Boolean readonly
- #last_sync_finished ⇒ DateTime readonly
- #last_sync_result ⇒ Merge::Ticketing::LastSyncResultEnum readonly
- #last_sync_start ⇒ DateTime readonly
- #model_id ⇒ String readonly
- #model_name ⇒ String readonly
- #next_sync_start ⇒ DateTime readonly
- #selective_sync_configurations_usage ⇒ Merge::Ticketing::SelectiveSyncConfigurationsUsageEnum readonly
- #status ⇒ Merge::Ticketing::StatusFd5Enum readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Ticketing::SyncStatus
Deserialize a JSON object to an instance of SyncStatus.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(model_name:, model_id:, status:, is_initial_sync:, last_sync_start: OMIT, next_sync_start: OMIT, last_sync_result: OMIT, last_sync_finished: OMIT, selective_sync_configurations_usage: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::SyncStatus constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of SyncStatus to a JSON object.
Constructor Details
#initialize(model_name:, model_id:, status:, is_initial_sync:, last_sync_start: OMIT, next_sync_start: OMIT, last_sync_result: OMIT, last_sync_finished: OMIT, selective_sync_configurations_usage: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::SyncStatus
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 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 55 def initialize(model_name:, model_id:, status:, is_initial_sync:, last_sync_start: OMIT, next_sync_start: OMIT, last_sync_result: OMIT, last_sync_finished: OMIT, selective_sync_configurations_usage: OMIT, additional_properties: nil) @model_name = model_name @model_id = model_id @last_sync_start = last_sync_start if last_sync_start != OMIT @next_sync_start = next_sync_start if next_sync_start != OMIT @last_sync_result = last_sync_result if last_sync_result != OMIT @last_sync_finished = last_sync_finished if last_sync_finished != OMIT @status = status @is_initial_sync = is_initial_sync if selective_sync_configurations_usage != OMIT @selective_sync_configurations_usage = selective_sync_configurations_usage end @additional_properties = additional_properties @_field_set = { "model_name": model_name, "model_id": model_id, "last_sync_start": last_sync_start, "next_sync_start": next_sync_start, "last_sync_result": last_sync_result, "last_sync_finished": last_sync_finished, "status": status, "is_initial_sync": is_initial_sync, "selective_sync_configurations_usage": selective_sync_configurations_usage }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
37 38 39 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 37 def additional_properties @additional_properties end |
#is_initial_sync ⇒ Boolean (readonly)
33 34 35 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 33 def is_initial_sync @is_initial_sync end |
#last_sync_finished ⇒ DateTime (readonly)
29 30 31 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 29 def last_sync_finished @last_sync_finished end |
#last_sync_result ⇒ Merge::Ticketing::LastSyncResultEnum (readonly)
27 28 29 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 27 def last_sync_result @last_sync_result end |
#last_sync_start ⇒ DateTime (readonly)
23 24 25 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 23 def last_sync_start @last_sync_start end |
#model_id ⇒ String (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 21 def model_id @model_id end |
#model_name ⇒ String (readonly)
19 20 21 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 19 def model_name @model_name end |
#next_sync_start ⇒ DateTime (readonly)
25 26 27 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 25 def next_sync_start @next_sync_start end |
#selective_sync_configurations_usage ⇒ Merge::Ticketing::SelectiveSyncConfigurationsUsageEnum (readonly)
35 36 37 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 35 def selective_sync_configurations_usage @selective_sync_configurations_usage end |
#status ⇒ Merge::Ticketing::StatusFd5Enum (readonly)
31 32 33 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 31 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Ticketing::SyncStatus
Deserialize a JSON object to an instance of SyncStatus
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 88 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) model_name = parsed_json["model_name"] model_id = parsed_json["model_id"] last_sync_start = (DateTime.parse(parsed_json["last_sync_start"]) unless parsed_json["last_sync_start"].nil?) next_sync_start = (DateTime.parse(parsed_json["next_sync_start"]) unless parsed_json["next_sync_start"].nil?) last_sync_result = parsed_json["last_sync_result"] last_sync_finished = unless parsed_json["last_sync_finished"].nil? DateTime.parse(parsed_json["last_sync_finished"]) end status = parsed_json["status"] is_initial_sync = parsed_json["is_initial_sync"] selective_sync_configurations_usage = parsed_json["selective_sync_configurations_usage"] new( model_name: model_name, model_id: model_id, last_sync_start: last_sync_start, next_sync_start: next_sync_start, last_sync_result: last_sync_result, last_sync_finished: last_sync_finished, status: status, is_initial_sync: is_initial_sync, selective_sync_configurations_usage: selective_sync_configurations_usage, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 129 def self.validate_raw(obj:) obj.model_name.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.") obj.model_id.is_a?(String) != false || raise("Passed value for field obj.model_id is not the expected type, validation failed.") obj.last_sync_start&.is_a?(DateTime) != false || raise("Passed value for field obj.last_sync_start is not the expected type, validation failed.") obj.next_sync_start&.is_a?(DateTime) != false || raise("Passed value for field obj.next_sync_start is not the expected type, validation failed.") obj.last_sync_result&.is_a?(Merge::Ticketing::LastSyncResultEnum) != false || raise("Passed value for field obj.last_sync_result is not the expected type, validation failed.") obj.last_sync_finished&.is_a?(DateTime) != false || raise("Passed value for field obj.last_sync_finished is not the expected type, validation failed.") obj.status.is_a?(Merge::Ticketing::StatusFd5Enum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.is_initial_sync.is_a?(Boolean) != false || raise("Passed value for field obj.is_initial_sync is not the expected type, validation failed.") obj.selective_sync_configurations_usage&.is_a?(Merge::Ticketing::SelectiveSyncConfigurationsUsageEnum) != false || raise("Passed value for field obj.selective_sync_configurations_usage is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of SyncStatus to a JSON object
119 120 121 |
# File 'lib/merge_ruby_client/ticketing/types/sync_status.rb', line 119 def to_json(*_args) @_field_set&.to_json end |