Class: Representation
Direct Known Subclasses
KeycloakAdmin::AttackDetectionRepresentation, KeycloakAdmin::ClientAuthzPermissionRepresentation, KeycloakAdmin::ClientAuthzPolicyConfigRepresentation, KeycloakAdmin::ClientAuthzPolicyRepresentation, KeycloakAdmin::ClientAuthzResourceRepresentation, KeycloakAdmin::ClientAuthzScopeRepresentation, KeycloakAdmin::ClientRepresentation, KeycloakAdmin::CredentialRepresentation, KeycloakAdmin::FederatedIdentityRepresentation, KeycloakAdmin::GroupRepresentation, KeycloakAdmin::IdentityProviderMapperRepresentation, KeycloakAdmin::IdentityProviderRepresentation, KeycloakAdmin::ImpersonationRedirectionRepresentation, KeycloakAdmin::ImpersonationRepresentation, KeycloakAdmin::ProtocolMapperRepresentation, KeycloakAdmin::RealmRepresentation, KeycloakAdmin::RoleRepresentation, KeycloakAdmin::SessionRepresentation, KeycloakAdmin::TokenRepresentation, KeycloakAdmin::UserRepresentation
Class Method Summary
collapse
Instance Method Summary
collapse
#camelize
Class Method Details
.from_json(json) ⇒ Object
19
20
21
22
|
# File 'lib/keycloak-admin/representation/representation.rb', line 19
def self.from_json(json)
hash = JSON.parse(json)
from_hash(hash)
end
|
Instance Method Details
#as_json(options = nil) ⇒ Object
7
8
9
|
# File 'lib/keycloak-admin/representation/representation.rb', line 7
def as_json(options=nil)
Hash[instance_variables.map { |ivar| [ivar.to_s[1..-1], instance_variable_get(ivar)] }]
end
|
#to_json(options = nil) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/keycloak-admin/representation/representation.rb', line 11
def to_json(options=nil)
snaked_hash = as_json(options)
snaked_hash.keys.reduce({}) do |camelized_hash, key|
camelized_hash[camelize(key, false)] = snaked_hash[key]
camelized_hash
end.to_json(options)
end
|