Class: NewStoreApi::BookingsController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/bookings_controller.rb

Overview

BookingsController

Constant Summary

Constants inherited from BaseController

NewStoreApi::BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_booking_cancelation(booking_id) ⇒ Object

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
description here

Parameters:

  • booking_id (UUID | String)

    Required parameter: TODO: type

Returns:

  • (Object)

    Response from the API call.



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/new_store_api/controllers/bookings_controller.rb', line 76

def create_booking_cancelation(booking_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fulfillment/bookings/{booking_id}/cancelations',
                                 Server::API)
               .template_param(new_parameter(booking_id, key: 'booking_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize)))
    .execute
end

#create_booking_status_webhook(adapter, x_newstore_tenant, body, x_hmac_signature: nil) ⇒ Object

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
here description here CreatePackageTrackingEasypostAdapter] body Required parameter: TODO: type description here Signature, only used by Easypost webhooks if configured.

Parameters:

  • adapter (AdapterEnum)

    Required parameter: TODO: type description

  • x_newstore_tenant (String)

    Required parameter: TODO: type

  • CreatePackageTrackingCustomAdapter (CreatePackageTrackingCustomAdapter |)

    |

  • x_hmac_signature (String) (defaults to: nil)

    Optional parameter: An optional HMAC

Returns:

  • (Object)

    Response from the API call.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/new_store_api/controllers/bookings_controller.rb', line 109

def create_booking_status_webhook(adapter,
                                  x_newstore_tenant,
                                  body,
                                  x_hmac_signature: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fulfillment/bookings/webhooks/{adapter}/status',
                                 Server::API)
               .template_param(new_parameter(adapter, key: 'adapter')
                                .should_encode(true))
               .header_param(new_parameter(x_newstore_tenant, key: 'x-newstore-tenant'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .validator(proc do |value|
                              UnionTypeLookUp.get(:CreateBookingStatusWebhookBody)
                                             .validate(value)
                            end))
               .header_param(new_parameter(x_hmac_signature, key: 'x-hmac-signature'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize)))
    .execute
end

#create_bookings(body) ⇒ ResponseCreateBookings

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
description here

Parameters:

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/new_store_api/controllers/bookings_controller.rb', line 21

def create_bookings(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fulfillment/bookings',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResponseCreateBookings.method(:from_hash)))
    .execute
end

#show_booking(booking_id) ⇒ ResponseShowBookings

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
description here

Parameters:

  • booking_id (UUID | String)

    Required parameter: TODO: type

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/new_store_api/controllers/bookings_controller.rb', line 49

def show_booking(booking_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/fulfillment/bookings/{booking_id}',
                                 Server::API)
               .template_param(new_parameter(booking_id, key: 'booking_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResponseShowBookings.method(:from_hash)))
    .execute
end