Class: Merge::Ats::SyncStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/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

Class Method Summary collapse

Instance Method Summary collapse

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::Ats::SyncStatus

Parameters:

  • model_name (String)
  • model_id (String)
  • last_sync_start (DateTime) (defaults to: OMIT)
  • next_sync_start (DateTime) (defaults to: OMIT)
  • last_sync_result (Merge::Ats::LastSyncResultEnum) (defaults to: OMIT)
  • last_sync_finished (DateTime) (defaults to: OMIT)
  • status (Merge::Ats::StatusFd5Enum)
  • is_initial_sync (Boolean)
  • selective_sync_configurations_usage (Merge::Ats::SelectiveSyncConfigurationsUsageEnum) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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/ats/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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



37
38
39
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 37

def additional_properties
  @additional_properties
end

#is_initial_syncBoolean (readonly)

Returns:

  • (Boolean)


33
34
35
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 33

def is_initial_sync
  @is_initial_sync
end

#last_sync_finishedDateTime (readonly)

Returns:

  • (DateTime)


29
30
31
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 29

def last_sync_finished
  @last_sync_finished
end

#last_sync_resultMerge::Ats::LastSyncResultEnum (readonly)



27
28
29
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 27

def last_sync_result
  @last_sync_result
end

#last_sync_startDateTime (readonly)

Returns:

  • (DateTime)


23
24
25
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 23

def last_sync_start
  @last_sync_start
end

#model_idString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 21

def model_id
  @model_id
end

#model_nameString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 19

def model_name
  @model_name
end

#next_sync_startDateTime (readonly)

Returns:

  • (DateTime)


25
26
27
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 25

def next_sync_start
  @next_sync_start
end

#selective_sync_configurations_usageMerge::Ats::SelectiveSyncConfigurationsUsageEnum (readonly)



35
36
37
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 35

def selective_sync_configurations_usage
  @selective_sync_configurations_usage
end

#statusMerge::Ats::StatusFd5Enum (readonly)



31
32
33
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 31

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Ats::SyncStatus

Deserialize a JSON object to an instance of SyncStatus

Parameters:

  • json_object (String)

Returns:



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/ats/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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


129
130
131
132
133
134
135
136
137
138
139
# File 'lib/merge_ruby_client/ats/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::Ats::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::Ats::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::Ats::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

Returns:

  • (String)


119
120
121
# File 'lib/merge_ruby_client/ats/types/sync_status.rb', line 119

def to_json(*_args)
  @_field_set&.to_json
end