Class: Pinnacle::CompanyDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/rcs/types/company_details.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, category:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) ⇒ Pinnacle::CompanyDetails

Parameters:

  • name (String)

    The name of the company.

  • category (Pinnacle::CompanyCategory)

    The category of the company.

  • address (String)

    The address of the company.

  • ein (String)

    The EIN (Employer Identification Number) of the company.

  • description (String)

    A description of the company.

  • brand_color (String)

    The brand color in hex format, must pass a contrast ratio of at least 4.5:1 with white.

  • logo_url (String)

    URL of the company logo.

  • hero_url (String)

    URL of the company’s hero image.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#addressString (readonly)

Returns The address of the company.

Returns:

  • (String)

    The address of the company.



14
15
16
# File 'lib/rcs/types/company_details.rb', line 14

def address
  @address
end

#brand_colorString (readonly)

Returns The brand color in hex format, must pass a contrast ratio of at least 4.5:1 with white.

Returns:

  • (String)

    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

#categoryPinnacle::CompanyCategory (readonly)

Returns The category of the company.

Returns:



12
13
14
# File 'lib/rcs/types/company_details.rb', line 12

def category
  @category
end

#descriptionString (readonly)

Returns A description of the company.

Returns:

  • (String)

    A description of the company.



18
19
20
# File 'lib/rcs/types/company_details.rb', line 18

def description
  @description
end

#einString (readonly)

Returns The EIN (Employer Identification Number) of the company.

Returns:

  • (String)

    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_urlString (readonly)

Returns URL of the company’s hero image.

Returns:

  • (String)

    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_urlString (readonly)

Returns URL of the company logo.

Returns:

  • (String)

    URL of the company logo.



23
24
25
# File 'lib/rcs/types/company_details.rb', line 23

def logo_url
  @logo_url
end

#nameString (readonly)

Returns The name of the company.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


99
100
101
# File 'lib/rcs/types/company_details.rb', line 99

def to_json(*_args)
  @_field_set&.to_json
end