Class: Pinnacle::CompanyDetails
- Inherits:
-
Object
- Object
- Pinnacle::CompanyDetails
- Defined in:
- lib/rcs/types/company_details.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#address ⇒ String
readonly
The address of the company.
-
#brand_color ⇒ String
readonly
The brand color in hex format, must pass a contrast ratio of at least 4.5:1 with white.
-
#description ⇒ String
readonly
A description of the company.
-
#ein ⇒ String
readonly
The EIN (Employer Identification Number) of the company.
-
#hero_url ⇒ String
readonly
URL of the company’s hero image.
-
#logo_url ⇒ String
readonly
URL of the company logo.
-
#name ⇒ String
readonly
The name of the company.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::CompanyDetails
Deserialize a JSON object to an instance of CompanyDetails.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(name:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) ⇒ Pinnacle::CompanyDetails constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CompanyDetails to a JSON object.
Constructor Details
#initialize(name:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) ⇒ Pinnacle::CompanyDetails
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rcs/types/company_details.rb', line 41 def initialize(name:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) @name = name @address = address @ein = ein @description = description @brand_color = brand_color @logo_url = logo_url @hero_url = hero_url @additional_properties = additional_properties @_field_set = { "name": name, "address": address, "ein": ein, "description": description, "brandColor": brand_color, "logoUrl": logo_url, "heroUrl": hero_url } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/rcs/types/company_details.rb', line 24 def additional_properties @additional_properties end |
#address ⇒ String (readonly)
Returns The address of the company.
11 12 13 |
# File 'lib/rcs/types/company_details.rb', line 11 def address @address end |
#brand_color ⇒ String (readonly)
Returns The brand color in hex format, must pass a contrast ratio of at least 4.5:1 with white.
18 19 20 |
# File 'lib/rcs/types/company_details.rb', line 18 def brand_color @brand_color end |
#description ⇒ String (readonly)
Returns A description of the company.
15 16 17 |
# File 'lib/rcs/types/company_details.rb', line 15 def description @description end |
#ein ⇒ String (readonly)
Returns The EIN (Employer Identification Number) of the company.
13 14 15 |
# File 'lib/rcs/types/company_details.rb', line 13 def ein @ein end |
#hero_url ⇒ String (readonly)
Returns URL of the company’s hero image.
22 23 24 |
# File 'lib/rcs/types/company_details.rb', line 22 def hero_url @hero_url end |
#logo_url ⇒ String (readonly)
Returns URL of the company logo.
20 21 22 |
# File 'lib/rcs/types/company_details.rb', line 20 def logo_url @logo_url end |
#name ⇒ String (readonly)
Returns The name of the company.
9 10 11 |
# File 'lib/rcs/types/company_details.rb', line 9 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::CompanyDetails
Deserialize a JSON object to an instance of CompanyDetails
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/rcs/types/company_details.rb', line 65 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] address = parsed_json["address"] ein = parsed_json["ein"] description = parsed_json["description"] brand_color = parsed_json["brandColor"] logo_url = parsed_json["logoUrl"] hero_url = parsed_json["heroUrl"] new( name: name, address: address, ein: ein, description: description, brand_color: brand_color, logo_url: logo_url, hero_url: hero_url, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
100 101 102 103 104 105 106 107 108 |
# File 'lib/rcs/types/company_details.rb', line 100 def self.validate_raw(obj:) obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.address.is_a?(String) != false || raise("Passed value for field obj.address is not the expected type, validation failed.") obj.ein.is_a?(String) != false || raise("Passed value for field obj.ein is not the expected type, validation failed.") obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.brand_color.is_a?(String) != false || raise("Passed value for field obj.brand_color is not the expected type, validation failed.") obj.logo_url.is_a?(String) != false || raise("Passed value for field obj.logo_url is not the expected type, validation failed.") obj.hero_url.is_a?(String) != false || raise("Passed value for field obj.hero_url is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CompanyDetails to a JSON object
90 91 92 |
# File 'lib/rcs/types/company_details.rb', line 90 def to_json(*_args) @_field_set&.to_json end |