Class: Rafflesia::ObjectJsonInspectData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/objects/object_json_inspect_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  content_type: :content_type,
  diagnostics: :diagnostics,
  element_count: :element_count,
  elements: :elements,
  field_count: :field_count,
  fields: :fields,
  is_truncated: :is_truncated,
  json_type: :json_type,
  max_children: :max_children,
  object_id: :object_id,
  sha256: :sha_256,
  size_bytes: :size_bytes
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ObjectJsonInspectData

Returns a new instance of ObjectJsonInspectData.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 37

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @content_type = hash[:content_type]
  @diagnostics = hash[:diagnostics] ? Rafflesia::ObjectReadDiagnostics.new(hash[:diagnostics]) : nil
  @element_count = hash[:element_count]
  @elements = (hash[:elements] || []).map { |item| item ? Rafflesia::ObjectJsonFieldSummary.new(item) : nil }
  @field_count = hash[:field_count]
  @fields = (hash[:fields] || []).map { |item| item ? Rafflesia::ObjectJsonFieldSummary.new(item) : nil }
  @is_truncated = hash[:is_truncated]
  @json_type = hash[:json_type]
  @max_children = hash[:max_children]
  @object_id = hash[:object_id]
  @sha_256 = hash[:sha256]
  @size_bytes = hash[:size_bytes]
end

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def content_type
  @content_type
end

#diagnosticsObject

Returns the value of attribute diagnostics.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def diagnostics
  @diagnostics
end

#element_countObject

Returns the value of attribute element_count.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def element_count
  @element_count
end

#elementsObject

Returns the value of attribute elements.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def elements
  @elements
end

#field_countObject

Returns the value of attribute field_count.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def field_count
  @field_count
end

#fieldsObject

Returns the value of attribute fields.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def fields
  @fields
end

#is_truncatedObject

Returns the value of attribute is_truncated.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def is_truncated
  @is_truncated
end

#json_typeObject

Returns the value of attribute json_type.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def json_type
  @json_type
end

#max_childrenObject

Returns the value of attribute max_children.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def max_children
  @max_children
end

#object_idObject

Returns the value of attribute object_id.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def object_id
  @object_id
end

#sha_256Object

Returns the value of attribute sha_256.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def sha_256
  @sha_256
end

#size_bytesObject

Returns the value of attribute size_bytes.



23
24
25
# File 'lib/rafflesia/objects/object_json_inspect_data.rb', line 23

def size_bytes
  @size_bytes
end