Class: Merge::Filestorage::SyncStatus
- Inherits:
-
Object
- Object
- Merge::Filestorage::SyncStatus
- Defined in:
- lib/merge_ruby_client/filestorage/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_start ⇒ DateTime readonly
- #model_id ⇒ String readonly
- #model_name ⇒ String readonly
- #next_sync_start ⇒ DateTime readonly
- #selective_sync_configurations_usage ⇒ Merge::Filestorage::SelectiveSyncConfigurationsUsageEnum readonly
- #status ⇒ Merge::Filestorage::SyncStatusStatusEnum readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Filestorage::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, selective_sync_configurations_usage: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::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, selective_sync_configurations_usage: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::SyncStatus
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 48 def initialize(model_name:, model_id:, status:, is_initial_sync:, last_sync_start: OMIT, next_sync_start: 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 @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, "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.
32 33 34 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 32 def additional_properties @additional_properties end |
#is_initial_sync ⇒ Boolean (readonly)
28 29 30 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 28 def is_initial_sync @is_initial_sync end |
#last_sync_start ⇒ DateTime (readonly)
22 23 24 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 22 def last_sync_start @last_sync_start end |
#model_id ⇒ String (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 20 def model_id @model_id end |
#model_name ⇒ String (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 18 def model_name @model_name end |
#next_sync_start ⇒ DateTime (readonly)
24 25 26 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 24 def next_sync_start @next_sync_start end |
#selective_sync_configurations_usage ⇒ Merge::Filestorage::SelectiveSyncConfigurationsUsageEnum (readonly)
30 31 32 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 30 def selective_sync_configurations_usage @selective_sync_configurations_usage end |
#status ⇒ Merge::Filestorage::SyncStatusStatusEnum (readonly)
26 27 28 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 26 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Filestorage::SyncStatus
Deserialize a JSON object to an instance of SyncStatus
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 77 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?) 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, 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.
112 113 114 115 116 117 118 119 120 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 112 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.status.is_a?(Merge::Filestorage::SyncStatusStatusEnum) != 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::Filestorage::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
102 103 104 |
# File 'lib/merge_ruby_client/filestorage/types/sync_status.rb', line 102 def to_json(*_args) @_field_set&.to_json end |