Class: Pinnacle::CompanyContact
- Inherits:
-
Object
- Object
- Pinnacle::CompanyContact
- Defined in:
- lib/rcs/types/company_contact.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#primary_email ⇒ String
readonly
Primary email address.
-
#primary_email_label ⇒ String
readonly
Label for the primary email address.
-
#primary_phone ⇒ String
readonly
Primary phone number in international format.
-
#primary_phone_label ⇒ String
readonly
Label for the primary phone number.
-
#primary_website_label ⇒ String
readonly
Label for the primary website.
-
#primary_website_url ⇒ String
readonly
Primary website URL.
-
#privacy_policy_url ⇒ String
readonly
URL of the privacy policy.
-
#tos_url ⇒ String
readonly
URL of the terms of service.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::CompanyContact
Deserialize a JSON object to an instance of CompanyContact.
-
.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(primary_website_url:, primary_website_label:, primary_phone:, primary_phone_label:, primary_email:, primary_email_label:, privacy_policy_url:, tos_url:, additional_properties: nil) ⇒ Pinnacle::CompanyContact constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CompanyContact to a JSON object.
Constructor Details
#initialize(primary_website_url:, primary_website_label:, primary_phone:, primary_phone_label:, primary_email:, primary_email_label:, privacy_policy_url:, tos_url:, additional_properties: nil) ⇒ Pinnacle::CompanyContact
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rcs/types/company_contact.rb', line 42 def initialize(primary_website_url:, primary_website_label:, primary_phone:, primary_phone_label:, primary_email:, primary_email_label:, privacy_policy_url:, tos_url:, additional_properties: nil) @primary_website_url = primary_website_url @primary_website_label = primary_website_label @primary_phone = primary_phone @primary_phone_label = primary_phone_label @primary_email = primary_email @primary_email_label = primary_email_label @privacy_policy_url = privacy_policy_url @tos_url = tos_url @additional_properties = additional_properties @_field_set = { "primaryWebsiteUrl": primary_website_url, "primaryWebsiteLabel": primary_website_label, "primaryPhone": primary_phone, "primaryPhoneLabel": primary_phone_label, "primaryEmail": primary_email, "primaryEmailLabel": primary_email_label, "privacyPolicyUrl": privacy_policy_url, "tosUrl": tos_url } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/rcs/types/company_contact.rb', line 25 def additional_properties @additional_properties end |
#primary_email ⇒ String (readonly)
Returns Primary email address.
17 18 19 |
# File 'lib/rcs/types/company_contact.rb', line 17 def primary_email @primary_email end |
#primary_email_label ⇒ String (readonly)
Returns Label for the primary email address.
19 20 21 |
# File 'lib/rcs/types/company_contact.rb', line 19 def primary_email_label @primary_email_label end |
#primary_phone ⇒ String (readonly)
Returns Primary phone number in international format.
13 14 15 |
# File 'lib/rcs/types/company_contact.rb', line 13 def primary_phone @primary_phone end |
#primary_phone_label ⇒ String (readonly)
Returns Label for the primary phone number.
15 16 17 |
# File 'lib/rcs/types/company_contact.rb', line 15 def primary_phone_label @primary_phone_label end |
#primary_website_label ⇒ String (readonly)
Returns Label for the primary website.
11 12 13 |
# File 'lib/rcs/types/company_contact.rb', line 11 def primary_website_label @primary_website_label end |
#primary_website_url ⇒ String (readonly)
Returns Primary website URL.
9 10 11 |
# File 'lib/rcs/types/company_contact.rb', line 9 def primary_website_url @primary_website_url end |
#privacy_policy_url ⇒ String (readonly)
Returns URL of the privacy policy.
21 22 23 |
# File 'lib/rcs/types/company_contact.rb', line 21 def privacy_policy_url @privacy_policy_url end |
#tos_url ⇒ String (readonly)
Returns URL of the terms of service.
23 24 25 |
# File 'lib/rcs/types/company_contact.rb', line 23 def tos_url @tos_url end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::CompanyContact
Deserialize a JSON object to an instance of CompanyContact
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/rcs/types/company_contact.rb', line 69 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) primary_website_url = parsed_json["primaryWebsiteUrl"] primary_website_label = parsed_json["primaryWebsiteLabel"] primary_phone = parsed_json["primaryPhone"] primary_phone_label = parsed_json["primaryPhoneLabel"] primary_email = parsed_json["primaryEmail"] primary_email_label = parsed_json["primaryEmailLabel"] privacy_policy_url = parsed_json["privacyPolicyUrl"] tos_url = parsed_json["tosUrl"] new( primary_website_url: primary_website_url, primary_website_label: primary_website_label, primary_phone: primary_phone, primary_phone_label: primary_phone_label, primary_email: primary_email, primary_email_label: primary_email_label, privacy_policy_url: privacy_policy_url, tos_url: tos_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.
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rcs/types/company_contact.rb', line 106 def self.validate_raw(obj:) obj.primary_website_url.is_a?(String) != false || raise("Passed value for field obj.primary_website_url is not the expected type, validation failed.") obj.primary_website_label.is_a?(String) != false || raise("Passed value for field obj.primary_website_label is not the expected type, validation failed.") obj.primary_phone.is_a?(String) != false || raise("Passed value for field obj.primary_phone is not the expected type, validation failed.") obj.primary_phone_label.is_a?(String) != false || raise("Passed value for field obj.primary_phone_label is not the expected type, validation failed.") obj.primary_email.is_a?(String) != false || raise("Passed value for field obj.primary_email is not the expected type, validation failed.") obj.primary_email_label.is_a?(String) != false || raise("Passed value for field obj.primary_email_label is not the expected type, validation failed.") obj.privacy_policy_url.is_a?(String) != false || raise("Passed value for field obj.privacy_policy_url is not the expected type, validation failed.") obj.tos_url.is_a?(String) != false || raise("Passed value for field obj.tos_url is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CompanyContact to a JSON object
96 97 98 |
# File 'lib/rcs/types/company_contact.rb', line 96 def to_json(*_args) @_field_set&.to_json end |