Class: GetMeResponseOperationsItem

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



10239
10240
10241
10242
10243
10244
10245
10246
10247
# File 'lib/schemas.rb', line 10239

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    limit:                                d["limit"],
    get_me_response_operations_item_name: d["name"],
    overage:                              d["overage"],
    usage:                                d["usage"],
  )
end

.from_json!(json) ⇒ Object



10249
10250
10251
# File 'lib/schemas.rb', line 10249

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

Instance Method Details

#to_dynamicObject



10253
10254
10255
10256
10257
10258
10259
10260
# File 'lib/schemas.rb', line 10253

def to_dynamic
  {
    "limit"   => limit,
    "name"    => get_me_response_operations_item_name,
    "overage" => overage,
    "usage"   => usage,
  }
end

#to_json(options = nil) ⇒ Object



10262
10263
10264
# File 'lib/schemas.rb', line 10262

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