Class: Courier::Send::BrandSettingsSocialPresence
- Inherits:
-
Object
- Object
- Courier::Send::BrandSettingsSocialPresence
- Defined in:
- lib/trycourier/send/types/brand_settings_social_presence.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#facebook ⇒ Object
readonly
Returns the value of attribute facebook.
-
#inherit_default ⇒ Object
readonly
Returns the value of attribute inherit_default.
-
#instagram ⇒ Object
readonly
Returns the value of attribute instagram.
-
#linkedin ⇒ Object
readonly
Returns the value of attribute linkedin.
-
#medium ⇒ Object
readonly
Returns the value of attribute medium.
-
#twitter ⇒ Object
readonly
Returns the value of attribute twitter.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::BrandSettingsSocialPresence
Deserialize a JSON object to an instance of BrandSettingsSocialPresence.
-
.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(inherit_default: nil, facebook: nil, instagram: nil, linkedin: nil, medium: nil, twitter: nil, additional_properties: nil) ⇒ Send::BrandSettingsSocialPresence constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandSettingsSocialPresence to a JSON object.
Constructor Details
#initialize(inherit_default: nil, facebook: nil, instagram: nil, linkedin: nil, medium: nil, twitter: nil, additional_properties: nil) ⇒ Send::BrandSettingsSocialPresence
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 19 def initialize(inherit_default: nil, facebook: nil, instagram: nil, linkedin: nil, medium: nil, twitter: nil, additional_properties: nil) # @type [Boolean] @inherit_default = inherit_default # @type [Send::BaseSocialPresence] @facebook = facebook # @type [Send::BaseSocialPresence] @instagram = instagram # @type [Send::BaseSocialPresence] @linkedin = linkedin # @type [Send::BaseSocialPresence] @medium = medium # @type [Send::BaseSocialPresence] @twitter = twitter # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def additional_properties @additional_properties end |
#facebook ⇒ Object (readonly)
Returns the value of attribute facebook.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def facebook @facebook end |
#inherit_default ⇒ Object (readonly)
Returns the value of attribute inherit_default.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def inherit_default @inherit_default end |
#instagram ⇒ Object (readonly)
Returns the value of attribute instagram.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def instagram @instagram end |
#linkedin ⇒ Object (readonly)
Returns the value of attribute linkedin.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def linkedin @linkedin end |
#medium ⇒ Object (readonly)
Returns the value of attribute medium.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def medium @medium end |
#twitter ⇒ Object (readonly)
Returns the value of attribute twitter.
9 10 11 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 9 def twitter @twitter end |
Class Method Details
.from_json(json_object:) ⇒ Send::BrandSettingsSocialPresence
Deserialize a JSON object to an instance of BrandSettingsSocialPresence
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) inherit_default = struct.inheritDefault if parsed_json["facebook"].nil? facebook = nil else facebook = parsed_json["facebook"].to_json facebook = Send::BaseSocialPresence.from_json(json_object: facebook) end if parsed_json["instagram"].nil? instagram = nil else instagram = parsed_json["instagram"].to_json instagram = Send::BaseSocialPresence.from_json(json_object: instagram) end if parsed_json["linkedin"].nil? linkedin = nil else linkedin = parsed_json["linkedin"].to_json linkedin = Send::BaseSocialPresence.from_json(json_object: linkedin) end if parsed_json["medium"].nil? medium = nil else medium = parsed_json["medium"].to_json medium = Send::BaseSocialPresence.from_json(json_object: medium) end if parsed_json["twitter"].nil? twitter = nil else twitter = parsed_json["twitter"].to_json twitter = Send::BaseSocialPresence.from_json(json_object: twitter) end new(inherit_default: inherit_default, facebook: facebook, instagram: instagram, linkedin: linkedin, medium: medium, twitter: twitter, 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.
97 98 99 100 101 102 103 104 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 97 def self.validate_raw(obj:) obj.inherit_default&.is_a?(Boolean) != false || raise("Passed value for field obj.inherit_default is not the expected type, validation failed.") obj.facebook.nil? || Send::BaseSocialPresence.validate_raw(obj: obj.facebook) obj.instagram.nil? || Send::BaseSocialPresence.validate_raw(obj: obj.instagram) obj.linkedin.nil? || Send::BaseSocialPresence.validate_raw(obj: obj.linkedin) obj.medium.nil? || Send::BaseSocialPresence.validate_raw(obj: obj.medium) obj.twitter.nil? || Send::BaseSocialPresence.validate_raw(obj: obj.twitter) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandSettingsSocialPresence to a JSON object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/trycourier/send/types/brand_settings_social_presence.rb', line 82 def to_json(*_args) { "inheritDefault": @inherit_default, "facebook": @facebook, "instagram": @instagram, "linkedin": @linkedin, "medium": @medium, "twitter": @twitter }.to_json end |