Class: Peddler::API::ServicesV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/api/services_v1.rb

Overview

Selling Partner API for Services

With the Services API, you can build applications that help service providers get and modify their service orders and manage their resources.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #endpoint_uri, #http, #initialize, #meter, #must_sandbox!, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#add_appointment_for_service_job_by_service_job_id(service_job_id, body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Adds an appointment to the service job indicated by the service job identifier specified.

Parameters:

  • service_job_id (String)

    An Amazon defined service job identifier.

  • body (Hash)

    Add appointment operation input details.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



128
129
130
131
132
# File 'lib/peddler/api/services_v1.rb', line 128

def add_appointment_for_service_job_by_service_job_id(service_job_id, body, rate_limit: 5.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments"

  meter(rate_limit).post(path, body:)
end

#assign_appointment_resources(service_job_id, appointment_id, body, rate_limit: 1.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Assigns new resource(s) or overwrite/update the existing one(s) to a service job appointment.

Parameters:

  • service_job_id (String)

    An Amazon-defined service job identifier. Get this value by calling the ‘getServiceJobs` operation of the Services API.

  • appointment_id (String)

    An Amazon-defined identifier of active service job appointment.

  • body (Hash)
  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:

  • (Hash)

    The API response



158
159
160
161
162
# File 'lib/peddler/api/services_v1.rb', line 158

def assign_appointment_resources(service_job_id, appointment_id, body, rate_limit: 1.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/resources"

  meter(rate_limit).put(path, body:)
end

#cancel_reservation(reservation_id, marketplace_ids, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Cancel a reservation.

Parameters:

  • reservation_id (String)

    Reservation Identifier

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



274
275
276
277
278
279
280
281
# File 'lib/peddler/api/services_v1.rb', line 274

def cancel_reservation(reservation_id, marketplace_ids, rate_limit: 5.0)
  path = "/service/v1/reservation/#{reservation_id}"
  params = {
    "marketplaceIds" => marketplace_ids,
  }.compact

  meter(rate_limit).delete(path, params:)
end

#cancel_service_job_by_service_job_id(service_job_id, cancellation_reason_code, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Cancels the service job indicated by the service job identifier specified.

Parameters:

  • service_job_id (String)

    An Amazon defined service job identifier.

  • cancellation_reason_code (String)

    A cancel reason code that specifies the reason for cancelling a service job.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



38
39
40
41
42
43
44
45
# File 'lib/peddler/api/services_v1.rb', line 38

def cancel_service_job_by_service_job_id(service_job_id, cancellation_reason_code, rate_limit: 5.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/cancellations"
  params = {
    "cancellationReasonCode" => cancellation_reason_code,
  }.compact

  meter(rate_limit).put(path, params:)
end

#complete_service_job_by_service_job_id(service_job_id, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Completes the service job indicated by the service job identifier specified.

Parameters:

  • service_job_id (String)

    An Amazon defined service job identifier.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



53
54
55
56
57
# File 'lib/peddler/api/services_v1.rb', line 53

def complete_service_job_by_service_job_id(service_job_id, rate_limit: 5.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/completions"

  meter(rate_limit).put(path)
end

#create_reservation(body, marketplace_ids, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Create a reservation.

Parameters:

  • body (Hash)

    Reservation details

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



241
242
243
244
245
246
247
248
# File 'lib/peddler/api/services_v1.rb', line 241

def create_reservation(body, marketplace_ids, rate_limit: 5.0)
  path = "/service/v1/reservation"
  params = {
    "marketplaceIds" => marketplace_ids,
  }.compact

  meter(rate_limit).post(path, body:, params:)
end

#create_service_document_upload_destination(body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Creates an upload destination.

Parameters:

  • body (Hash)

    Upload document operation input details.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



341
342
343
344
345
# File 'lib/peddler/api/services_v1.rb', line 341

def create_service_document_upload_destination(body, rate_limit: 5.0)
  path = "/service/v1/documents"

  meter(rate_limit).post(path, body:)
end

#get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_time: nil, rate_limit: 20.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Gets appointment slots as per the service context specified.

Parameters:

  • asin (String)

    ASIN associated with the service.

  • store_id (String)

    Store identifier defining the region scope to retrive appointment slots.

  • marketplace_ids (Array<String>)

    An identifier for the marketplace for which appointment slots are queried

  • start_time (String) (defaults to: nil)

    A time from which the appointment slots will be retrieved. The specified time must be in ISO 8601 format. If ‘startTime` is provided, `endTime` should also be provided. Default value is as per business configuration.

  • end_time (String) (defaults to: nil)

    A time up to which the appointment slots will be retrieved. The specified time must be in ISO 8601 format. If ‘endTime` is provided, `startTime` should also be provided. Default value is as per business configuration. Maximum range of appointment slots can be 90 days.

  • rate_limit (Float) (defaults to: 20.0)

    Requests per second

Returns:

  • (Hash)

    The API response



322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/peddler/api/services_v1.rb', line 322

def get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_time: nil, rate_limit: 20.0)
  path = "/service/v1/appointmentSlots"
  params = {
    "asin" => asin,
    "storeId" => store_id,
    "marketplaceIds" => marketplace_ids,
    "startTime" => start_time,
    "endTime" => end_time,
  }.compact

  meter(rate_limit).get(path, params:)
end

#get_appointmment_slots_by_job_id(service_job_id, marketplace_ids, start_time: nil, end_time: nil, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Gets appointment slots for the service associated with the service job id specified.

Parameters:

  • service_job_id (String)

    A service job identifier to retrive appointment slots for associated service.

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • start_time (String) (defaults to: nil)

    A time from which the appointment slots will be retrieved. The specified time must be in ISO 8601 format. If ‘startTime` is provided, `endTime` should also be provided. Default value is as per business configuration.

  • end_time (String) (defaults to: nil)

    A time up to which the appointment slots will be retrieved. The specified time must be in ISO 8601 format. If ‘endTime` is provided, `startTime` should also be provided. Default value is as per business configuration. Maximum range of appointment slots can be 90 days.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



296
297
298
299
300
301
302
303
304
305
306
# File 'lib/peddler/api/services_v1.rb', line 296

def get_appointmment_slots_by_job_id(service_job_id, marketplace_ids, start_time: nil, end_time: nil,
  rate_limit: 5.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/appointmentSlots"
  params = {
    "marketplaceIds" => marketplace_ids,
    "startTime" => start_time,
    "endTime" => end_time,
  }.compact

  meter(rate_limit).get(path, params:)
end

#get_fixed_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Provides capacity in fixed-size slots.

Parameters:

  • resource_id (String)

    Resource Identifier.

  • body (Hash)

    Request body.

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • next_page_token (String) (defaults to: nil)

    Next page token returned in the response of your previous request.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



207
208
209
210
211
212
213
214
215
# File 'lib/peddler/api/services_v1.rb', line 207

def get_fixed_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0)
  path = "/service/v1/serviceResources/#{resource_id}/capacity/fixed"
  params = {
    "marketplaceIds" => marketplace_ids,
    "nextPageToken" => next_page_token,
  }.compact

  meter(rate_limit).post(path, body:, params:)
end

#get_range_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Provides capacity slots in a format similar to availability records.

Parameters:

  • resource_id (String)

    Resource Identifier.

  • body (Hash)

    Request body.

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • next_page_token (String) (defaults to: nil)

    Next page token returned in the response of your previous request.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



188
189
190
191
192
193
194
195
196
# File 'lib/peddler/api/services_v1.rb', line 188

def get_range_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0)
  path = "/service/v1/serviceResources/#{resource_id}/capacity/range"
  params = {
    "marketplaceIds" => marketplace_ids,
    "nextPageToken" => next_page_token,
  }.compact

  meter(rate_limit).post(path, body:, params:)
end

#get_service_job_by_service_job_id(service_job_id, rate_limit: 20.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Gets details of service job indicated by the provided ‘serviceJobID`.

Parameters:

  • service_job_id (String)

    A service job identifier.

  • rate_limit (Float) (defaults to: 20.0)

    Requests per second

Returns:

  • (Hash)

    The API response



24
25
26
27
28
# File 'lib/peddler/api/services_v1.rb', line 24

def get_service_job_by_service_job_id(service_job_id, rate_limit: 20.0)
  path = "/service/v1/serviceJobs/#{service_job_id}"

  meter(rate_limit).get(path)
end

#get_service_jobs(marketplace_ids, service_order_ids: nil, service_job_status: nil, page_token: nil, page_size: 20, sort_field: nil, sort_order: nil, created_after: nil, created_before: nil, last_updated_after: nil, last_updated_before: nil, schedule_start_date: nil, schedule_end_date: nil, asins: nil, required_skills: nil, store_ids: nil, rate_limit: 10.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Gets service job details for the specified filter query.

Parameters:

  • service_order_ids (Array<String>) (defaults to: nil)

    List of service order ids for the query you want to perform.Max values supported 20.

  • service_job_status (Array<String>) (defaults to: nil)

    A list of one or more job status by which to filter the list of jobs.

  • page_token (String) (defaults to: nil)

    String returned in the response of your previous request.

  • page_size (Integer) (defaults to: 20)

    A non-negative integer that indicates the maximum number of jobs to return in the list, Value must be 1 - 20. Default 20.

  • sort_field (String) (defaults to: nil)

    Sort fields on which you want to sort the output.

  • sort_order (String) (defaults to: nil)

    Sort order for the query you want to perform.

  • created_after (String) (defaults to: nil)

    A date used for selecting jobs created at or after a specified time. Must be in ISO 8601 format. Required if ‘LastUpdatedAfter` is not specified. Specifying both `CreatedAfter` and `LastUpdatedAfter` returns an error.

  • created_before (String) (defaults to: nil)

    A date used for selecting jobs created at or before a specified time. Must be in ISO 8601 format.

  • last_updated_after (String) (defaults to: nil)

    A date used for selecting jobs updated at or after a specified time. Must be in ISO 8601 format. Required if ‘createdAfter` is not specified. Specifying both `CreatedAfter` and `LastUpdatedAfter` returns an error.

  • last_updated_before (String) (defaults to: nil)

    A date used for selecting jobs updated at or before a specified time. Must be in ISO 8601 format.

  • schedule_start_date (String) (defaults to: nil)

    A date used for filtering jobs schedules at or after a specified time. Must be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.

  • schedule_end_date (String) (defaults to: nil)

    A date used for filtering jobs schedules at or before a specified time. Must be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.

  • marketplace_ids (Array<String>)

    Used to select jobs that were placed in the specified marketplaces.

  • asins (Array<String>) (defaults to: nil)

    List of Amazon Standard Identification Numbers (ASIN) of the items. Max values supported is 20.

  • required_skills (Array<String>) (defaults to: nil)

    A defined set of related knowledge, skills, experience, tools, materials, and work processes common to service delivery for a set of products and/or service scenarios. Max values supported is 20.

  • store_ids (Array<String>) (defaults to: nil)

    List of Amazon-defined identifiers for the region scope. Max values supported is 50.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:

  • (Hash)

    The API response



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/peddler/api/services_v1.rb', line 94

def get_service_jobs(marketplace_ids, service_order_ids: nil, service_job_status: nil, page_token: nil,
  page_size: 20, sort_field: nil, sort_order: nil, created_after: nil, created_before: nil,
  last_updated_after: nil, last_updated_before: nil, schedule_start_date: nil, schedule_end_date: nil, asins: nil,
  required_skills: nil, store_ids: nil, rate_limit: 10.0)
  path = "/service/v1/serviceJobs"
  params = {
    "serviceOrderIds" => service_order_ids,
    "serviceJobStatus" => service_job_status,
    "pageToken" => page_token,
    "pageSize" => page_size,
    "sortField" => sort_field,
    "sortOrder" => sort_order,
    "createdAfter" => created_after,
    "createdBefore" => created_before,
    "lastUpdatedAfter" => last_updated_after,
    "lastUpdatedBefore" => last_updated_before,
    "scheduleStartDate" => schedule_start_date,
    "scheduleEndDate" => schedule_end_date,
    "marketplaceIds" => marketplace_ids,
    "asins" => asins,
    "requiredSkills" => required_skills,
    "storeIds" => store_ids,
  }.compact

  meter(rate_limit).get(path, params:)
end

#reschedule_appointment_for_service_job_by_service_job_id(service_job_id, appointment_id, body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Reschedules an appointment for the service job indicated by the service job identifier specified.

Parameters:

  • service_job_id (String)

    An Amazon defined service job identifier.

  • appointment_id (String)

    An existing appointment identifier for the Service Job.

  • body (Hash)

    Reschedule appointment operation input details.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



142
143
144
145
146
147
# File 'lib/peddler/api/services_v1.rb', line 142

def reschedule_appointment_for_service_job_by_service_job_id(service_job_id, appointment_id, body,
  rate_limit: 5.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}"

  meter(rate_limit).post(path, body:)
end

#set_appointment_fulfillment_data(service_job_id, appointment_id, body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Updates the appointment fulfillment data related to a given ‘jobID` and `appointmentID`.

Parameters:

  • service_job_id (String)

    An Amazon-defined service job identifier. Get this value by calling the ‘getServiceJobs` operation of the Services API.

  • appointment_id (String)

    An Amazon-defined identifier of active service job appointment.

  • body (Hash)

    Appointment fulfillment data collection details.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



173
174
175
176
177
# File 'lib/peddler/api/services_v1.rb', line 173

def set_appointment_fulfillment_data(service_job_id, appointment_id, body, rate_limit: 5.0)
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/fulfillment"

  meter(rate_limit).put(path, body:)
end

#update_reservation(reservation_id, body, marketplace_ids, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Update a reservation.

Parameters:

  • reservation_id (String)

    Reservation Identifier

  • body (Hash)

    Reservation details

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



258
259
260
261
262
263
264
265
# File 'lib/peddler/api/services_v1.rb', line 258

def update_reservation(reservation_id, body, marketplace_ids, rate_limit: 5.0)
  path = "/service/v1/reservation/#{reservation_id}"
  params = {
    "marketplaceIds" => marketplace_ids,
  }.compact

  meter(rate_limit).put(path, body:, params:)
end

#update_schedule(resource_id, body, marketplace_ids, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Update the schedule of the given resource.

Parameters:

  • resource_id (String)

    Resource (store) Identifier

  • body (Hash)

    Schedule details

  • marketplace_ids (Array<String>)

    An identifier for the marketplace in which the resource operates.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



225
226
227
228
229
230
231
232
# File 'lib/peddler/api/services_v1.rb', line 225

def update_schedule(resource_id, body, marketplace_ids, rate_limit: 5.0)
  path = "/service/v1/serviceResources/#{resource_id}/schedules"
  params = {
    "marketplaceIds" => marketplace_ids,
  }.compact

  meter(rate_limit).put(path, body:, params:)
end