square.rb 5.3.0.20200528 → 6.4.0.20200923

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +317 -285
  3. data/lib/square.rb +4 -2
  4. data/lib/square/api/base_api.rb +2 -2
  5. data/lib/square/api/catalog_api.rb +76 -57
  6. data/lib/square/api/disputes_api.rb +3 -26
  7. data/lib/square/api/employees_api.rb +3 -2
  8. data/lib/square/api/inventory_api.rb +5 -4
  9. data/lib/square/api/invoices_api.rb +343 -0
  10. data/lib/square/api/labor_api.rb +77 -0
  11. data/lib/square/api/locations_api.rb +7 -2
  12. data/lib/square/api/merchants_api.rb +2 -1
  13. data/lib/square/api/orders_api.rb +59 -85
  14. data/lib/square/api/payments_api.rb +15 -24
  15. data/lib/square/api/refunds_api.rb +12 -7
  16. data/lib/square/api/subscriptions_api.rb +251 -0
  17. data/lib/square/api/team_api.rb +326 -0
  18. data/lib/square/api/transactions_api.rb +0 -71
  19. data/lib/square/api/v1_employees_api.rb +3 -76
  20. data/lib/square/api/v1_items_api.rb +0 -360
  21. data/lib/square/api/v1_locations_api.rb +0 -18
  22. data/lib/square/api/v1_transactions_api.rb +1 -19
  23. data/lib/square/client.rb +29 -16
  24. data/lib/square/configuration.rb +12 -4
  25. data/test/api/api_test_base.rb +1 -6
  26. data/test/api/test_catalog_api.rb +1 -4
  27. data/test/api/test_customers_api.rb +1 -4
  28. data/test/api/test_employees_api.rb +1 -4
  29. data/test/api/test_labor_api.rb +2 -6
  30. data/test/api/test_locations_api.rb +21 -32
  31. data/test/api/test_merchants_api.rb +1 -4
  32. data/test/api/test_payments_api.rb +3 -6
  33. data/test/api/test_refunds_api.rb +3 -6
  34. data/test/http_response_catcher.rb +0 -5
  35. data/test/test_helper.rb +0 -5
  36. metadata +33 -13
  37. data/lib/square/api/reporting_api.rb +0 -138
@@ -1,138 +0,0 @@
1
- module Square
2
- # ReportingApi
3
- class ReportingApi < BaseApi
4
- def initialize(config, http_call_back: nil)
5
- super(config, http_call_back: http_call_back)
6
- end
7
-
8
- # Returns a list of refunded transactions (across all possible originating
9
- # locations) relating to monies
10
- # credited to the provided location ID by another Square account using the
11
- # `additional_recipients` field in a transaction.
12
- # Max results per [page](#paginatingresults): 50
13
- # @param [String] location_id Required parameter: The ID of the location to
14
- # list AdditionalRecipientReceivableRefunds for.
15
- # @param [String] begin_time Optional parameter: The beginning of the
16
- # requested reporting period, in RFC 3339 format. See [Date
17
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
18
- # value: The current time minus one year.
19
- # @param [String] end_time Optional parameter: The end of the requested
20
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
21
- # details on date inclusivity/exclusivity. Default value: The current
22
- # time.
23
- # @param [SortOrder] sort_order Optional parameter: The order in which
24
- # results are listed in the response (`ASC` for oldest first, `DESC` for
25
- # newest first). Default value: `DESC`
26
- # @param [String] cursor Optional parameter: A pagination cursor returned by
27
- # a previous call to this endpoint. Provide this to retrieve the next set of
28
- # results for your original query. See [Paginating
29
- # results](#paginatingresults) for more information.
30
- # @return [ListAdditionalRecipientReceivableRefundsResponse Hash] response from the API call
31
- def list_additional_recipient_receivable_refunds(location_id:,
32
- begin_time: nil,
33
- end_time: nil,
34
- sort_order: nil,
35
- cursor: nil)
36
- warn 'Endpoint list_additional_recipient_receivable_refunds in Reporting'\
37
- 'Api is deprecated'
38
- # Prepare query url.
39
- _query_builder = config.get_base_uri
40
- _query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
41
- _query_builder = APIHelper.append_url_with_template_parameters(
42
- _query_builder,
43
- 'location_id' => location_id
44
- )
45
- _query_builder = APIHelper.append_url_with_query_parameters(
46
- _query_builder,
47
- 'begin_time' => begin_time,
48
- 'end_time' => end_time,
49
- 'sort_order' => sort_order,
50
- 'cursor' => cursor
51
- )
52
- _query_url = APIHelper.clean_url _query_builder
53
-
54
- # Prepare headers.
55
- _headers = {
56
- 'accept' => 'application/json'
57
- }
58
-
59
- # Prepare and execute HttpRequest.
60
- _request = config.http_client.get(
61
- _query_url,
62
- headers: _headers
63
- )
64
- OAuth2.apply(config, _request)
65
- _response = execute_request(_request)
66
-
67
- # Return appropriate response type.
68
- decoded = APIHelper.json_deserialize(_response.raw_body)
69
- _errors = APIHelper.map_response(decoded, ['errors'])
70
- ApiResponse.new(_response, data: decoded, errors: _errors)
71
- end
72
-
73
- # Returns a list of receivables (across all possible sending locations)
74
- # representing monies credited
75
- # to the provided location ID by another Square account using the
76
- # `additional_recipients` field in a transaction.
77
- # Max results per [page](#paginatingresults): 50
78
- # @param [String] location_id Required parameter: The ID of the location to
79
- # list AdditionalRecipientReceivables for.
80
- # @param [String] begin_time Optional parameter: The beginning of the
81
- # requested reporting period, in RFC 3339 format. See [Date
82
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
83
- # value: The current time minus one year.
84
- # @param [String] end_time Optional parameter: The end of the requested
85
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
86
- # details on date inclusivity/exclusivity. Default value: The current
87
- # time.
88
- # @param [SortOrder] sort_order Optional parameter: The order in which
89
- # results are listed in the response (`ASC` for oldest first, `DESC` for
90
- # newest first). Default value: `DESC`
91
- # @param [String] cursor Optional parameter: A pagination cursor returned by
92
- # a previous call to this endpoint. Provide this to retrieve the next set of
93
- # results for your original query. See [Paginating
94
- # results](#paginatingresults) for more information.
95
- # @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
96
- def list_additional_recipient_receivables(location_id:,
97
- begin_time: nil,
98
- end_time: nil,
99
- sort_order: nil,
100
- cursor: nil)
101
- warn 'Endpoint list_additional_recipient_receivables in ReportingApi is '\
102
- 'deprecated'
103
- # Prepare query url.
104
- _query_builder = config.get_base_uri
105
- _query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
106
- _query_builder = APIHelper.append_url_with_template_parameters(
107
- _query_builder,
108
- 'location_id' => location_id
109
- )
110
- _query_builder = APIHelper.append_url_with_query_parameters(
111
- _query_builder,
112
- 'begin_time' => begin_time,
113
- 'end_time' => end_time,
114
- 'sort_order' => sort_order,
115
- 'cursor' => cursor
116
- )
117
- _query_url = APIHelper.clean_url _query_builder
118
-
119
- # Prepare headers.
120
- _headers = {
121
- 'accept' => 'application/json'
122
- }
123
-
124
- # Prepare and execute HttpRequest.
125
- _request = config.http_client.get(
126
- _query_url,
127
- headers: _headers
128
- )
129
- OAuth2.apply(config, _request)
130
- _response = execute_request(_request)
131
-
132
- # Return appropriate response type.
133
- decoded = APIHelper.json_deserialize(_response.raw_body)
134
- _errors = APIHelper.map_response(decoded, ['errors'])
135
- ApiResponse.new(_response, data: decoded, errors: _errors)
136
- end
137
- end
138
- end