Class: UspsApi::SubscriptionsAdjustmentsSubscriptionEvent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::SubscriptionsAdjustmentsSubscriptionEvent
- Defined in:
- lib/usps_api/models/subscriptions_adjustments_subscription_event.rb
Overview
Subscription Event
Instance Attribute Summary collapse
-
#links ⇒ Array[AdjustmentsHypermediaLink]
Hypermedia links to related resources.
-
#payload ⇒ String
Tracking subscription details converted into a JSON formatted string.
-
#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, payload: SKIP) ⇒ SubscriptionsAdjustmentsSubscriptionEvent
constructor
A new instance of SubscriptionsAdjustmentsSubscriptionEvent.
-
#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, payload: SKIP) ⇒ SubscriptionsAdjustmentsSubscriptionEvent
Returns a new instance of SubscriptionsAdjustmentsSubscriptionEvent.
60 61 62 63 64 65 66 67 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 60 def initialize(subscription_id: SKIP, subscription_type: SKIP, timestamp: SKIP, links: SKIP, payload: SKIP) @subscription_id = subscription_id unless subscription_id == SKIP @subscription_type = subscription_type unless subscription_type == SKIP @timestamp = unless == SKIP @links = links unless links == SKIP @payload = payload unless payload == SKIP end |
Instance Attribute Details
#links ⇒ Array[AdjustmentsHypermediaLink]
Hypermedia links to related resources.
27 28 29 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 27 def links @links end |
#payload ⇒ String
Tracking subscription details converted into a JSON formatted string.
31 32 33 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 31 def payload @payload end |
#subscription_id ⇒ String
Unique identifier created for this Subscription
15 16 17 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.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_adjustments_subscription_event.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_adjustments_subscription_event.rb', line 23 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 70 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') payload = hash.key?('payload') ? hash['payload'] : SKIP # Create object from extracted values. SubscriptionsAdjustmentsSubscriptionEvent.new(subscription_id: subscription_id, subscription_type: subscription_type, timestamp: , links: links, payload: payload) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['subscription_id'] = 'subscriptionId' @_hash['subscription_type'] = 'subscriptionType' @_hash['timestamp'] = 'timestamp' @_hash['links'] = 'links' @_hash['payload'] = 'payload' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 45 def self.optionals %w[ subscription_id subscription_type timestamp links payload ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
115 116 117 118 119 120 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 115 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},"\ " payload: #{@payload.inspect}>" end |
#to_custom_timestamp ⇒ Object
103 104 105 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 103 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 |
# File 'lib/usps_api/models/subscriptions_adjustments_subscription_event.rb', line 108 def to_s class_name = self.class.name.split('::').last "<#{class_name} subscription_id: #{@subscription_id}, subscription_type:"\ " #{@subscription_type}, timestamp: #{@timestamp}, links: #{@links}, payload: #{@payload}>" end |