Class: AftershipAPI::CourierConnectionApi

Inherits:
Object
  • Object
show all
Defined in:
lib/aftership-tracking-sdk/api/courier_connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CourierConnectionApi



9
10
11
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 9

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



7
8
9
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 7

def api_client
  @api_client
end

Instance Method Details

#delete_courier_connections_by_id(id:, opts: {}) ⇒ Model::DeleteCourierConnectionsByIdResponse

delete_courier_connections_by_id Delete a courier connection.



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 214

def delete_courier_connections_by_id(id:, opts: {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CourierConnectionApi.delete_courier_connections_by_id ...'
  end
  if id.nil? or id.to_s == ''
    raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty")
  end


  # resource path
  local_var_path = "/tracking/2025-07/courier-connections/#{id}"
  method = :'DELETE'

  # query parameters
  query_params = opts[:query_params] || {}
  # header parameters
  header_params = opts[:header_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = 'CourierConnection'

  new_options = opts.merge(
    :operation => :"CourierConnectionApi.delete_courier_connections_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => return_type
  )

  data, _status_code, headers = @api_client.call_api(method, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CourierConnectionApi#delete_courier_connections_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end

  resp = Model::DeleteCourierConnectionsByIdResponse.new
  resp.data = data
  resp.response_header = headers
  resp
end

#get_courier_connections(opts: {}) ⇒ Model::GetCourierConnectionsResponse

get_courier_connections Get courier connection results of multiple courier connections.

Options Hash (opts:):

  • :courier_slug (String)

    Unique courier code.(Example: dhl-api)

  • :cursor (String)

    A string representing the cursor value for the current page of results.

  • :limit (String)

    Number of courier connections each page contain. (Default: 100, Max: 200)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 20

def get_courier_connections(opts: {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CourierConnectionApi.get_courier_connections ...'
  end


  # resource path
  local_var_path = "/tracking/2025-07/courier-connections"
  method = :'GET'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'courier_slug'] = opts[:'courier_slug'] if !opts[:'courier_slug'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  # header parameters
  header_params = opts[:header_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = 'GetCourierConnectionsResponseData'

  new_options = opts.merge(
    :operation => :"CourierConnectionApi.get_courier_connections",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => return_type
  )

  data, _status_code, headers = @api_client.call_api(method, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CourierConnectionApi#get_courier_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end

  resp = Model::GetCourierConnectionsResponse.new
  resp.data = data
  resp.response_header = headers
  resp
end

#get_courier_connections_by_id(id:, opts: {}) ⇒ Model::GetCourierConnectionsByIdResponse

get_courier_connections_by_id Get courier connection results of a single courier connection.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 115

def get_courier_connections_by_id(id:, opts: {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CourierConnectionApi.get_courier_connections_by_id ...'
  end
  if id.nil? or id.to_s == ''
    raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty")
  end


  # resource path
  local_var_path = "/tracking/2025-07/courier-connections/#{id}"
  method = :'GET'

  # query parameters
  query_params = opts[:query_params] || {}
  # header parameters
  header_params = opts[:header_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = 'CourierConnection'

  new_options = opts.merge(
    :operation => :"CourierConnectionApi.get_courier_connections_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => return_type
  )

  data, _status_code, headers = @api_client.call_api(method, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CourierConnectionApi#get_courier_connections_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end

  resp = Model::GetCourierConnectionsByIdResponse.new
  resp.data = data
  resp.response_header = headers
  resp
end

#post_courier_connections(body:, opts: {}) ⇒ Model::PostCourierConnectionsResponse



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 69

def post_courier_connections(body:, opts: {})
  opts[:body] = body
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CourierConnectionApi.post_courier_connections ...'
  end


  # resource path
  local_var_path = "/tracking/2025-07/courier-connections"
  method = :'POST'

  # query parameters
  query_params = opts[:query_params] || {}
  # header parameters
  header_params = opts[:header_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = 'CourierConnection'

  new_options = opts.merge(
    :operation => :"CourierConnectionApi.post_courier_connections",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => return_type
  )

  data, _status_code, headers = @api_client.call_api(method, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CourierConnectionApi#post_courier_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end

  resp = Model::PostCourierConnectionsResponse.new
  resp.data = data
  resp.response_header = headers
  resp
end

#put_courier_connections_by_id(id:, body:, opts: {}) ⇒ Model::PutCourierConnectionsByIdResponse



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/aftership-tracking-sdk/api/courier_connection.rb', line 165

def put_courier_connections_by_id(id:, body:, opts: {})
  opts[:body] = body
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CourierConnectionApi.put_courier_connections_by_id ...'
  end
  if id.nil? or id.to_s == ''
    raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty")
  end


  # resource path
  local_var_path = "/tracking/2025-07/courier-connections/#{id}"
  method = :'PATCH'

  # query parameters
  query_params = opts[:query_params] || {}
  # header parameters
  header_params = opts[:header_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = 'CourierConnection'

  new_options = opts.merge(
    :operation => :"CourierConnectionApi.put_courier_connections_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :return_type => return_type
  )

  data, _status_code, headers = @api_client.call_api(method, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CourierConnectionApi#put_courier_connections_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end

  resp = Model::PutCourierConnectionsByIdResponse.new
  resp.data = data
  resp.response_header = headers
  resp
end