Class: Identity
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Identity
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 |
# File 'lib/schemas.rb', line 2815 def self.from_dynamic!(d) d = Types::Hash[d] new( address1: d["address1"], address2: d["address2"], address3: d["address3"], city: d["city"], company: d["company"], country: d["country"], email: d["email"], first_name: d["firstName"], last_name: d["lastName"], license_number: d["licenseNumber"], middle_name: d["middleName"], passport_number: d["passportNumber"], phone: d["phone"], postal_code: d["postalCode"], ssn: d["ssn"], state: d["state"], title: d["title"], username: d["username"], ) end |
.from_json!(json) ⇒ Object
2839 2840 2841 |
# File 'lib/schemas.rb', line 2839 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 |
# File 'lib/schemas.rb', line 2843 def to_dynamic { "address1" => address1, "address2" => address2, "address3" => address3, "city" => city, "company" => company, "country" => country, "email" => email, "firstName" => first_name, "lastName" => last_name, "licenseNumber" => license_number, "middleName" => middle_name, "passportNumber" => passport_number, "phone" => phone, "postalCode" => postal_code, "ssn" => ssn, "state" => state, "title" => title, "username" => username, } end |
#to_json(options = nil) ⇒ Object
2866 2867 2868 |
# File 'lib/schemas.rb', line 2866 def to_json( = nil) JSON.generate(to_dynamic, ) end |