Class: EvoleapLicensing::UserIdentity
- Inherits:
-
Object
- Object
- EvoleapLicensing::UserIdentity
- Defined in:
- lib/evoleap_licensing/identity/user_identity.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #add(key, value) ⇒ Object
-
#initialize(data = {}) ⇒ UserIdentity
constructor
A new instance of UserIdentity.
-
#to_api_format ⇒ Object
Flat string-keyed hash matching what the ELM backend (and the C# SDK) expect.
- #to_h ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ UserIdentity
Returns a new instance of UserIdentity.
7 8 9 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 7 def initialize(data = {}) @data = data.transform_keys(&:to_s) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 5 def data @data end |
Class Method Details
.from_hash(hash) ⇒ Object
31 32 33 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 31 def self.from_hash(hash) new(hash) end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 16 def [](key) @data[key.to_s] end |
#add(key, value) ⇒ Object
11 12 13 14 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 11 def add(key, value) @data[key.to_s] = value self end |
#to_api_format ⇒ Object
Flat string-keyed hash matching what the ELM backend (and the C# SDK) expect. user_identity_params on the backend calls symbolize_keys! and slices specific fields — it requires a Hash, not an array of pairs.
23 24 25 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 23 def to_api_format @data.transform_values(&:to_s) end |
#to_h ⇒ Object
27 28 29 |
# File 'lib/evoleap_licensing/identity/user_identity.rb', line 27 def to_h @data.dup end |