Class: GetScimV2UsersResponse

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



15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
# File 'lib/schemas.rb', line 15493

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

.from_json!(json) ⇒ Object



15504
15505
15506
# File 'lib/schemas.rb', line 15504

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

Instance Method Details

#to_dynamicObject



15508
15509
15510
15511
15512
15513
15514
15515
15516
# File 'lib/schemas.rb', line 15508

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



15518
15519
15520
# File 'lib/schemas.rb', line 15518

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