aftership-tracking-sdk 10.0.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -12
  3. data/lib/aftership-tracking-sdk/api/courier.rb +16 -60
  4. data/lib/aftership-tracking-sdk/api/courier_connection.rb +283 -0
  5. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +2 -2
  6. data/lib/aftership-tracking-sdk/api/tracking.rb +9 -9
  7. data/lib/aftership-tracking-sdk/models/{additional_fields_v1.rb → additional_fields.rb} +9 -9
  8. data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -2
  9. data/lib/aftership-tracking-sdk/models/courier.rb +10 -0
  10. data/lib/aftership-tracking-sdk/models/courier_connection.rb +193 -0
  11. data/lib/aftership-tracking-sdk/models/courier_connection_response_for_get_courier_connections.rb +163 -0
  12. data/lib/aftership-tracking-sdk/models/{courier_response_v1.rb → courier_response.rb} +6 -6
  13. data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +22 -52
  14. data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +4 -44
  15. data/lib/aftership-tracking-sdk/models/credential_field.rb +173 -0
  16. data/lib/aftership-tracking-sdk/models/{get_user_couriers_response.rb → credentials_courier.rb} +9 -19
  17. data/lib/aftership-tracking-sdk/models/data_courier_connection_response_for_get_courier_connections.rb +163 -0
  18. data/lib/aftership-tracking-sdk/models/{data_courier_response_v1.rb → data_courier_response.rb} +2 -2
  19. data/lib/aftership-tracking-sdk/models/{data_tracking_response_get_multiple_v1.rb → data_tracking_response_for_get_trackings.rb} +4 -4
  20. data/lib/aftership-tracking-sdk/models/delete_courier_connections_by_id_response.rb +193 -0
  21. data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +4 -44
  22. data/lib/aftership-tracking-sdk/models/detect_courier_request.rb +14 -34
  23. data/lib/aftership-tracking-sdk/models/first_mile_create_tracking_response.rb +2 -2
  24. data/lib/aftership-tracking-sdk/models/first_mile_delete_tracking_by_id_response.rb +2 -2
  25. data/lib/aftership-tracking-sdk/models/first_mile_get_tracking_by_id_response.rb +2 -2
  26. data/lib/aftership-tracking-sdk/models/first_mile_mark_tracking_completed_by_id_response.rb +2 -2
  27. data/lib/aftership-tracking-sdk/models/first_mile_retrack_tracking_by_id_response.rb +2 -2
  28. data/lib/aftership-tracking-sdk/models/first_mile_tracking.rb +2 -2
  29. data/lib/aftership-tracking-sdk/models/first_mile_update_tracking_by_id_response.rb +2 -2
  30. data/lib/aftership-tracking-sdk/models/get_courier_connections_by_id_response.rb +193 -0
  31. data/lib/aftership-tracking-sdk/models/get_courier_connections_response.rb +163 -0
  32. data/lib/aftership-tracking-sdk/models/{get_all_couriers_response.rb → get_couriers_response.rb} +2 -2
  33. data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +4 -44
  34. data/lib/aftership-tracking-sdk/models/last_mile_create_tracking_response.rb +2 -2
  35. data/lib/aftership-tracking-sdk/models/last_mile_delete_tracking_by_id_response.rb +2 -2
  36. data/lib/aftership-tracking-sdk/models/last_mile_get_tracking_by_id_response.rb +2 -2
  37. data/lib/aftership-tracking-sdk/models/last_mile_mark_tracking_completed_by_id_response.rb +2 -2
  38. data/lib/aftership-tracking-sdk/models/last_mile_retrack_tracking_by_id_response.rb +2 -2
  39. data/lib/aftership-tracking-sdk/models/last_mile_tracking.rb +2 -2
  40. data/lib/aftership-tracking-sdk/models/last_mile_update_tracking_by_id_response.rb +2 -2
  41. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +10 -0
  42. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +10 -0
  43. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +10 -0
  44. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +10 -0
  45. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +10 -0
  46. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +10 -0
  47. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +10 -0
  48. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +10 -0
  49. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +4 -44
  50. data/lib/aftership-tracking-sdk/models/{meta_v1.rb → meta.rb} +2 -2
  51. data/lib/aftership-tracking-sdk/models/pagination_data_courier_connection_response_for_get_courier_connections.rb +173 -0
  52. data/lib/aftership-tracking-sdk/models/{pagination_data_tracking_response_get_multiple_v1.rb → pagination_data_tracking_response_for_get_trackings.rb} +2 -2
  53. data/lib/aftership-tracking-sdk/models/pagination_get_courier_connections_response.rb +173 -0
  54. data/lib/aftership-tracking-sdk/models/post_courier_connections_request.rb +163 -0
  55. data/lib/aftership-tracking-sdk/models/post_courier_connections_response.rb +193 -0
  56. data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_request.rb +153 -0
  57. data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_response.rb +193 -0
  58. data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +4 -44
  59. data/lib/aftership-tracking-sdk/models/{slug_group_v1.rb → slug_group.rb} +3 -3
  60. data/lib/aftership-tracking-sdk/models/{tag_v1.rb → tag.rb} +3 -3
  61. data/lib/aftership-tracking-sdk/models/tracking.rb +4 -44
  62. data/lib/aftership-tracking-sdk/models/{tracking_response_v1.rb → tracking_response.rb} +4 -4
  63. data/lib/aftership-tracking-sdk/models/{tracking_response_get_multiple_v1.rb → tracking_response_for_get_trackings.rb} +6 -6
  64. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +0 -40
  65. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +4 -44
  66. data/lib/aftership-tracking-sdk/version.rb +1 -1
  67. metadata +28 -14
@@ -0,0 +1,173 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class CredentialField
5
+
6
+ # The display name of the credential field that users must provide when creating a carrier connection.
7
+ # name?: String;
8
+ attr_accessor :name
9
+
10
+ # The data type of the credential field, indicating what kind of input is expected.
11
+ # type?: String;
12
+ attr_accessor :type
13
+
14
+ # It indicates whether the credentials field must be provided or not when creating a carrier connection.
15
+ # required?: Boolean;
16
+ attr_accessor :required
17
+
18
+ # Initializes the object
19
+ # @param [Hash] attributes Model attributes in the form of hash
20
+ def initialize(attributes = {})
21
+ if (!attributes.is_a?(Hash))
22
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::CredentialField` initialize method"
23
+ end
24
+
25
+ attributes = attributes.each_with_object({}) { |(k, v), h|
26
+ h[k.to_sym] = v
27
+ }
28
+
29
+ if attributes.key?(:'name')
30
+ self.name = attributes[:'name']
31
+ end
32
+
33
+ if attributes.key?(:'type')
34
+ self.type = attributes[:'type']
35
+ end
36
+
37
+ if attributes.key?(:'required')
38
+ self.required = attributes[:'required']
39
+ end
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'name' => :'String',
46
+ :'type' => :'String',
47
+ :'required' => :'Boolean',
48
+ }
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'name' => :'name',
55
+ :'type' => :'type',
56
+ :'required' => :'required',
57
+ }
58
+ end
59
+
60
+ # Builds the object from hash
61
+ # @param attributes [Hash] Model attributes in the form of hash
62
+ # @return [Object] Returns the model itself
63
+ def self.build_from_hash(attributes)
64
+ return nil unless attributes.is_a?(Hash)
65
+ attributes = attributes.transform_keys(&:to_sym)
66
+ transformed_hash = {}
67
+ openapi_types.each_pair do |key, type|
68
+ if attributes.key?(key) && attributes[key].nil?
69
+ transformed_hash["#{key}"] = nil
70
+ elsif type =~ /\AArray<(.*)>/i
71
+ # check to ensure the input is an array given that the attribute
72
+ # is documented as an array but the input is not
73
+ if attributes[key].is_a?(Array)
74
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
75
+ end
76
+ elsif !attributes[key].nil?
77
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
78
+ end
79
+ end
80
+ new(transformed_hash)
81
+ end
82
+
83
+ # Deserializes the data based on type
84
+ # @param type [String] Data type
85
+ # @param value [String] Value to be deserialized
86
+ # @return [Object] Deserialized data
87
+ def self._deserialize(type, value)
88
+ case type.to_sym
89
+ when :Time
90
+ Time.parse(value)
91
+ when :Date
92
+ Date.parse(value)
93
+ when :String
94
+ value.to_s
95
+ when :Integer
96
+ value.to_i
97
+ when :Float
98
+ value.to_f
99
+ when :Boolean
100
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
101
+ true
102
+ else
103
+ false
104
+ end
105
+ when :Object
106
+ # generic object (usually a Hash), return directly
107
+ value
108
+ when /\AArray<(?<inner_type>.+)>\z/
109
+ inner_type = Regexp.last_match[:inner_type]
110
+ value.map { |v| _deserialize(inner_type, v) }
111
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
112
+ k_type = Regexp.last_match[:k_type]
113
+ v_type = Regexp.last_match[:v_type]
114
+ {}.tap do |hash|
115
+ value.each do |k, v|
116
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
117
+ end
118
+ end
119
+ else # model
120
+ klass = AftershipAPI::Model.const_get(type)
121
+ klass.build_from_hash(value)
122
+ end
123
+ end
124
+
125
+ # Returns the string representation of the object
126
+ # @return [String] String presentation of the object
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # to_body is an alias to to_hash (backward compatibility)
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_body
134
+ to_hash
135
+ end
136
+
137
+ # Returns the object in the form of hash
138
+ # @return [Hash] Returns the object in the form of hash
139
+ def to_hash
140
+ hash = {}
141
+ self.class.attribute_map.each_pair do |attr, param|
142
+ value = self.send(attr)
143
+ next if value.nil?
144
+
145
+ hash[param] = _to_hash(value)
146
+ end
147
+ hash
148
+ end
149
+
150
+ # Outputs non-array value in the form of hash
151
+ # For object, use to_hash. Otherwise, just return the value
152
+ # @param value [Object] Any valid value
153
+ # @return [Hash] Returns the value in the form of hash
154
+ def _to_hash(value)
155
+ if value.is_a?(Array)
156
+ value.compact.map { |v| _to_hash(v) }
157
+ elsif value.is_a?(Hash)
158
+ {}.tap do |hash|
159
+ value.each { |k, v| hash[k] = _to_hash(v) }
160
+ end
161
+ elsif value.respond_to? :to_hash
162
+ value.to_hash
163
+ else
164
+ value
165
+ end
166
+ end
167
+
168
+ def to_json(*a)
169
+ to_hash.to_json(*a)
170
+ end
171
+ end
172
+ end
173
+
@@ -1,49 +1,39 @@
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 GetUserCouriersResponse
4
+ class CredentialsCourier
5
5
 
6
- # Total count of courier objects
7
- # total?: Integer;
8
- attr_accessor :total
9
-
10
- # Array of object.
11
- # couriers?: Courier[];
12
- attr_accessor :couriers
6
+ # Through this field, users can get the specific authentication information needed when creating a courier connection to one specific carrier, such as API keys, usernames, and passwords. Each field includes properties like name, data type, and whether it's required.
7
+ # fields?: CredentialField[];
8
+ attr_accessor :fields
13
9
 
14
10
  # Initializes the object
15
11
  # @param [Hash] attributes Model attributes in the form of hash
16
12
  def initialize(attributes = {})
17
13
  if (!attributes.is_a?(Hash))
18
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::GetUserCouriersResponse` initialize method"
14
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::CredentialsCourier` initialize method"
19
15
  end
20
16
 
21
17
  attributes = attributes.each_with_object({}) { |(k, v), h|
22
18
  h[k.to_sym] = v
23
19
  }
24
20
 
25
- if attributes.key?(:'total')
26
- self.total = attributes[:'total']
27
- end
28
-
29
- if attributes.key?(:'couriers')
30
- self.couriers = attributes[:'couriers']
21
+ if attributes.key?(:'fields')
22
+ self.fields = attributes[:'fields']
31
23
  end
32
24
  end
33
25
 
34
26
  # Attribute type mapping.
35
27
  def self.openapi_types
36
28
  {
37
- :'total' => :'Integer',
38
- :'couriers' => :'Array<Courier>',
29
+ :'fields' => :'Array<CredentialField>',
39
30
  }
40
31
  end
41
32
 
42
33
  # Attribute mapping from ruby-style variable name to JSON key.
43
34
  def self.attribute_map
44
35
  {
45
- :'total' => :'total',
46
- :'couriers' => :'couriers',
36
+ :'fields' => :'fields',
47
37
  }
48
38
  end
49
39
 
@@ -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 DataCourierConnectionResponseForGetCourierConnections
5
+
6
+ #
7
+ # pagination?: PaginationDataCourierConnectionResponseForGetCourierConnections;
8
+ attr_accessor :pagination
9
+
10
+ #
11
+ # courier_connections?: CourierConnection[];
12
+ attr_accessor :courier_connections
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::DataCourierConnectionResponseForGetCourierConnections` 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?(:'pagination')
26
+ self.pagination = attributes[:'pagination']
27
+ end
28
+
29
+ if attributes.key?(:'courier_connections')
30
+ self.courier_connections = attributes[:'courier_connections']
31
+ end
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'pagination' => :'PaginationDataCourierConnectionResponseForGetCourierConnections',
38
+ :'courier_connections' => :'Array<CourierConnection>',
39
+ }
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'pagination' => :'pagination',
46
+ :'courier_connections' => :'courier_connections',
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,7 +1,7 @@
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 DataCourierResponseV1
4
+ class DataCourierResponse
5
5
 
6
6
  # Total count of courier objects
7
7
  # total?: Integer;
@@ -15,7 +15,7 @@ module AftershipAPI::Model
15
15
  # @param [Hash] attributes Model attributes in the form of hash
16
16
  def initialize(attributes = {})
17
17
  if (!attributes.is_a?(Hash))
18
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataCourierResponseV1` initialize method"
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataCourierResponse` initialize method"
19
19
  end
20
20
 
21
21
  attributes = attributes.each_with_object({}) { |(k, v), h|
@@ -1,10 +1,10 @@
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 DataTrackingResponseGetMultipleV1
4
+ class DataTrackingResponseForGetTrackings
5
5
 
6
6
  # The Pagination holds the information for the pagination when the response contains multiple objects.
7
- # pagination?: PaginationDataTrackingResponseGetMultipleV1;
7
+ # pagination?: PaginationDataTrackingResponseForGetTrackings;
8
8
  attr_accessor :pagination
9
9
 
10
10
  # Array of
@@ -15,7 +15,7 @@ module AftershipAPI::Model
15
15
  # @param [Hash] attributes Model attributes in the form of hash
16
16
  def initialize(attributes = {})
17
17
  if (!attributes.is_a?(Hash))
18
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataTrackingResponseGetMultipleV1` initialize method"
18
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataTrackingResponseForGetTrackings` initialize method"
19
19
  end
20
20
 
21
21
  attributes = attributes.each_with_object({}) { |(k, v), h|
@@ -34,7 +34,7 @@ module AftershipAPI::Model
34
34
  # Attribute type mapping.
35
35
  def self.openapi_types
36
36
  {
37
- :'pagination' => :'PaginationDataTrackingResponseGetMultipleV1',
37
+ :'pagination' => :'PaginationDataTrackingResponseForGetTrackings',
38
38
  :'trackings' => :'Array<Tracking>',
39
39
  }
40
40
  end
@@ -0,0 +1,193 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class DeleteCourierConnectionsByIdResponse
5
+
6
+ # The courier connection ID is a special set of numbers generated by AfterShip to define each user-created connection.
7
+ # id?: String;
8
+ attr_accessor :id
9
+
10
+ # Unique courier code. Get courier codes .
11
+ # courier_slug?: String;
12
+ attr_accessor :courier_slug
13
+
14
+ # It refers to the authentication details required for each specific carrier details required for each specific carrier (such as API keys, username, password, etc.) that the user must provide to establish a carrier connection. The content varies by carrier.
15
+ # credentials?: Object;
16
+ attr_accessor :credentials
17
+
18
+ # The date and time the courier connection was created. It uses the format YYYY-MM-DDTHH:mm:ssZ for the timezone GMT +0.
19
+ # created_at?: String;
20
+ attr_accessor :created_at
21
+
22
+ # The date and time the courier connection was updated. It uses the format YYYY-MM-DDTHH:mm:ssZ for the timezone GMT +0.
23
+ # updated_at?: String;
24
+ attr_accessor :updated_at
25
+
26
+ # Initializes the object
27
+ # @param [Hash] attributes Model attributes in the form of hash
28
+ def initialize(attributes = {})
29
+ if (!attributes.is_a?(Hash))
30
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DeleteCourierConnectionsByIdResponse` initialize method"
31
+ end
32
+
33
+ attributes = attributes.each_with_object({}) { |(k, v), h|
34
+ h[k.to_sym] = v
35
+ }
36
+
37
+ if attributes.key?(:'id')
38
+ self.id = attributes[:'id']
39
+ end
40
+
41
+ if attributes.key?(:'courier_slug')
42
+ self.courier_slug = attributes[:'courier_slug']
43
+ end
44
+
45
+ if attributes.key?(:'credentials')
46
+ self.credentials = attributes[:'credentials']
47
+ end
48
+
49
+ if attributes.key?(:'created_at')
50
+ self.created_at = attributes[:'created_at']
51
+ end
52
+
53
+ if attributes.key?(:'updated_at')
54
+ self.updated_at = attributes[:'updated_at']
55
+ end
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'id' => :'String',
62
+ :'courier_slug' => :'String',
63
+ :'credentials' => :'Object',
64
+ :'created_at' => :'String',
65
+ :'updated_at' => :'String',
66
+ }
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'id' => :'id',
73
+ :'courier_slug' => :'courier_slug',
74
+ :'credentials' => :'credentials',
75
+ :'created_at' => :'created_at',
76
+ :'updated_at' => :'updated_at',
77
+ }
78
+ end
79
+
80
+ # Builds the object from hash
81
+ # @param attributes [Hash] Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def self.build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ attributes = attributes.transform_keys(&:to_sym)
86
+ transformed_hash = {}
87
+ openapi_types.each_pair do |key, type|
88
+ if attributes.key?(key) && attributes[key].nil?
89
+ transformed_hash["#{key}"] = nil
90
+ elsif type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[key].is_a?(Array)
94
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
95
+ end
96
+ elsif !attributes[key].nil?
97
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
98
+ end
99
+ end
100
+ new(transformed_hash)
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param type [String] Data type
105
+ # @param value [String] Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def self._deserialize(type, value)
108
+ case type.to_sym
109
+ when :Time
110
+ Time.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :Boolean
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ klass = AftershipAPI::Model.const_get(type)
141
+ klass.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param value [Object] Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ def to_json(*a)
189
+ to_hash.to_json(*a)
190
+ end
191
+ end
192
+ end
193
+