Class: UspsApi::SubscriptionsDisputesSubscriptionEvent1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::SubscriptionsDisputesSubscriptionEvent1
- Defined in:
- lib/usps_api/models/subscriptions_disputes_subscription_event1.rb
Overview
Subscription Event
Instance Attribute Summary collapse
-
#links ⇒ Array[AdjustmentsHypermediaLink]
Hypermedia links to related resources.
-
#subscription_id ⇒ String
Unique identifier created for this Subscription.
-
#subscription_type ⇒ String
The name of the topic related to this event.
-
#timestamp ⇒ DateTime
Timestamp message was generated, in ISO-8601 format.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(subscription_id: SKIP, subscription_type: SKIP, timestamp: SKIP, links: SKIP, additional_properties: nil) ⇒ SubscriptionsDisputesSubscriptionEvent1
constructor
A new instance of SubscriptionsDisputesSubscriptionEvent1.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timestamp ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(subscription_id: SKIP, subscription_type: SKIP, timestamp: SKIP, links: SKIP, additional_properties: nil) ⇒ SubscriptionsDisputesSubscriptionEvent1
Returns a new instance of SubscriptionsDisputesSubscriptionEvent1.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 54 def initialize(subscription_id: SKIP, subscription_type: SKIP, timestamp: SKIP, links: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @subscription_id = subscription_id unless subscription_id == SKIP @subscription_type = subscription_type unless subscription_type == SKIP @timestamp = unless == SKIP @links = links unless links == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#links ⇒ Array[AdjustmentsHypermediaLink]
Hypermedia links to related resources.
27 28 29 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 27 def links @links end |
#subscription_id ⇒ String
Unique identifier created for this Subscription
15 16 17 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 15 def subscription_id @subscription_id end |
#subscription_type ⇒ String
The name of the topic related to this event.
19 20 21 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 19 def subscription_type @subscription_type end |
#timestamp ⇒ DateTime
Timestamp message was generated, in ISO-8601 format.
23 24 25 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 23 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 67 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. subscription_id = hash.key?('subscriptionId') ? hash['subscriptionId'] : SKIP subscription_type = hash.key?('subscriptionType') ? hash['subscriptionType'] : SKIP = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) else SKIP end # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (AdjustmentsHypermediaLink.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. SubscriptionsDisputesSubscriptionEvent1.new(subscription_id: subscription_id, subscription_type: subscription_type, timestamp: , links: links, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['subscription_id'] = 'subscriptionId' @_hash['subscription_type'] = 'subscriptionType' @_hash['timestamp'] = 'timestamp' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 40 def self.optionals %w[ subscription_id subscription_type timestamp links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} subscription_id: #{@subscription_id.inspect}, subscription_type:"\ " #{@subscription_type.inspect}, timestamp: #{@timestamp.inspect}, links: #{@links.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_timestamp ⇒ Object
106 107 108 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 106 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 116 |
# File 'lib/usps_api/models/subscriptions_disputes_subscription_event1.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} subscription_id: #{@subscription_id}, subscription_type:"\ " #{@subscription_type}, timestamp: #{@timestamp}, links: #{@links}, additional_properties:"\ " #{@additional_properties}>" end |