Class: Merge::Accounting::DebugModeLog

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/accounting/types/debug_mode_log.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log_id:, dashboard_view:, log_summary:, additional_properties: nil) ⇒ Merge::Accounting::DebugModeLog

Parameters:

  • log_id (String)
  • dashboard_view (String)
  • log_summary (Merge::Accounting::DebugModelLogSummary)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 29

def initialize(log_id:, dashboard_view:, log_summary:, additional_properties: nil)
  @log_id = log_id
  @dashboard_view = dashboard_view
  @log_summary = log_summary
  @additional_properties = additional_properties
  @_field_set = { "log_id": log_id, "dashboard_view": dashboard_view, "log_summary": log_summary }
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



17
18
19
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 17

def additional_properties
  @additional_properties
end

#dashboard_viewString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 13

def dashboard_view
  @dashboard_view
end

#log_idString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 11

def log_id
  @log_id
end

#log_summaryMerge::Accounting::DebugModelLogSummary (readonly)



15
16
17
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 15

def log_summary
  @log_summary
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Accounting::DebugModeLog

Deserialize a JSON object to an instance of DebugModeLog

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 41

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  log_id = parsed_json["log_id"]
  dashboard_view = parsed_json["dashboard_view"]
  if parsed_json["log_summary"].nil?
    log_summary = nil
  else
    log_summary = parsed_json["log_summary"].to_json
    log_summary = Merge::Accounting::DebugModelLogSummary.from_json(json_object: log_summary)
  end
  new(
    log_id: log_id,
    dashboard_view: dashboard_view,
    log_summary: log_summary,
    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)


73
74
75
76
77
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 73

def self.validate_raw(obj:)
  obj.log_id.is_a?(String) != false || raise("Passed value for field obj.log_id is not the expected type, validation failed.")
  obj.dashboard_view.is_a?(String) != false || raise("Passed value for field obj.dashboard_view is not the expected type, validation failed.")
  Merge::Accounting::DebugModelLogSummary.validate_raw(obj: obj.log_summary)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of DebugModeLog to a JSON object

Returns:

  • (String)


63
64
65
# File 'lib/merge_ruby_client/accounting/types/debug_mode_log.rb', line 63

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