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.
-
#category ⇒ Pinnacle::CompanyCategory
readonly
The category of the company.
-
#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:, category:, 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:, category:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) ⇒ Pinnacle::CompanyDetails
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rcs/types/company_details.rb', line 45 def initialize(name:, category:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) @name = name @category = category @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, "category": category, "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.
27 28 29 |
# File 'lib/rcs/types/company_details.rb', line 27 def additional_properties @additional_properties end |
#address ⇒ String (readonly)
Returns The address of the company.
14 15 16 |
# File 'lib/rcs/types/company_details.rb', line 14 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.
21 22 23 |
# File 'lib/rcs/types/company_details.rb', line 21 def brand_color @brand_color end |
#category ⇒ Pinnacle::CompanyCategory (readonly)
Returns The category of the company.
12 13 14 |
# File 'lib/rcs/types/company_details.rb', line 12 def category @category end |
#description ⇒ String (readonly)
Returns A description of the company.
18 19 20 |
# File 'lib/rcs/types/company_details.rb', line 18 def description @description end |
#ein ⇒ String (readonly)
Returns The EIN (Employer Identification Number) of the company.
16 17 18 |
# File 'lib/rcs/types/company_details.rb', line 16 def ein @ein end |
#hero_url ⇒ String (readonly)
Returns URL of the company’s hero image.
25 26 27 |
# File 'lib/rcs/types/company_details.rb', line 25 def hero_url @hero_url end |
#logo_url ⇒ String (readonly)
Returns URL of the company logo.
23 24 25 |
# File 'lib/rcs/types/company_details.rb', line 23 def logo_url @logo_url end |
#name ⇒ String (readonly)
Returns The name of the company.
10 11 12 |
# File 'lib/rcs/types/company_details.rb', line 10 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::CompanyDetails
Deserialize a JSON object to an instance of CompanyDetails
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/rcs/types/company_details.rb', line 72 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] category = parsed_json["category"] 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, category: category, 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.
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rcs/types/company_details.rb', line 109 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.category.is_a?(Pinnacle::CompanyCategory) != false || raise("Passed value for field obj.category 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
99 100 101 |
# File 'lib/rcs/types/company_details.rb', line 99 def to_json(*_args) @_field_set&.to_json end |