aftership-tracking-sdk 7.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.md +68 -83
  4. data/lib/aftership-tracking-sdk/api/courier.rb +8 -8
  5. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +4 -4
  6. data/lib/aftership-tracking-sdk/api/tracking.rb +50 -416
  7. data/lib/aftership-tracking-sdk/api_client.rb +2 -2
  8. data/lib/aftership-tracking-sdk/configuration.rb +108 -108
  9. data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +1 -1
  10. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_create_tracking_response.rb +183 -0
  11. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
  12. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
  13. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
  14. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
  15. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +2 -0
  16. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
  17. data/lib/aftership-tracking-sdk/models/carbon_emissions_create_tracking_response.rb +163 -0
  18. data/lib/aftership-tracking-sdk/models/carbon_emissions_delete_tracking_by_id_response.rb +163 -0
  19. data/lib/aftership-tracking-sdk/models/carbon_emissions_get_tracking_by_id_response.rb +163 -0
  20. data/lib/aftership-tracking-sdk/models/carbon_emissions_mark_tracking_completed_by_id_response.rb +163 -0
  21. data/lib/aftership-tracking-sdk/models/carbon_emissions_retrack_tracking_by_id_response.rb +163 -0
  22. data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +2 -0
  23. data/lib/aftership-tracking-sdk/models/carbon_emissions_update_tracking_by_id_response.rb +163 -0
  24. data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -0
  25. data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +2 -0
  26. data/lib/aftership-tracking-sdk/models/courier.rb +2 -0
  27. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_create_tracking_response.rb +173 -0
  28. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_delete_tracking_by_id_response.rb +173 -0
  29. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_get_tracking_by_id_response.rb +173 -0
  30. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +173 -0
  31. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_retrack_tracking_by_id_response.rb +173 -0
  32. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_tracking.rb +173 -0
  33. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_update_tracking_by_id_response.rb +173 -0
  34. data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +2 -0
  35. data/lib/aftership-tracking-sdk/models/{tracking_create_tracking_request.rb → create_tracking_request.rb} +9 -7
  36. data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +953 -0
  37. data/lib/aftership-tracking-sdk/models/{mark_tracking_completed_by_slug_tracking_number_request.rb → custom_estimated_delivery_date_create_tracking_response.rb} +41 -9
  38. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
  39. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
  40. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
  41. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
  42. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +2 -0
  43. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
  44. data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +2 -0
  45. data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +8 -126
  46. data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +953 -0
  47. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +2 -0
  48. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +2 -0
  49. data/lib/aftership-tracking-sdk/models/{tracking_detect_courier_request.rb → detect_courier_request.rb} +5 -3
  50. data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +2 -0
  51. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +2 -0
  52. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +12 -0
  53. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +2 -0
  54. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +2 -0
  55. data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +2 -0
  56. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_create_tracking_response.rb +193 -0
  57. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
  58. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_get_tracking_by_id_response.rb +193 -0
  59. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
  60. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
  61. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +2 -0
  62. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_update_tracking_by_id_response.rb +193 -0
  63. data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +2 -0
  64. data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +953 -0
  65. data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +5 -3
  66. data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +2 -0
  67. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +193 -0
  68. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
  69. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +193 -0
  70. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
  71. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
  72. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +2 -0
  73. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +193 -0
  74. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +2 -0
  75. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +953 -0
  76. data/lib/aftership-tracking-sdk/models/meta_v1.rb +2 -0
  77. data/lib/aftership-tracking-sdk/models/{next_couriers_tracking_create_tracking_request.rb → next_couriers_create_tracking_request.rb} +4 -2
  78. data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_tracking_id_response.rb → next_couriers_create_tracking_response.rb} +33 -51
  79. data/lib/aftership-tracking-sdk/models/next_couriers_delete_tracking_by_id_response.rb +193 -0
  80. data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_slug_tracking_number_response.rb → next_couriers_get_tracking_by_id_response.rb} +33 -51
  81. data/lib/aftership-tracking-sdk/models/next_couriers_mark_tracking_completed_by_id_response.rb +193 -0
  82. data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +193 -0
  83. data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +22 -0
  84. data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +193 -0
  85. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +2 -0
  86. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +2 -0
  87. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +2 -0
  88. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +2 -0
  89. data/lib/aftership-tracking-sdk/models/pagination.rb +14 -6
  90. data/lib/aftership-tracking-sdk/models/pagination_data_tracking_response_get_multiple_v1.rb +173 -0
  91. data/lib/aftership-tracking-sdk/models/{notification_request_v1.rb → pagination_get_trackings_response.rb} +28 -16
  92. data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +2 -0
  93. data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +2 -0
  94. data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +2 -0
  95. data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +953 -0
  96. data/lib/aftership-tracking-sdk/models/{tracking_delete_response_v1.rb → shipment_weight_create_tracking_response.rb} +18 -16
  97. data/lib/aftership-tracking-sdk/models/{data_notification_response_v1.rb → shipment_weight_delete_tracking_by_id_response.rb} +21 -9
  98. data/lib/aftership-tracking-sdk/models/{notification.rb → shipment_weight_get_tracking_by_id_response.rb} +18 -16
  99. data/lib/aftership-tracking-sdk/models/shipment_weight_mark_tracking_completed_by_id_response.rb +163 -0
  100. data/lib/aftership-tracking-sdk/models/shipment_weight_retrack_tracking_by_id_response.rb +163 -0
  101. data/lib/aftership-tracking-sdk/models/{notification_response_v1.rb → shipment_weight_tracking.rb} +18 -16
  102. data/lib/aftership-tracking-sdk/models/shipment_weight_update_tracking_by_id_response.rb +163 -0
  103. data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +1 -1
  104. data/lib/aftership-tracking-sdk/models/tag_v1.rb +1 -1
  105. data/lib/aftership-tracking-sdk/models/tracking.rb +56 -24
  106. data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +2 -0
  107. data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +5 -3
  108. data/lib/aftership-tracking-sdk/models/{tracking_update_tracking_by_id_request.rb → update_tracking_by_id_request.rb} +5 -3
  109. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +953 -0
  110. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +2 -0
  111. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +2 -0
  112. data/lib/aftership-tracking-sdk/version.rb +1 -1
  113. metadata +64 -22
  114. data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +0 -143
  115. data/lib/aftership-tracking-sdk/api/notification.rb +0 -403
  116. data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +0 -139
  117. data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +0 -151
  118. data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +0 -151
  119. data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +0 -241
  120. data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +0 -251
  121. data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +0 -391
@@ -1,48 +1,49 @@
1
1
  # This code was auto generated by AfterShip SDK Generator.
2
2
  # Do not edit the class manually.
3
3
  module AftershipAPI::Model
4
- class TrackingDeleteResponseV1
5
- # Meta data
6
- # meta: MetaV1;
7
- attr_accessor :meta
4
+ class ShipmentWeightCreateTrackingResponse
8
5
 
9
- #
10
- # data: DataTrackingDeleteResponseV1;
11
- attr_accessor :data
6
+ # The unit in which the value field is expressed.
7
+ # unit?: String;
8
+ attr_accessor :unit
9
+
10
+ # The total amount of shipment weight.
11
+ # value?: Float;
12
+ attr_accessor :value
12
13
 
13
14
  # Initializes the object
14
15
  # @param [Hash] attributes Model attributes in the form of hash
15
16
  def initialize(attributes = {})
16
17
  if (!attributes.is_a?(Hash))
17
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::TrackingDeleteResponseV1` initialize method"
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::ShipmentWeightCreateTrackingResponse` initialize method"
18
19
  end
19
20
 
20
21
  attributes = attributes.each_with_object({}) { |(k, v), h|
21
22
  h[k.to_sym] = v
22
23
  }
23
24
 
24
- if attributes.key?(:'meta')
25
- self.meta = attributes[:'meta']
25
+ if attributes.key?(:'unit')
26
+ self.unit = attributes[:'unit']
26
27
  end
27
28
 
28
- if attributes.key?(:'data')
29
- self.data = attributes[:'data']
29
+ if attributes.key?(:'value')
30
+ self.value = attributes[:'value']
30
31
  end
31
32
  end
32
33
 
33
34
  # Attribute type mapping.
34
35
  def self.openapi_types
35
36
  {
36
- :'meta' => :'MetaV1',
37
- :'data' => :'DataTrackingDeleteResponseV1',
37
+ :'unit' => :'String',
38
+ :'value' => :'Float',
38
39
  }
39
40
  end
40
41
 
41
42
  # Attribute mapping from ruby-style variable name to JSON key.
42
43
  def self.attribute_map
43
44
  {
44
- :'meta' => :'meta',
45
- :'data' => :'data',
45
+ :'unit' => :'unit',
46
+ :'value' => :'value',
46
47
  }
47
48
  end
48
49
 
@@ -159,3 +160,4 @@ module AftershipAPI::Model
159
160
  end
160
161
  end
161
162
  end
163
+
@@ -1,38 +1,49 @@
1
1
  # This code was auto generated by AfterShip SDK Generator.
2
2
  # Do not edit the class manually.
3
3
  module AftershipAPI::Model
4
- class DataNotificationResponseV1
5
- # Object describes the notification information.
6
- # notification?: Notification;
7
- attr_accessor :notification
4
+ class ShipmentWeightDeleteTrackingByIdResponse
5
+
6
+ # The unit in which the value field is expressed.
7
+ # unit?: String;
8
+ attr_accessor :unit
9
+
10
+ # The total amount of shipment weight.
11
+ # value?: Float;
12
+ attr_accessor :value
8
13
 
9
14
  # Initializes the object
10
15
  # @param [Hash] attributes Model attributes in the form of hash
11
16
  def initialize(attributes = {})
12
17
  if (!attributes.is_a?(Hash))
13
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataNotificationResponseV1` initialize method"
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::ShipmentWeightDeleteTrackingByIdResponse` initialize method"
14
19
  end
15
20
 
16
21
  attributes = attributes.each_with_object({}) { |(k, v), h|
17
22
  h[k.to_sym] = v
18
23
  }
19
24
 
20
- if attributes.key?(:'notification')
21
- self.notification = attributes[:'notification']
25
+ if attributes.key?(:'unit')
26
+ self.unit = attributes[:'unit']
27
+ end
28
+
29
+ if attributes.key?(:'value')
30
+ self.value = attributes[:'value']
22
31
  end
23
32
  end
24
33
 
25
34
  # Attribute type mapping.
26
35
  def self.openapi_types
27
36
  {
28
- :'notification' => :'Notification',
37
+ :'unit' => :'String',
38
+ :'value' => :'Float',
29
39
  }
30
40
  end
31
41
 
32
42
  # Attribute mapping from ruby-style variable name to JSON key.
33
43
  def self.attribute_map
34
44
  {
35
- :'notification' => :'notification',
45
+ :'unit' => :'unit',
46
+ :'value' => :'value',
36
47
  }
37
48
  end
38
49
 
@@ -149,3 +160,4 @@ module AftershipAPI::Model
149
160
  end
150
161
  end
151
162
  end
163
+
@@ -1,48 +1,49 @@
1
1
  # This code was auto generated by AfterShip SDK Generator.
2
2
  # Do not edit the class manually.
3
3
  module AftershipAPI::Model
4
- class Notification
5
- # Email address(es) to receive email notifications.
6
- # emails?: String[];
7
- attr_accessor :emails
4
+ class ShipmentWeightGetTrackingByIdResponse
8
5
 
9
- # The phone number(s) to receive sms notifications.
10
- # smses?: String[];
11
- attr_accessor :smses
6
+ # The unit in which the value field is expressed.
7
+ # unit?: String;
8
+ attr_accessor :unit
9
+
10
+ # The total amount of shipment weight.
11
+ # value?: Float;
12
+ attr_accessor :value
12
13
 
13
14
  # Initializes the object
14
15
  # @param [Hash] attributes Model attributes in the form of hash
15
16
  def initialize(attributes = {})
16
17
  if (!attributes.is_a?(Hash))
17
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::Notification` initialize method"
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::ShipmentWeightGetTrackingByIdResponse` initialize method"
18
19
  end
19
20
 
20
21
  attributes = attributes.each_with_object({}) { |(k, v), h|
21
22
  h[k.to_sym] = v
22
23
  }
23
24
 
24
- if attributes.key?(:'emails')
25
- self.emails = attributes[:'emails']
25
+ if attributes.key?(:'unit')
26
+ self.unit = attributes[:'unit']
26
27
  end
27
28
 
28
- if attributes.key?(:'smses')
29
- self.smses = attributes[:'smses']
29
+ if attributes.key?(:'value')
30
+ self.value = attributes[:'value']
30
31
  end
31
32
  end
32
33
 
33
34
  # Attribute type mapping.
34
35
  def self.openapi_types
35
36
  {
36
- :'emails' => :'Array<String>',
37
- :'smses' => :'Array<String>',
37
+ :'unit' => :'String',
38
+ :'value' => :'Float',
38
39
  }
39
40
  end
40
41
 
41
42
  # Attribute mapping from ruby-style variable name to JSON key.
42
43
  def self.attribute_map
43
44
  {
44
- :'emails' => :'emails',
45
- :'smses' => :'smses',
45
+ :'unit' => :'unit',
46
+ :'value' => :'value',
46
47
  }
47
48
  end
48
49
 
@@ -159,3 +160,4 @@ module AftershipAPI::Model
159
160
  end
160
161
  end
161
162
  end
163
+
@@ -0,0 +1,163 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class ShipmentWeightMarkTrackingCompletedByIdResponse
5
+
6
+ # The unit in which the value field is expressed.
7
+ # unit?: String;
8
+ attr_accessor :unit
9
+
10
+ # The total amount of shipment weight.
11
+ # value?: Float;
12
+ attr_accessor :value
13
+
14
+ # Initializes the object
15
+ # @param [Hash] attributes Model attributes in the form of hash
16
+ def initialize(attributes = {})
17
+ if (!attributes.is_a?(Hash))
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::ShipmentWeightMarkTrackingCompletedByIdResponse` initialize method"
19
+ end
20
+
21
+ attributes = attributes.each_with_object({}) { |(k, v), h|
22
+ h[k.to_sym] = v
23
+ }
24
+
25
+ if attributes.key?(:'unit')
26
+ self.unit = attributes[:'unit']
27
+ end
28
+
29
+ if attributes.key?(:'value')
30
+ self.value = attributes[:'value']
31
+ end
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'unit' => :'String',
38
+ :'value' => :'Float',
39
+ }
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'unit' => :'unit',
46
+ :'value' => :'value',
47
+ }
48
+ end
49
+
50
+ # Builds the object from hash
51
+ # @param attributes [Hash] Model attributes in the form of hash
52
+ # @return [Object] Returns the model itself
53
+ def self.build_from_hash(attributes)
54
+ return nil unless attributes.is_a?(Hash)
55
+ attributes = attributes.transform_keys(&:to_sym)
56
+ transformed_hash = {}
57
+ openapi_types.each_pair do |key, type|
58
+ if attributes.key?(key) && attributes[key].nil?
59
+ transformed_hash["#{key}"] = nil
60
+ elsif type =~ /\AArray<(.*)>/i
61
+ # check to ensure the input is an array given that the attribute
62
+ # is documented as an array but the input is not
63
+ if attributes[key].is_a?(Array)
64
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
65
+ end
66
+ elsif !attributes[key].nil?
67
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
68
+ end
69
+ end
70
+ new(transformed_hash)
71
+ end
72
+
73
+ # Deserializes the data based on type
74
+ # @param type [String] Data type
75
+ # @param value [String] Value to be deserialized
76
+ # @return [Object] Deserialized data
77
+ def self._deserialize(type, value)
78
+ case type.to_sym
79
+ when :Time
80
+ Time.parse(value)
81
+ when :Date
82
+ Date.parse(value)
83
+ when :String
84
+ value.to_s
85
+ when :Integer
86
+ value.to_i
87
+ when :Float
88
+ value.to_f
89
+ when :Boolean
90
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
91
+ true
92
+ else
93
+ false
94
+ end
95
+ when :Object
96
+ # generic object (usually a Hash), return directly
97
+ value
98
+ when /\AArray<(?<inner_type>.+)>\z/
99
+ inner_type = Regexp.last_match[:inner_type]
100
+ value.map { |v| _deserialize(inner_type, v) }
101
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
102
+ k_type = Regexp.last_match[:k_type]
103
+ v_type = Regexp.last_match[:v_type]
104
+ {}.tap do |hash|
105
+ value.each do |k, v|
106
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
107
+ end
108
+ end
109
+ else # model
110
+ klass = AftershipAPI::Model.const_get(type)
111
+ klass.build_from_hash(value)
112
+ end
113
+ end
114
+
115
+ # Returns the string representation of the object
116
+ # @return [String] String presentation of the object
117
+ def to_s
118
+ to_hash.to_s
119
+ end
120
+
121
+ # to_body is an alias to to_hash (backward compatibility)
122
+ # @return [Hash] Returns the object in the form of hash
123
+ def to_body
124
+ to_hash
125
+ end
126
+
127
+ # Returns the object in the form of hash
128
+ # @return [Hash] Returns the object in the form of hash
129
+ def to_hash
130
+ hash = {}
131
+ self.class.attribute_map.each_pair do |attr, param|
132
+ value = self.send(attr)
133
+ next if value.nil?
134
+
135
+ hash[param] = _to_hash(value)
136
+ end
137
+ hash
138
+ end
139
+
140
+ # Outputs non-array value in the form of hash
141
+ # For object, use to_hash. Otherwise, just return the value
142
+ # @param value [Object] Any valid value
143
+ # @return [Hash] Returns the value in the form of hash
144
+ def _to_hash(value)
145
+ if value.is_a?(Array)
146
+ value.compact.map { |v| _to_hash(v) }
147
+ elsif value.is_a?(Hash)
148
+ {}.tap do |hash|
149
+ value.each { |k, v| hash[k] = _to_hash(v) }
150
+ end
151
+ elsif value.respond_to? :to_hash
152
+ value.to_hash
153
+ else
154
+ value
155
+ end
156
+ end
157
+
158
+ def to_json(*a)
159
+ to_hash.to_json(*a)
160
+ end
161
+ end
162
+ end
163
+
@@ -0,0 +1,163 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class ShipmentWeightRetrackTrackingByIdResponse
5
+
6
+ # The unit in which the value field is expressed.
7
+ # unit?: String;
8
+ attr_accessor :unit
9
+
10
+ # The total amount of shipment weight.
11
+ # value?: Float;
12
+ attr_accessor :value
13
+
14
+ # Initializes the object
15
+ # @param [Hash] attributes Model attributes in the form of hash
16
+ def initialize(attributes = {})
17
+ if (!attributes.is_a?(Hash))
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::ShipmentWeightRetrackTrackingByIdResponse` initialize method"
19
+ end
20
+
21
+ attributes = attributes.each_with_object({}) { |(k, v), h|
22
+ h[k.to_sym] = v
23
+ }
24
+
25
+ if attributes.key?(:'unit')
26
+ self.unit = attributes[:'unit']
27
+ end
28
+
29
+ if attributes.key?(:'value')
30
+ self.value = attributes[:'value']
31
+ end
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'unit' => :'String',
38
+ :'value' => :'Float',
39
+ }
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'unit' => :'unit',
46
+ :'value' => :'value',
47
+ }
48
+ end
49
+
50
+ # Builds the object from hash
51
+ # @param attributes [Hash] Model attributes in the form of hash
52
+ # @return [Object] Returns the model itself
53
+ def self.build_from_hash(attributes)
54
+ return nil unless attributes.is_a?(Hash)
55
+ attributes = attributes.transform_keys(&:to_sym)
56
+ transformed_hash = {}
57
+ openapi_types.each_pair do |key, type|
58
+ if attributes.key?(key) && attributes[key].nil?
59
+ transformed_hash["#{key}"] = nil
60
+ elsif type =~ /\AArray<(.*)>/i
61
+ # check to ensure the input is an array given that the attribute
62
+ # is documented as an array but the input is not
63
+ if attributes[key].is_a?(Array)
64
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
65
+ end
66
+ elsif !attributes[key].nil?
67
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
68
+ end
69
+ end
70
+ new(transformed_hash)
71
+ end
72
+
73
+ # Deserializes the data based on type
74
+ # @param type [String] Data type
75
+ # @param value [String] Value to be deserialized
76
+ # @return [Object] Deserialized data
77
+ def self._deserialize(type, value)
78
+ case type.to_sym
79
+ when :Time
80
+ Time.parse(value)
81
+ when :Date
82
+ Date.parse(value)
83
+ when :String
84
+ value.to_s
85
+ when :Integer
86
+ value.to_i
87
+ when :Float
88
+ value.to_f
89
+ when :Boolean
90
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
91
+ true
92
+ else
93
+ false
94
+ end
95
+ when :Object
96
+ # generic object (usually a Hash), return directly
97
+ value
98
+ when /\AArray<(?<inner_type>.+)>\z/
99
+ inner_type = Regexp.last_match[:inner_type]
100
+ value.map { |v| _deserialize(inner_type, v) }
101
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
102
+ k_type = Regexp.last_match[:k_type]
103
+ v_type = Regexp.last_match[:v_type]
104
+ {}.tap do |hash|
105
+ value.each do |k, v|
106
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
107
+ end
108
+ end
109
+ else # model
110
+ klass = AftershipAPI::Model.const_get(type)
111
+ klass.build_from_hash(value)
112
+ end
113
+ end
114
+
115
+ # Returns the string representation of the object
116
+ # @return [String] String presentation of the object
117
+ def to_s
118
+ to_hash.to_s
119
+ end
120
+
121
+ # to_body is an alias to to_hash (backward compatibility)
122
+ # @return [Hash] Returns the object in the form of hash
123
+ def to_body
124
+ to_hash
125
+ end
126
+
127
+ # Returns the object in the form of hash
128
+ # @return [Hash] Returns the object in the form of hash
129
+ def to_hash
130
+ hash = {}
131
+ self.class.attribute_map.each_pair do |attr, param|
132
+ value = self.send(attr)
133
+ next if value.nil?
134
+
135
+ hash[param] = _to_hash(value)
136
+ end
137
+ hash
138
+ end
139
+
140
+ # Outputs non-array value in the form of hash
141
+ # For object, use to_hash. Otherwise, just return the value
142
+ # @param value [Object] Any valid value
143
+ # @return [Hash] Returns the value in the form of hash
144
+ def _to_hash(value)
145
+ if value.is_a?(Array)
146
+ value.compact.map { |v| _to_hash(v) }
147
+ elsif value.is_a?(Hash)
148
+ {}.tap do |hash|
149
+ value.each { |k, v| hash[k] = _to_hash(v) }
150
+ end
151
+ elsif value.respond_to? :to_hash
152
+ value.to_hash
153
+ else
154
+ value
155
+ end
156
+ end
157
+
158
+ def to_json(*a)
159
+ to_hash.to_json(*a)
160
+ end
161
+ end
162
+ end
163
+
@@ -1,48 +1,49 @@
1
1
  # This code was auto generated by AfterShip SDK Generator.
2
2
  # Do not edit the class manually.
3
3
  module AftershipAPI::Model
4
- class NotificationResponseV1
5
- # Meta data
6
- # meta?: MetaV1;
7
- attr_accessor :meta
4
+ class ShipmentWeightTracking
8
5
 
9
- #
10
- # data?: DataNotificationResponseV1;
11
- attr_accessor :data
6
+ # The unit in which the value field is expressed.
7
+ # unit?: String;
8
+ attr_accessor :unit
9
+
10
+ # The total amount of shipment weight.
11
+ # value?: Float;
12
+ attr_accessor :value
12
13
 
13
14
  # Initializes the object
14
15
  # @param [Hash] attributes Model attributes in the form of hash
15
16
  def initialize(attributes = {})
16
17
  if (!attributes.is_a?(Hash))
17
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::NotificationResponseV1` initialize method"
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::ShipmentWeightTracking` initialize method"
18
19
  end
19
20
 
20
21
  attributes = attributes.each_with_object({}) { |(k, v), h|
21
22
  h[k.to_sym] = v
22
23
  }
23
24
 
24
- if attributes.key?(:'meta')
25
- self.meta = attributes[:'meta']
25
+ if attributes.key?(:'unit')
26
+ self.unit = attributes[:'unit']
26
27
  end
27
28
 
28
- if attributes.key?(:'data')
29
- self.data = attributes[:'data']
29
+ if attributes.key?(:'value')
30
+ self.value = attributes[:'value']
30
31
  end
31
32
  end
32
33
 
33
34
  # Attribute type mapping.
34
35
  def self.openapi_types
35
36
  {
36
- :'meta' => :'MetaV1',
37
- :'data' => :'DataNotificationResponseV1',
37
+ :'unit' => :'String',
38
+ :'value' => :'Float',
38
39
  }
39
40
  end
40
41
 
41
42
  # Attribute mapping from ruby-style variable name to JSON key.
42
43
  def self.attribute_map
43
44
  {
44
- :'meta' => :'meta',
45
- :'data' => :'data',
45
+ :'unit' => :'unit',
46
+ :'value' => :'value',
46
47
  }
47
48
  end
48
49
 
@@ -159,3 +160,4 @@ module AftershipAPI::Model
159
160
  end
160
161
  end
161
162
  end
163
+