Class: Gusto::Admins::Admin
- Inherits:
-
Object
- Object
- Gusto::Admins::Admin
- Defined in:
- lib/fern_gusto/admins/types/admin.rb
Overview
The representation of an admin user in Gusto.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#email ⇒ Object
readonly
user, this will create an admin account for them.
-
#first_name ⇒ String
readonly
The first name of the admin.
-
#last_name ⇒ String
readonly
The last name of the admin.
-
#uuid ⇒ String
readonly
The unique id of the admin.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid:, email: OMIT, first_name: OMIT, last_name: OMIT, additional_properties: nil) ⇒ Gusto::Admins::Admin constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid:, email: OMIT, first_name: OMIT, last_name: OMIT, additional_properties: nil) ⇒ Gusto::Admins::Admin
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 33 def initialize(uuid:, email: OMIT, first_name: OMIT, last_name: OMIT, additional_properties: nil) @uuid = uuid @email = email if email != OMIT @first_name = first_name if first_name != OMIT @last_name = last_name if last_name != OMIT @additional_properties = additional_properties @_field_set = { "uuid": uuid, "email": email, "first_name": first_name, "last_name": last_name }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 19 def additional_properties @additional_properties end |
#email ⇒ Object (readonly)
user, this will create an admin account for them.
13 14 15 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 13 def email @email end |
#first_name ⇒ String (readonly)
Returns The first name of the admin.
15 16 17 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 15 def first_name @first_name end |
#last_name ⇒ String (readonly)
Returns The last name of the admin.
17 18 19 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 17 def last_name @last_name end |
#uuid ⇒ String (readonly)
Returns The unique id of the admin.
10 11 12 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 10 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Admins::Admin
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) uuid = parsed_json["uuid"] email = parsed_json["email"] first_name = parsed_json["first_name"] last_name = parsed_json["last_name"] new( uuid: uuid, email: email, first_name: first_name, last_name: last_name, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 78 79 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 74 def self.validate_raw(obj:) obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.") obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.") obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.") obj.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
65 66 67 |
# File 'lib/fern_gusto/admins/types/admin.rb', line 65 def to_json @_field_set&.to_json end |