Class: Courier::Audiences::AudienceMember
- Inherits:
-
Object
- Object
- Courier::Audiences::AudienceMember
- Defined in:
- lib/trycourier/audiences/types/audience_member.rb
Instance Attribute Summary collapse
-
#added_at ⇒ Object
readonly
Returns the value of attribute added_at.
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#audience_id ⇒ Object
readonly
Returns the value of attribute audience_id.
-
#audience_version ⇒ Object
readonly
Returns the value of attribute audience_version.
-
#member_id ⇒ Object
readonly
Returns the value of attribute member_id.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Audiences::AudienceMember
Deserialize a JSON object to an instance of AudienceMember.
-
.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(added_at:, audience_id:, audience_version:, member_id:, reason:, additional_properties: nil) ⇒ Audiences::AudienceMember constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of AudienceMember to a JSON object.
Constructor Details
#initialize(added_at:, audience_id:, audience_version:, member_id:, reason:, additional_properties: nil) ⇒ Audiences::AudienceMember
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 17 def initialize(added_at:, audience_id:, audience_version:, member_id:, reason:, additional_properties: nil) # @type [String] @added_at = added_at # @type [String] @audience_id = audience_id # @type [Integer] @audience_version = audience_version # @type [String] @member_id = member_id # @type [String] @reason = reason # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#added_at ⇒ Object (readonly)
Returns the value of attribute added_at.
8 9 10 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 8 def added_at @added_at end |
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
8 9 10 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 8 def additional_properties @additional_properties end |
#audience_id ⇒ Object (readonly)
Returns the value of attribute audience_id.
8 9 10 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 8 def audience_id @audience_id end |
#audience_version ⇒ Object (readonly)
Returns the value of attribute audience_version.
8 9 10 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 8 def audience_version @audience_version end |
#member_id ⇒ Object (readonly)
Returns the value of attribute member_id.
8 9 10 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 8 def member_id @member_id end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
8 9 10 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 8 def reason @reason end |
Class Method Details
.from_json(json_object:) ⇒ Audiences::AudienceMember
Deserialize a JSON object to an instance of AudienceMember
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) added_at = struct.added_at audience_id = struct.audience_id audience_version = struct.audience_version member_id = struct.member_id reason = struct.reason new(added_at: added_at, audience_id: audience_id, audience_version: audience_version, member_id: member_id, reason: reason, 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.
65 66 67 68 69 70 71 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 65 def self.validate_raw(obj:) obj.added_at.is_a?(String) != false || raise("Passed value for field obj.added_at is not the expected type, validation failed.") obj.audience_id.is_a?(String) != false || raise("Passed value for field obj.audience_id is not the expected type, validation failed.") obj.audience_version.is_a?(Integer) != false || raise("Passed value for field obj.audience_version is not the expected type, validation failed.") obj.member_id.is_a?(String) != false || raise("Passed value for field obj.member_id is not the expected type, validation failed.") obj.reason.is_a?(String) != false || raise("Passed value for field obj.reason is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of AudienceMember to a JSON object
51 52 53 54 55 56 57 58 59 |
# File 'lib/trycourier/audiences/types/audience_member.rb', line 51 def to_json(*_args) { "added_at": @added_at, "audience_id": @audience_id, "audience_version": @audience_version, "member_id": @member_id, "reason": @reason }.to_json end |