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.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +68 -83
- data/lib/aftership-tracking-sdk/api/courier.rb +8 -8
- data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +4 -4
- data/lib/aftership-tracking-sdk/api/tracking.rb +50 -416
- data/lib/aftership-tracking-sdk/api_client.rb +2 -2
- data/lib/aftership-tracking-sdk/configuration.rb +108 -108
- data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_create_tracking_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_create_tracking_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_delete_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_get_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_mark_tracking_completed_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_retrack_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_update_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/courier.rb +2 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_create_tracking_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_delete_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_get_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_retrack_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_tracking.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_update_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{tracking_create_tracking_request.rb → create_tracking_request.rb} +9 -7
- data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +953 -0
- 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
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +8 -126
- data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{tracking_detect_courier_request.rb → detect_courier_request.rb} +5 -3
- data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +12 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +5 -3
- data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/meta_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_tracking_create_tracking_request.rb → next_couriers_create_tracking_request.rb} +4 -2
- data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_tracking_id_response.rb → next_couriers_create_tracking_response.rb} +33 -51
- data/lib/aftership-tracking-sdk/models/next_couriers_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_slug_tracking_number_response.rb → next_couriers_get_tracking_by_id_response.rb} +33 -51
- data/lib/aftership-tracking-sdk/models/next_couriers_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +22 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/pagination.rb +14 -6
- data/lib/aftership-tracking-sdk/models/pagination_data_tracking_response_get_multiple_v1.rb +173 -0
- data/lib/aftership-tracking-sdk/models/{notification_request_v1.rb → pagination_get_trackings_response.rb} +28 -16
- data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/{tracking_delete_response_v1.rb → shipment_weight_create_tracking_response.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/{data_notification_response_v1.rb → shipment_weight_delete_tracking_by_id_response.rb} +21 -9
- data/lib/aftership-tracking-sdk/models/{notification.rb → shipment_weight_get_tracking_by_id_response.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/shipment_weight_mark_tracking_completed_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/shipment_weight_retrack_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/{notification_response_v1.rb → shipment_weight_tracking.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/shipment_weight_update_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tag_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tracking.rb +56 -24
- data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +5 -3
- data/lib/aftership-tracking-sdk/models/{tracking_update_tracking_by_id_request.rb → update_tracking_by_id_request.rb} +5 -3
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/version.rb +1 -1
- metadata +64 -22
- data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +0 -143
- data/lib/aftership-tracking-sdk/api/notification.rb +0 -403
- data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +0 -139
- data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +0 -151
- data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +0 -151
- data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +0 -241
- data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +0 -251
- data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +0 -391
@@ -1,403 +0,0 @@
|
|
1
|
-
# This code was auto generated by AfterShip SDK Generator.
|
2
|
-
# Do not edit the class manually.
|
3
|
-
require 'cgi'
|
4
|
-
|
5
|
-
module AftershipAPI
|
6
|
-
class NotificationApi
|
7
|
-
attr_accessor :api_client
|
8
|
-
|
9
|
-
def initialize(api_client = ApiClient.default)
|
10
|
-
@api_client = api_client
|
11
|
-
end
|
12
|
-
|
13
|
-
# add_notification_by_slug_tracking_number
|
14
|
-
# Add notification receivers to a tracking number.
|
15
|
-
# @param slug [String] Tracking slug
|
16
|
-
# @param tracking_number [String] Tracking number
|
17
|
-
|
18
|
-
# @param body [Model::NotificationRequestV1]
|
19
|
-
# @param [Hash] opts the optional parameters
|
20
|
-
# @option opts [String] :tracking_account_number Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details.
|
21
|
-
# @option opts [String] :tracking_origin_country Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details.
|
22
|
-
# @option opts [String] :tracking_destination_country Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details.
|
23
|
-
# @option opts [String] :tracking_key Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details.
|
24
|
-
# @option opts [String] :tracking_postal_code Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
|
25
|
-
# @option opts [String] :tracking_ship_date Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on for more details.
|
26
|
-
# @option opts [String] :tracking_state Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
|
27
|
-
# @return [Model::Notification]
|
28
|
-
def add_notification_by_slug_tracking_number(slug:, tracking_number:, body:, opts: {})
|
29
|
-
if "notification" != ""
|
30
|
-
body = { :'notification' => body }
|
31
|
-
end
|
32
|
-
opts[:body] = body
|
33
|
-
data, _status_code, _headers = add_notification_by_slug_tracking_number_with_http_info(slug: slug, tracking_number: tracking_number, opts: opts)
|
34
|
-
data
|
35
|
-
end
|
36
|
-
|
37
|
-
def add_notification_by_slug_tracking_number_with_http_info(slug:, tracking_number:, opts: {})
|
38
|
-
if @api_client.config.debugging
|
39
|
-
@api_client.config.logger.debug 'Calling API: NotificationApi.add_notification_by_slug_tracking_number ...'
|
40
|
-
end
|
41
|
-
|
42
|
-
if slug.nil? || (slug.to_s == '')
|
43
|
-
raise InvalidParamError.new "slug cannot be nil or empty"
|
44
|
-
end
|
45
|
-
if tracking_number.nil? || (tracking_number.to_s == '')
|
46
|
-
raise InvalidParamError.new "tracking_number cannot be nil or empty"
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
# resource path
|
51
|
-
local_var_path = "/tracking/2024-04/notifications/#{slug}/#{tracking_number}/add"
|
52
|
-
method = :'POST'
|
53
|
-
|
54
|
-
# query parameters
|
55
|
-
query_params = opts[:query_params] || {}
|
56
|
-
query_params[:'tracking_account_number'] = opts[:'tracking_account_number'] if !opts[:'tracking_account_number'].nil?
|
57
|
-
query_params[:'tracking_origin_country'] = opts[:'tracking_origin_country'] if !opts[:'tracking_origin_country'].nil?
|
58
|
-
query_params[:'tracking_destination_country'] = opts[:'tracking_destination_country'] if !opts[:'tracking_destination_country'].nil?
|
59
|
-
query_params[:'tracking_key'] = opts[:'tracking_key'] if !opts[:'tracking_key'].nil?
|
60
|
-
query_params[:'tracking_postal_code'] = opts[:'tracking_postal_code'] if !opts[:'tracking_postal_code'].nil?
|
61
|
-
query_params[:'tracking_ship_date'] = opts[:'tracking_ship_date'] if !opts[:'tracking_ship_date'].nil?
|
62
|
-
query_params[:'tracking_state'] = opts[:'tracking_state'] if !opts[:'tracking_state'].nil?
|
63
|
-
# header parameters
|
64
|
-
header_params = opts[:header_params] || {}
|
65
|
-
|
66
|
-
# http body (model)
|
67
|
-
post_body = opts[:body]
|
68
|
-
|
69
|
-
# return_type
|
70
|
-
return_type = 'Notification'
|
71
|
-
|
72
|
-
new_options = opts.merge(
|
73
|
-
:operation => :"NotificationApi.add_notification_by_slug_tracking_number",
|
74
|
-
:header_params => header_params,
|
75
|
-
:query_params => query_params,
|
76
|
-
:body => post_body,
|
77
|
-
:return_type => return_type,
|
78
|
-
:response_legacy_tag => "notification",
|
79
|
-
:is_paging => false
|
80
|
-
)
|
81
|
-
|
82
|
-
data, status_code, headers = @api_client.call_api(method, local_var_path, new_options)
|
83
|
-
if @api_client.config.debugging
|
84
|
-
@api_client.config.logger.debug "API called: NotificationApi#add_notification_by_slug_tracking_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
85
|
-
end
|
86
|
-
return data, status_code, headers
|
87
|
-
end
|
88
|
-
|
89
|
-
# add_notification_by_tracking_id
|
90
|
-
# Add notification receivers to a tracking number.
|
91
|
-
# @param tracking_id [String] tracking id
|
92
|
-
|
93
|
-
# @param body [Model::NotificationRequestV1]
|
94
|
-
# @param [Hash] opts the optional parameters
|
95
|
-
# @return [Model::Notification]
|
96
|
-
def add_notification_by_tracking_id(tracking_id:, body:, opts: {})
|
97
|
-
if "notification" != ""
|
98
|
-
body = { :'notification' => body }
|
99
|
-
end
|
100
|
-
opts[:body] = body
|
101
|
-
data, _status_code, _headers = add_notification_by_tracking_id_with_http_info(tracking_id: tracking_id, opts: opts)
|
102
|
-
data
|
103
|
-
end
|
104
|
-
|
105
|
-
def add_notification_by_tracking_id_with_http_info(tracking_id:, opts: {})
|
106
|
-
if @api_client.config.debugging
|
107
|
-
@api_client.config.logger.debug 'Calling API: NotificationApi.add_notification_by_tracking_id ...'
|
108
|
-
end
|
109
|
-
|
110
|
-
if tracking_id.nil? || (tracking_id.to_s == '')
|
111
|
-
raise InvalidParamError.new "tracking_id cannot be nil or empty"
|
112
|
-
end
|
113
|
-
|
114
|
-
|
115
|
-
# resource path
|
116
|
-
local_var_path = "/tracking/2024-04/notifications/#{tracking_id}/add"
|
117
|
-
method = :'POST'
|
118
|
-
|
119
|
-
# query parameters
|
120
|
-
query_params = opts[:query_params] || {}
|
121
|
-
# header parameters
|
122
|
-
header_params = opts[:header_params] || {}
|
123
|
-
|
124
|
-
# http body (model)
|
125
|
-
post_body = opts[:body]
|
126
|
-
|
127
|
-
# return_type
|
128
|
-
return_type = 'Notification'
|
129
|
-
|
130
|
-
new_options = opts.merge(
|
131
|
-
:operation => :"NotificationApi.add_notification_by_tracking_id",
|
132
|
-
:header_params => header_params,
|
133
|
-
:query_params => query_params,
|
134
|
-
:body => post_body,
|
135
|
-
:return_type => return_type,
|
136
|
-
:response_legacy_tag => "notification",
|
137
|
-
:is_paging => false
|
138
|
-
)
|
139
|
-
|
140
|
-
data, status_code, headers = @api_client.call_api(method, local_var_path, new_options)
|
141
|
-
if @api_client.config.debugging
|
142
|
-
@api_client.config.logger.debug "API called: NotificationApi#add_notification_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
143
|
-
end
|
144
|
-
return data, status_code, headers
|
145
|
-
end
|
146
|
-
|
147
|
-
# delete_notification_by_slug_tracking_number
|
148
|
-
# Remove notification receivers from a tracking number.
|
149
|
-
# @param slug [String] Tracking slug
|
150
|
-
# @param tracking_number [String] Tracking number
|
151
|
-
|
152
|
-
# @param body [Model::NotificationRequestV1]
|
153
|
-
# @param [Hash] opts the optional parameters
|
154
|
-
# @option opts [String] :tracking_account_number Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details.
|
155
|
-
# @option opts [String] :tracking_origin_country Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details.
|
156
|
-
# @option opts [String] :tracking_destination_country Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details.
|
157
|
-
# @option opts [String] :tracking_key Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details.
|
158
|
-
# @option opts [String] :tracking_postal_code Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
|
159
|
-
# @option opts [String] :tracking_ship_date Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on for more details.
|
160
|
-
# @option opts [String] :tracking_state Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
|
161
|
-
# @return [Model::Notification]
|
162
|
-
def delete_notification_by_slug_tracking_number(slug:, tracking_number:, body:, opts: {})
|
163
|
-
if "notification" != ""
|
164
|
-
body = { :'notification' => body }
|
165
|
-
end
|
166
|
-
opts[:body] = body
|
167
|
-
data, _status_code, _headers = delete_notification_by_slug_tracking_number_with_http_info(slug: slug, tracking_number: tracking_number, opts: opts)
|
168
|
-
data
|
169
|
-
end
|
170
|
-
|
171
|
-
def delete_notification_by_slug_tracking_number_with_http_info(slug:, tracking_number:, opts: {})
|
172
|
-
if @api_client.config.debugging
|
173
|
-
@api_client.config.logger.debug 'Calling API: NotificationApi.delete_notification_by_slug_tracking_number ...'
|
174
|
-
end
|
175
|
-
|
176
|
-
if slug.nil? || (slug.to_s == '')
|
177
|
-
raise InvalidParamError.new "slug cannot be nil or empty"
|
178
|
-
end
|
179
|
-
if tracking_number.nil? || (tracking_number.to_s == '')
|
180
|
-
raise InvalidParamError.new "tracking_number cannot be nil or empty"
|
181
|
-
end
|
182
|
-
|
183
|
-
|
184
|
-
# resource path
|
185
|
-
local_var_path = "/tracking/2024-04/notifications/#{slug}/#{tracking_number}/remove"
|
186
|
-
method = :'POST'
|
187
|
-
|
188
|
-
# query parameters
|
189
|
-
query_params = opts[:query_params] || {}
|
190
|
-
query_params[:'tracking_account_number'] = opts[:'tracking_account_number'] if !opts[:'tracking_account_number'].nil?
|
191
|
-
query_params[:'tracking_origin_country'] = opts[:'tracking_origin_country'] if !opts[:'tracking_origin_country'].nil?
|
192
|
-
query_params[:'tracking_destination_country'] = opts[:'tracking_destination_country'] if !opts[:'tracking_destination_country'].nil?
|
193
|
-
query_params[:'tracking_key'] = opts[:'tracking_key'] if !opts[:'tracking_key'].nil?
|
194
|
-
query_params[:'tracking_postal_code'] = opts[:'tracking_postal_code'] if !opts[:'tracking_postal_code'].nil?
|
195
|
-
query_params[:'tracking_ship_date'] = opts[:'tracking_ship_date'] if !opts[:'tracking_ship_date'].nil?
|
196
|
-
query_params[:'tracking_state'] = opts[:'tracking_state'] if !opts[:'tracking_state'].nil?
|
197
|
-
# header parameters
|
198
|
-
header_params = opts[:header_params] || {}
|
199
|
-
|
200
|
-
# http body (model)
|
201
|
-
post_body = opts[:body]
|
202
|
-
|
203
|
-
# return_type
|
204
|
-
return_type = 'Notification'
|
205
|
-
|
206
|
-
new_options = opts.merge(
|
207
|
-
:operation => :"NotificationApi.delete_notification_by_slug_tracking_number",
|
208
|
-
:header_params => header_params,
|
209
|
-
:query_params => query_params,
|
210
|
-
:body => post_body,
|
211
|
-
:return_type => return_type,
|
212
|
-
:response_legacy_tag => "notification",
|
213
|
-
:is_paging => false
|
214
|
-
)
|
215
|
-
|
216
|
-
data, status_code, headers = @api_client.call_api(method, local_var_path, new_options)
|
217
|
-
if @api_client.config.debugging
|
218
|
-
@api_client.config.logger.debug "API called: NotificationApi#delete_notification_by_slug_tracking_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
219
|
-
end
|
220
|
-
return data, status_code, headers
|
221
|
-
end
|
222
|
-
|
223
|
-
# delete_notification_by_tracking_id
|
224
|
-
# Remove notification receivers from a tracking number.
|
225
|
-
# @param tracking_id [String] tracking id
|
226
|
-
|
227
|
-
# @param body [Model::NotificationRequestV1]
|
228
|
-
# @param [Hash] opts the optional parameters
|
229
|
-
# @return [Model::Notification]
|
230
|
-
def delete_notification_by_tracking_id(tracking_id:, body:, opts: {})
|
231
|
-
if "notification" != ""
|
232
|
-
body = { :'notification' => body }
|
233
|
-
end
|
234
|
-
opts[:body] = body
|
235
|
-
data, _status_code, _headers = delete_notification_by_tracking_id_with_http_info(tracking_id: tracking_id, opts: opts)
|
236
|
-
data
|
237
|
-
end
|
238
|
-
|
239
|
-
def delete_notification_by_tracking_id_with_http_info(tracking_id:, opts: {})
|
240
|
-
if @api_client.config.debugging
|
241
|
-
@api_client.config.logger.debug 'Calling API: NotificationApi.delete_notification_by_tracking_id ...'
|
242
|
-
end
|
243
|
-
|
244
|
-
if tracking_id.nil? || (tracking_id.to_s == '')
|
245
|
-
raise InvalidParamError.new "tracking_id cannot be nil or empty"
|
246
|
-
end
|
247
|
-
|
248
|
-
|
249
|
-
# resource path
|
250
|
-
local_var_path = "/tracking/2024-04/notifications/#{tracking_id}/remove"
|
251
|
-
method = :'POST'
|
252
|
-
|
253
|
-
# query parameters
|
254
|
-
query_params = opts[:query_params] || {}
|
255
|
-
# header parameters
|
256
|
-
header_params = opts[:header_params] || {}
|
257
|
-
|
258
|
-
# http body (model)
|
259
|
-
post_body = opts[:body]
|
260
|
-
|
261
|
-
# return_type
|
262
|
-
return_type = 'Notification'
|
263
|
-
|
264
|
-
new_options = opts.merge(
|
265
|
-
:operation => :"NotificationApi.delete_notification_by_tracking_id",
|
266
|
-
:header_params => header_params,
|
267
|
-
:query_params => query_params,
|
268
|
-
:body => post_body,
|
269
|
-
:return_type => return_type,
|
270
|
-
:response_legacy_tag => "notification",
|
271
|
-
:is_paging => false
|
272
|
-
)
|
273
|
-
|
274
|
-
data, status_code, headers = @api_client.call_api(method, local_var_path, new_options)
|
275
|
-
if @api_client.config.debugging
|
276
|
-
@api_client.config.logger.debug "API called: NotificationApi#delete_notification_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
277
|
-
end
|
278
|
-
return data, status_code, headers
|
279
|
-
end
|
280
|
-
|
281
|
-
# get_notification_by_slug_tracking_number
|
282
|
-
# Get contact information for the users to notify when the tracking changes. Please note that only customer receivers will be returned. Any `email`, `sms` or `webhook` that belongs to the Store will not be returned.
|
283
|
-
# @param slug [String] Tracking slug
|
284
|
-
# @param tracking_number [String] Tracking number
|
285
|
-
# @param [Hash] opts the optional parameters
|
286
|
-
# @option opts [String] :tracking_account_number Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details.
|
287
|
-
# @option opts [String] :tracking_origin_country Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details.
|
288
|
-
# @option opts [String] :tracking_destination_country Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details.
|
289
|
-
# @option opts [String] :tracking_key Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details.
|
290
|
-
# @option opts [String] :tracking_postal_code Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
|
291
|
-
# @option opts [String] :tracking_ship_date Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on for more details.
|
292
|
-
# @option opts [String] :tracking_state Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
|
293
|
-
# @return [Model::Notification]
|
294
|
-
def get_notification_by_slug_tracking_number(slug:, tracking_number:, opts: {})
|
295
|
-
data, _status_code, _headers = get_notification_by_slug_tracking_number_with_http_info(slug: slug, tracking_number: tracking_number, opts: opts)
|
296
|
-
data
|
297
|
-
end
|
298
|
-
|
299
|
-
def get_notification_by_slug_tracking_number_with_http_info(slug:, tracking_number:, opts: {})
|
300
|
-
if @api_client.config.debugging
|
301
|
-
@api_client.config.logger.debug 'Calling API: NotificationApi.get_notification_by_slug_tracking_number ...'
|
302
|
-
end
|
303
|
-
|
304
|
-
if slug.nil? || (slug.to_s == '')
|
305
|
-
raise InvalidParamError.new "slug cannot be nil or empty"
|
306
|
-
end
|
307
|
-
if tracking_number.nil? || (tracking_number.to_s == '')
|
308
|
-
raise InvalidParamError.new "tracking_number cannot be nil or empty"
|
309
|
-
end
|
310
|
-
|
311
|
-
|
312
|
-
# resource path
|
313
|
-
local_var_path = "/tracking/2024-04/notifications/#{slug}/#{tracking_number}"
|
314
|
-
method = :'GET'
|
315
|
-
|
316
|
-
# query parameters
|
317
|
-
query_params = opts[:query_params] || {}
|
318
|
-
query_params[:'tracking_account_number'] = opts[:'tracking_account_number'] if !opts[:'tracking_account_number'].nil?
|
319
|
-
query_params[:'tracking_origin_country'] = opts[:'tracking_origin_country'] if !opts[:'tracking_origin_country'].nil?
|
320
|
-
query_params[:'tracking_destination_country'] = opts[:'tracking_destination_country'] if !opts[:'tracking_destination_country'].nil?
|
321
|
-
query_params[:'tracking_key'] = opts[:'tracking_key'] if !opts[:'tracking_key'].nil?
|
322
|
-
query_params[:'tracking_postal_code'] = opts[:'tracking_postal_code'] if !opts[:'tracking_postal_code'].nil?
|
323
|
-
query_params[:'tracking_ship_date'] = opts[:'tracking_ship_date'] if !opts[:'tracking_ship_date'].nil?
|
324
|
-
query_params[:'tracking_state'] = opts[:'tracking_state'] if !opts[:'tracking_state'].nil?
|
325
|
-
# header parameters
|
326
|
-
header_params = opts[:header_params] || {}
|
327
|
-
|
328
|
-
# http body (model)
|
329
|
-
post_body = opts[:body]
|
330
|
-
|
331
|
-
# return_type
|
332
|
-
return_type = 'Notification'
|
333
|
-
|
334
|
-
new_options = opts.merge(
|
335
|
-
:operation => :"NotificationApi.get_notification_by_slug_tracking_number",
|
336
|
-
:header_params => header_params,
|
337
|
-
:query_params => query_params,
|
338
|
-
:body => post_body,
|
339
|
-
:return_type => return_type,
|
340
|
-
:response_legacy_tag => "notification",
|
341
|
-
:is_paging => false
|
342
|
-
)
|
343
|
-
|
344
|
-
data, status_code, headers = @api_client.call_api(method, local_var_path, new_options)
|
345
|
-
if @api_client.config.debugging
|
346
|
-
@api_client.config.logger.debug "API called: NotificationApi#get_notification_by_slug_tracking_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
347
|
-
end
|
348
|
-
return data, status_code, headers
|
349
|
-
end
|
350
|
-
|
351
|
-
# get_notification_by_tracking_id
|
352
|
-
# Get contact information for the users to notify when the tracking changes. Please note that only customer receivers will be returned. Any `email`, `sms` or `webhook` that belongs to the Store will not be returned.
|
353
|
-
# @param tracking_id [String] tracking id
|
354
|
-
# @param [Hash] opts the optional parameters
|
355
|
-
# @return [Model::Notification]
|
356
|
-
def get_notification_by_tracking_id(tracking_id:, opts: {})
|
357
|
-
data, _status_code, _headers = get_notification_by_tracking_id_with_http_info(tracking_id: tracking_id, opts: opts)
|
358
|
-
data
|
359
|
-
end
|
360
|
-
|
361
|
-
def get_notification_by_tracking_id_with_http_info(tracking_id:, opts: {})
|
362
|
-
if @api_client.config.debugging
|
363
|
-
@api_client.config.logger.debug 'Calling API: NotificationApi.get_notification_by_tracking_id ...'
|
364
|
-
end
|
365
|
-
|
366
|
-
if tracking_id.nil? || (tracking_id.to_s == '')
|
367
|
-
raise InvalidParamError.new "tracking_id cannot be nil or empty"
|
368
|
-
end
|
369
|
-
|
370
|
-
|
371
|
-
# resource path
|
372
|
-
local_var_path = "/tracking/2024-04/notifications/#{tracking_id}"
|
373
|
-
method = :'GET'
|
374
|
-
|
375
|
-
# query parameters
|
376
|
-
query_params = opts[:query_params] || {}
|
377
|
-
# header parameters
|
378
|
-
header_params = opts[:header_params] || {}
|
379
|
-
|
380
|
-
# http body (model)
|
381
|
-
post_body = opts[:body]
|
382
|
-
|
383
|
-
# return_type
|
384
|
-
return_type = 'Notification'
|
385
|
-
|
386
|
-
new_options = opts.merge(
|
387
|
-
:operation => :"NotificationApi.get_notification_by_tracking_id",
|
388
|
-
:header_params => header_params,
|
389
|
-
:query_params => query_params,
|
390
|
-
:body => post_body,
|
391
|
-
:return_type => return_type,
|
392
|
-
:response_legacy_tag => "notification",
|
393
|
-
:is_paging => false
|
394
|
-
)
|
395
|
-
|
396
|
-
data, status_code, headers = @api_client.call_api(method, local_var_path, new_options)
|
397
|
-
if @api_client.config.debugging
|
398
|
-
@api_client.config.logger.debug "API called: NotificationApi#get_notification_by_tracking_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
399
|
-
end
|
400
|
-
return data, status_code, headers
|
401
|
-
end
|
402
|
-
end
|
403
|
-
end
|
@@ -1,139 +0,0 @@
|
|
1
|
-
# This code was auto generated by AfterShip SDK Generator.
|
2
|
-
# Do not edit the class manually.
|
3
|
-
module AftershipAPI::Model
|
4
|
-
class CustomFieldsTrackingUpdateTrackingBySlugTrackingNumberRequest
|
5
|
-
# Initializes the object
|
6
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
7
|
-
def initialize(attributes = {})
|
8
|
-
if (!attributes.is_a?(Hash))
|
9
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::CustomFieldsTrackingUpdateTrackingBySlugTrackingNumberRequest` initialize method"
|
10
|
-
end
|
11
|
-
|
12
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
13
|
-
h[k.to_sym] = v
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
# Attribute type mapping.
|
18
|
-
def self.openapi_types
|
19
|
-
{}
|
20
|
-
end
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Builds the object from hash
|
28
|
-
# @param attributes [Hash] Model attributes in the form of hash
|
29
|
-
# @return [Object] Returns the model itself
|
30
|
-
def self.build_from_hash(attributes)
|
31
|
-
return nil unless attributes.is_a?(Hash)
|
32
|
-
attributes = attributes.transform_keys(&:to_sym)
|
33
|
-
transformed_hash = {}
|
34
|
-
openapi_types.each_pair do |key, type|
|
35
|
-
if attributes.key?(key) && attributes[key].nil?
|
36
|
-
transformed_hash["#{key}"] = nil
|
37
|
-
elsif type =~ /\AArray<(.*)>/i
|
38
|
-
# check to ensure the input is an array given that the attribute
|
39
|
-
# is documented as an array but the input is not
|
40
|
-
if attributes[key].is_a?(Array)
|
41
|
-
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
42
|
-
end
|
43
|
-
elsif !attributes[key].nil?
|
44
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
45
|
-
end
|
46
|
-
end
|
47
|
-
new(transformed_hash)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Deserializes the data based on type
|
51
|
-
# @param type [String] Data type
|
52
|
-
# @param value [String] Value to be deserialized
|
53
|
-
# @return [Object] Deserialized data
|
54
|
-
def self._deserialize(type, value)
|
55
|
-
case type.to_sym
|
56
|
-
when :Time
|
57
|
-
Time.parse(value)
|
58
|
-
when :Date
|
59
|
-
Date.parse(value)
|
60
|
-
when :String
|
61
|
-
value.to_s
|
62
|
-
when :Integer
|
63
|
-
value.to_i
|
64
|
-
when :Float
|
65
|
-
value.to_f
|
66
|
-
when :Boolean
|
67
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
68
|
-
true
|
69
|
-
else
|
70
|
-
false
|
71
|
-
end
|
72
|
-
when :Object
|
73
|
-
# generic object (usually a Hash), return directly
|
74
|
-
value
|
75
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
76
|
-
inner_type = Regexp.last_match[:inner_type]
|
77
|
-
value.map { |v| _deserialize(inner_type, v) }
|
78
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
79
|
-
k_type = Regexp.last_match[:k_type]
|
80
|
-
v_type = Regexp.last_match[:v_type]
|
81
|
-
{}.tap do |hash|
|
82
|
-
value.each do |k, v|
|
83
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
else # model
|
87
|
-
klass = AftershipAPI::Model.const_get(type)
|
88
|
-
klass.build_from_hash(value)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# Returns the string representation of the object
|
93
|
-
# @return [String] String presentation of the object
|
94
|
-
def to_s
|
95
|
-
to_hash.to_s
|
96
|
-
end
|
97
|
-
|
98
|
-
# to_body is an alias to to_hash (backward compatibility)
|
99
|
-
# @return [Hash] Returns the object in the form of hash
|
100
|
-
def to_body
|
101
|
-
to_hash
|
102
|
-
end
|
103
|
-
|
104
|
-
# Returns the object in the form of hash
|
105
|
-
# @return [Hash] Returns the object in the form of hash
|
106
|
-
def to_hash
|
107
|
-
hash = {}
|
108
|
-
self.class.attribute_map.each_pair do |attr, param|
|
109
|
-
value = self.send(attr)
|
110
|
-
next if value.nil?
|
111
|
-
|
112
|
-
hash[param] = _to_hash(value)
|
113
|
-
end
|
114
|
-
hash
|
115
|
-
end
|
116
|
-
|
117
|
-
# Outputs non-array value in the form of hash
|
118
|
-
# For object, use to_hash. Otherwise, just return the value
|
119
|
-
# @param value [Object] Any valid value
|
120
|
-
# @return [Hash] Returns the value in the form of hash
|
121
|
-
def _to_hash(value)
|
122
|
-
if value.is_a?(Array)
|
123
|
-
value.compact.map { |v| _to_hash(v) }
|
124
|
-
elsif value.is_a?(Hash)
|
125
|
-
{}.tap do |hash|
|
126
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
127
|
-
end
|
128
|
-
elsif value.respond_to? :to_hash
|
129
|
-
value.to_hash
|
130
|
-
else
|
131
|
-
value
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def to_json(*a)
|
136
|
-
to_hash.to_json(*a)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
@@ -1,151 +0,0 @@
|
|
1
|
-
# This code was auto generated by AfterShip SDK Generator.
|
2
|
-
# Do not edit the class manually.
|
3
|
-
module AftershipAPI::Model
|
4
|
-
class DataTrackingDeleteResponseV1
|
5
|
-
# Partial tracking model
|
6
|
-
# tracking?: PartialDeleteTracking;
|
7
|
-
attr_accessor :tracking
|
8
|
-
|
9
|
-
# Initializes the object
|
10
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
11
|
-
def initialize(attributes = {})
|
12
|
-
if (!attributes.is_a?(Hash))
|
13
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataTrackingDeleteResponseV1` initialize method"
|
14
|
-
end
|
15
|
-
|
16
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
17
|
-
h[k.to_sym] = v
|
18
|
-
}
|
19
|
-
|
20
|
-
if attributes.key?(:'tracking')
|
21
|
-
self.tracking = attributes[:'tracking']
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Attribute type mapping.
|
26
|
-
def self.openapi_types
|
27
|
-
{
|
28
|
-
:'tracking' => :'PartialDeleteTracking',
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
-
def self.attribute_map
|
34
|
-
{
|
35
|
-
:'tracking' => :'tracking',
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# Builds the object from hash
|
40
|
-
# @param attributes [Hash] Model attributes in the form of hash
|
41
|
-
# @return [Object] Returns the model itself
|
42
|
-
def self.build_from_hash(attributes)
|
43
|
-
return nil unless attributes.is_a?(Hash)
|
44
|
-
attributes = attributes.transform_keys(&:to_sym)
|
45
|
-
transformed_hash = {}
|
46
|
-
openapi_types.each_pair do |key, type|
|
47
|
-
if attributes.key?(key) && attributes[key].nil?
|
48
|
-
transformed_hash["#{key}"] = nil
|
49
|
-
elsif type =~ /\AArray<(.*)>/i
|
50
|
-
# check to ensure the input is an array given that the attribute
|
51
|
-
# is documented as an array but the input is not
|
52
|
-
if attributes[key].is_a?(Array)
|
53
|
-
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
54
|
-
end
|
55
|
-
elsif !attributes[key].nil?
|
56
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
57
|
-
end
|
58
|
-
end
|
59
|
-
new(transformed_hash)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Deserializes the data based on type
|
63
|
-
# @param type [String] Data type
|
64
|
-
# @param value [String] Value to be deserialized
|
65
|
-
# @return [Object] Deserialized data
|
66
|
-
def self._deserialize(type, value)
|
67
|
-
case type.to_sym
|
68
|
-
when :Time
|
69
|
-
Time.parse(value)
|
70
|
-
when :Date
|
71
|
-
Date.parse(value)
|
72
|
-
when :String
|
73
|
-
value.to_s
|
74
|
-
when :Integer
|
75
|
-
value.to_i
|
76
|
-
when :Float
|
77
|
-
value.to_f
|
78
|
-
when :Boolean
|
79
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
80
|
-
true
|
81
|
-
else
|
82
|
-
false
|
83
|
-
end
|
84
|
-
when :Object
|
85
|
-
# generic object (usually a Hash), return directly
|
86
|
-
value
|
87
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
88
|
-
inner_type = Regexp.last_match[:inner_type]
|
89
|
-
value.map { |v| _deserialize(inner_type, v) }
|
90
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
91
|
-
k_type = Regexp.last_match[:k_type]
|
92
|
-
v_type = Regexp.last_match[:v_type]
|
93
|
-
{}.tap do |hash|
|
94
|
-
value.each do |k, v|
|
95
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
else # model
|
99
|
-
klass = AftershipAPI::Model.const_get(type)
|
100
|
-
klass.build_from_hash(value)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# Returns the string representation of the object
|
105
|
-
# @return [String] String presentation of the object
|
106
|
-
def to_s
|
107
|
-
to_hash.to_s
|
108
|
-
end
|
109
|
-
|
110
|
-
# to_body is an alias to to_hash (backward compatibility)
|
111
|
-
# @return [Hash] Returns the object in the form of hash
|
112
|
-
def to_body
|
113
|
-
to_hash
|
114
|
-
end
|
115
|
-
|
116
|
-
# Returns the object in the form of hash
|
117
|
-
# @return [Hash] Returns the object in the form of hash
|
118
|
-
def to_hash
|
119
|
-
hash = {}
|
120
|
-
self.class.attribute_map.each_pair do |attr, param|
|
121
|
-
value = self.send(attr)
|
122
|
-
next if value.nil?
|
123
|
-
|
124
|
-
hash[param] = _to_hash(value)
|
125
|
-
end
|
126
|
-
hash
|
127
|
-
end
|
128
|
-
|
129
|
-
# Outputs non-array value in the form of hash
|
130
|
-
# For object, use to_hash. Otherwise, just return the value
|
131
|
-
# @param value [Object] Any valid value
|
132
|
-
# @return [Hash] Returns the value in the form of hash
|
133
|
-
def _to_hash(value)
|
134
|
-
if value.is_a?(Array)
|
135
|
-
value.compact.map { |v| _to_hash(v) }
|
136
|
-
elsif value.is_a?(Hash)
|
137
|
-
{}.tap do |hash|
|
138
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
139
|
-
end
|
140
|
-
elsif value.respond_to? :to_hash
|
141
|
-
value.to_hash
|
142
|
-
else
|
143
|
-
value
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def to_json(*a)
|
148
|
-
to_hash.to_json(*a)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|