Class: Meta

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



36533
36534
36535
36536
36537
36538
36539
36540
# File 'lib/schemas.rb', line 36533

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    limit:       d["limit"],
    next_cursor: d["nextCursor"],
    total:       d["total"],
  )
end

.from_json!(json) ⇒ Object



36542
36543
36544
# File 'lib/schemas.rb', line 36542

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

Instance Method Details

#to_dynamicObject



36546
36547
36548
36549
36550
36551
36552
# File 'lib/schemas.rb', line 36546

def to_dynamic
  {
    "limit"      => limit,
    "nextCursor" => next_cursor,
    "total"      => total,
  }
end

#to_json(options = nil) ⇒ Object



36554
36555
36556
# File 'lib/schemas.rb', line 36554

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