Class: Courier::Send::BrandSettingsSocialPresence

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/send/types/brand_settings_social_presence.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(inherit_default: nil, facebook: nil, instagram: nil, linkedin: nil, medium: nil, twitter: nil, additional_properties: nil) ⇒ Send::BrandSettingsSocialPresence

Parameters:



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_propertiesObject (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

#facebookObject (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_defaultObject (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

#instagramObject (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

#linkedinObject (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

#mediumObject (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

#twitterObject (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

Parameters:

  • json_object (JSON)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (JSON)


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