Class: Square::V1TransactionsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/v1_transactions_api.rb

Overview

V1TransactionsApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

Instance Method Details

#v1_list_orders(location_id:, order: nil, limit: nil, batch_token: nil) ⇒ Array[V1Order] Hash

Provides summary information for a merchant’s online store orders. list online store orders for. are listed in the response. to return in a single response. This value cannot exceed 200. retrieve the next set of results for your original query to the endpoint.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which payments

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of payments

  • batch_token (String) (defaults to: nil)

    Optional parameter: A pagination cursor to

Returns:

  • (Array[V1Order] Hash)

    response from the API call



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/square/api/v1_transactions_api.rb', line 15

def v1_list_orders(location_id:,
                   order: nil,
                   limit: nil,
                   batch_token: nil)
  warn 'Endpoint v1_list_orders in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/orders',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .query_param(new_parameter(order, key: 'order'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(batch_token, key: 'batch_token'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create))
               .is_response_array(true))
    .execute
end

#v1_retrieve_order(location_id:, order_id:) ⇒ V1Order Hash

Provides comprehensive information for a single online store order, including the order’s history. associated location. You obtain this value from Order objects returned by the List Orders endpoint

Parameters:

  • location_id (String)

    Required parameter: The ID of the order’s

  • order_id (String)

    Required parameter: The order’s Square-issued ID.

Returns:

  • (V1Order Hash)

    response from the API call



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/square/api/v1_transactions_api.rb', line 47

def v1_retrieve_order(location_id:,
                      order_id:)
  warn 'Endpoint v1_retrieve_order in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/orders/{order_id}',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .template_param(new_parameter(order_id, key: 'order_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#v1_update_order(location_id:, order_id:, body:) ⇒ V1Order Hash

Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: associated location. You obtain this value from Order objects returned by the List Orders endpoint containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • location_id (String)

    Required parameter: The ID of the order’s

  • order_id (String)

    Required parameter: The order’s Square-issued ID.

  • body (V1UpdateOrderRequest)

    Required parameter: An object

Returns:

  • (V1Order Hash)

    response from the API call



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/square/api/v1_transactions_api.rb', line 78

def v1_update_order(location_id:,
                    order_id:,
                    body:)
  warn 'Endpoint v1_update_order in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/v1/{location_id}/orders/{order_id}',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .template_param(new_parameter(order_id, key: 'order_id')
                                .should_encode(true))
               .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('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end