Class: PANElementCreated

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
# File 'lib/schemas.rb', line 17766

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    added_at:                 d["addedAt"],
    added_by:                 d["addedBy"],
    created_at:               d["createdAt"],
    created_by:               d["createdBy"],
    description:              d["description"],
    environments:             d["environments"],
    href:                     d["href"],
    id:                       d["id"],
    pan_element_created_name: d["name"],
    parent_folder_id:         d["parentFolderId"],
    summary:                  d["summary"],
    pan_element_created_type: d["type"],
    updated_at:               d["updatedAt"],
    updated_by:               d["updatedBy"],
  )
end

.from_json!(json) ⇒ Object



17786
17787
17788
# File 'lib/schemas.rb', line 17786

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
# File 'lib/schemas.rb', line 17790

def to_dynamic
  {
    "addedAt"        => added_at,
    "addedBy"        => added_by,
    "createdAt"      => created_at,
    "createdBy"      => created_by,
    "description"    => description,
    "environments"   => environments,
    "href"           => href,
    "id"             => id,
    "name"           => pan_element_created_name,
    "parentFolderId" => parent_folder_id,
    "summary"        => summary,
    "type"           => pan_element_created_type,
    "updatedAt"      => updated_at,
    "updatedBy"      => updated_by,
  }
end

#to_json(options = nil) ⇒ Object



17809
17810
17811
# File 'lib/schemas.rb', line 17809

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end