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:, address:, ein:, description:, brand_color:, logo_url:, hero_url:, additional_properties: nil) ⇒ Pinnacle::CompanyDetails

Parameters:

  • name (String)

    The name 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



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

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#addressString (readonly)

Returns The address of the company.

Returns:

  • (String)

    The address of the company.



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

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.



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

def brand_color
  @brand_color
end

#descriptionString (readonly)

Returns A description of the company.

Returns:

  • (String)

    A description of the company.



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

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.



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

def ein
  @ein
end

#hero_urlString (readonly)

Returns URL of the company’s hero image.

Returns:

  • (String)

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

Returns URL of the company logo.

Returns:

  • (String)

    URL of the company logo.



20
21
22
# File 'lib/rcs/types/company_details.rb', line 20

def logo_url
  @logo_url
end

#nameString (readonly)

Returns The name of the company.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


90
91
92
# File 'lib/rcs/types/company_details.rb', line 90

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