Class: GetScimV2GroupsResponse

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



14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
# File 'lib/schemas.rb', line 14592

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    items_per_page: d["itemsPerPage"],
    resources:      d["Resources"]&.map { |x| ScimGroupResource.from_dynamic!(x) },
    schemas:        d["schemas"],
    start_index:    d["startIndex"],
    total_results:  d["totalResults"],
  )
end

.from_json!(json) ⇒ Object



14603
14604
14605
# File 'lib/schemas.rb', line 14603

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

Instance Method Details

#to_dynamicObject



14607
14608
14609
14610
14611
14612
14613
14614
14615
# File 'lib/schemas.rb', line 14607

def to_dynamic
  {
    "itemsPerPage" => items_per_page,
    "Resources"    => resources&.map { |x| x.to_dynamic },
    "schemas"      => schemas,
    "startIndex"   => start_index,
    "totalResults" => total_results,
  }
end

#to_json(options = nil) ⇒ Object



14617
14618
14619
# File 'lib/schemas.rb', line 14617

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