square.rb 3.20190814.0 → 3.20190925.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -2
  3. data/lib/square.rb +53 -52
  4. data/lib/square/api/apple_pay_api.rb +55 -55
  5. data/lib/square/api/base_api.rb +48 -45
  6. data/lib/square/api/catalog_api.rb +461 -461
  7. data/lib/square/api/checkout_api.rb +54 -54
  8. data/lib/square/api/customers_api.rb +335 -335
  9. data/lib/square/api/employees_api.rb +91 -91
  10. data/lib/square/api/inventory_api.rb +300 -300
  11. data/lib/square/api/labor_api.rb +558 -558
  12. data/lib/square/api/locations_api.rb +117 -45
  13. data/lib/square/api/merchants_api.rb +46 -0
  14. data/lib/square/api/mobile_authorization_api.rb +56 -56
  15. data/lib/square/api/o_auth_api.rb +168 -168
  16. data/lib/square/api/orders_api.rb +271 -269
  17. data/lib/square/api/payments_api.rb +282 -282
  18. data/lib/square/api/refunds_api.rb +149 -149
  19. data/lib/square/api/reporting_api.rb +145 -143
  20. data/lib/square/api/transactions_api.rb +379 -379
  21. data/lib/square/api/v1_employees_api.rb +720 -720
  22. data/lib/square/api/v1_items_api.rb +1651 -1651
  23. data/lib/square/api/v1_locations_api.rb +67 -67
  24. data/lib/square/api/v1_transactions_api.rb +574 -574
  25. data/lib/square/api_helper.rb +281 -281
  26. data/lib/square/client.rb +155 -139
  27. data/lib/square/configuration.rb +98 -88
  28. data/lib/square/exceptions/api_exception.rb +20 -20
  29. data/lib/square/http/api_response.rb +50 -50
  30. data/lib/square/http/auth/o_auth2.rb +17 -17
  31. data/lib/square/http/faraday_client.rb +64 -64
  32. data/lib/square/http/http_call_back.rb +24 -24
  33. data/lib/square/http/http_client.rb +104 -104
  34. data/lib/square/http/http_method_enum.rb +13 -13
  35. data/lib/square/http/http_request.rb +50 -50
  36. data/lib/square/http/http_response.rb +29 -29
  37. data/test/api/test_labor_api.rb +74 -0
  38. metadata +4 -3
  39. data/lib/square/api/v1_locations_api.rbe +0 -67
@@ -1,139 +1,155 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # square client class.
8
- class Client
9
- attr_reader :config
10
-
11
- # Access to mobile_authorization controller.
12
- # @return [MobileAuthorizationApi] Returns the controller instance.
13
- def mobile_authorization
14
- @mobile_authorization ||= MobileAuthorizationApi.new config
15
- end
16
-
17
- # Access to o_auth controller.
18
- # @return [OAuthApi] Returns the controller instance.
19
- def o_auth
20
- @o_auth ||= OAuthApi.new config
21
- end
22
-
23
- # Access to v1_locations controller.
24
- # @return [V1LocationsApi] Returns the controller instance.
25
- def v1_locations
26
- @v1_locations ||= V1LocationsApi.new config
27
- end
28
-
29
- # Access to v1_employees controller.
30
- # @return [V1EmployeesApi] Returns the controller instance.
31
- def v1_employees
32
- @v1_employees ||= V1EmployeesApi.new config
33
- end
34
-
35
- # Access to v1_transactions controller.
36
- # @return [V1TransactionsApi] Returns the controller instance.
37
- def v1_transactions
38
- @v1_transactions ||= V1TransactionsApi.new config
39
- end
40
-
41
- # Access to v1_items controller.
42
- # @return [V1ItemsApi] Returns the controller instance.
43
- def v1_items
44
- @v1_items ||= V1ItemsApi.new config
45
- end
46
-
47
- # Access to apple_pay controller.
48
- # @return [ApplePayApi] Returns the controller instance.
49
- def apple_pay
50
- @apple_pay ||= ApplePayApi.new config
51
- end
52
-
53
- # Access to catalog controller.
54
- # @return [CatalogApi] Returns the controller instance.
55
- def catalog
56
- @catalog ||= CatalogApi.new config
57
- end
58
-
59
- # Access to customers controller.
60
- # @return [CustomersApi] Returns the controller instance.
61
- def customers
62
- @customers ||= CustomersApi.new config
63
- end
64
-
65
- # Access to employees controller.
66
- # @return [EmployeesApi] Returns the controller instance.
67
- def employees
68
- @employees ||= EmployeesApi.new config
69
- end
70
-
71
- # Access to inventory controller.
72
- # @return [InventoryApi] Returns the controller instance.
73
- def inventory
74
- @inventory ||= InventoryApi.new config
75
- end
76
-
77
- # Access to labor controller.
78
- # @return [LaborApi] Returns the controller instance.
79
- def labor
80
- @labor ||= LaborApi.new config
81
- end
82
-
83
- # Access to locations controller.
84
- # @return [LocationsApi] Returns the controller instance.
85
- def locations
86
- @locations ||= LocationsApi.new config
87
- end
88
-
89
- # Access to reporting controller.
90
- # @return [ReportingApi] Returns the controller instance.
91
- def reporting
92
- @reporting ||= ReportingApi.new config
93
- end
94
-
95
- # Access to checkout controller.
96
- # @return [CheckoutApi] Returns the controller instance.
97
- def checkout
98
- @checkout ||= CheckoutApi.new config
99
- end
100
-
101
- # Access to orders controller.
102
- # @return [OrdersApi] Returns the controller instance.
103
- def orders
104
- @orders ||= OrdersApi.new config
105
- end
106
-
107
- # Access to transactions controller.
108
- # @return [TransactionsApi] Returns the controller instance.
109
- def transactions
110
- @transactions ||= TransactionsApi.new config
111
- end
112
-
113
- # Access to payments controller.
114
- # @return [PaymentsApi] Returns the controller instance.
115
- def payments
116
- @payments ||= PaymentsApi.new config
117
- end
118
-
119
- # Access to refunds controller.
120
- # @return [RefundsApi] Returns the controller instance.
121
- def refunds
122
- @refunds ||= RefundsApi.new config
123
- end
124
-
125
- def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
126
- backoff_factor: 1, environment: 'production',
127
- access_token: 'TODO: Replace', config: nil)
128
- @config = if config.nil?
129
- Configuration.new(timeout: timeout, max_retries: max_retries,
130
- retry_interval: retry_interval,
131
- backoff_factor: backoff_factor,
132
- environment: environment,
133
- access_token: access_token)
134
- else
135
- config
136
- end
137
- end
138
- end
139
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # square client class.
8
+ class Client
9
+ attr_reader :config
10
+
11
+ def sdk_version
12
+ '3.20190925.0'
13
+ end
14
+
15
+ def square_version
16
+ '2019-09-25'
17
+ end
18
+
19
+ # Access to mobile_authorization controller.
20
+ # @return [MobileAuthorizationApi] Returns the controller instance.
21
+ def mobile_authorization
22
+ @mobile_authorization ||= MobileAuthorizationApi.new config
23
+ end
24
+
25
+ # Access to o_auth controller.
26
+ # @return [OAuthApi] Returns the controller instance.
27
+ def o_auth
28
+ @o_auth ||= OAuthApi.new config
29
+ end
30
+
31
+ # Access to v1_locations controller.
32
+ # @return [V1LocationsApi] Returns the controller instance.
33
+ def v1_locations
34
+ @v1_locations ||= V1LocationsApi.new config
35
+ end
36
+
37
+ # Access to v1_employees controller.
38
+ # @return [V1EmployeesApi] Returns the controller instance.
39
+ def v1_employees
40
+ @v1_employees ||= V1EmployeesApi.new config
41
+ end
42
+
43
+ # Access to v1_transactions controller.
44
+ # @return [V1TransactionsApi] Returns the controller instance.
45
+ def v1_transactions
46
+ @v1_transactions ||= V1TransactionsApi.new config
47
+ end
48
+
49
+ # Access to v1_items controller.
50
+ # @return [V1ItemsApi] Returns the controller instance.
51
+ def v1_items
52
+ @v1_items ||= V1ItemsApi.new config
53
+ end
54
+
55
+ # Access to apple_pay controller.
56
+ # @return [ApplePayApi] Returns the controller instance.
57
+ def apple_pay
58
+ @apple_pay ||= ApplePayApi.new config
59
+ end
60
+
61
+ # Access to catalog controller.
62
+ # @return [CatalogApi] Returns the controller instance.
63
+ def catalog
64
+ @catalog ||= CatalogApi.new config
65
+ end
66
+
67
+ # Access to customers controller.
68
+ # @return [CustomersApi] Returns the controller instance.
69
+ def customers
70
+ @customers ||= CustomersApi.new config
71
+ end
72
+
73
+ # Access to employees controller.
74
+ # @return [EmployeesApi] Returns the controller instance.
75
+ def employees
76
+ @employees ||= EmployeesApi.new config
77
+ end
78
+
79
+ # Access to inventory controller.
80
+ # @return [InventoryApi] Returns the controller instance.
81
+ def inventory
82
+ @inventory ||= InventoryApi.new config
83
+ end
84
+
85
+ # Access to labor controller.
86
+ # @return [LaborApi] Returns the controller instance.
87
+ def labor
88
+ @labor ||= LaborApi.new config
89
+ end
90
+
91
+ # Access to locations controller.
92
+ # @return [LocationsApi] Returns the controller instance.
93
+ def locations
94
+ @locations ||= LocationsApi.new config
95
+ end
96
+
97
+ # Access to reporting controller.
98
+ # @return [ReportingApi] Returns the controller instance.
99
+ def reporting
100
+ @reporting ||= ReportingApi.new config
101
+ end
102
+
103
+ # Access to checkout controller.
104
+ # @return [CheckoutApi] Returns the controller instance.
105
+ def checkout
106
+ @checkout ||= CheckoutApi.new config
107
+ end
108
+
109
+ # Access to orders controller.
110
+ # @return [OrdersApi] Returns the controller instance.
111
+ def orders
112
+ @orders ||= OrdersApi.new config
113
+ end
114
+
115
+ # Access to transactions controller.
116
+ # @return [TransactionsApi] Returns the controller instance.
117
+ def transactions
118
+ @transactions ||= TransactionsApi.new config
119
+ end
120
+
121
+ # Access to merchants controller.
122
+ # @return [MerchantsApi] Returns the controller instance.
123
+ def merchants
124
+ @merchants ||= MerchantsApi.new config
125
+ end
126
+
127
+ # Access to payments controller.
128
+ # @return [PaymentsApi] Returns the controller instance.
129
+ def payments
130
+ @payments ||= PaymentsApi.new config
131
+ end
132
+
133
+ # Access to refunds controller.
134
+ # @return [RefundsApi] Returns the controller instance.
135
+ def refunds
136
+ @refunds ||= RefundsApi.new config
137
+ end
138
+
139
+ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
140
+ backoff_factor: 1, environment: 'production',
141
+ access_token: 'TODO: Replace', additional_headers: {},
142
+ config: nil)
143
+ @config = if config.nil?
144
+ Configuration.new(timeout: timeout, max_retries: max_retries,
145
+ retry_interval: retry_interval,
146
+ backoff_factor: backoff_factor,
147
+ environment: environment,
148
+ access_token: access_token,
149
+ additional_headers: additional_headers)
150
+ else
151
+ config
152
+ end
153
+ end
154
+ end
155
+ end
@@ -1,88 +1,98 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # All configuration including auth info and base URI for the API access
8
- # are configured in this class.
9
- class Configuration
10
- # The attribute readers for properties.
11
- attr_reader :http_client
12
- attr_reader :timeout
13
- attr_reader :max_retries
14
- attr_reader :retry_interval
15
- attr_reader :backoff_factor
16
- attr_reader :environment
17
- attr_reader :access_token
18
-
19
- class << self
20
- attr_reader :environments
21
- end
22
-
23
- def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
24
- backoff_factor: 1, environment: 'production',
25
- access_token: 'TODO: Replace')
26
- # The value to use for connection timeout
27
- @timeout = timeout
28
-
29
- # The number of times to retry an endpoint call if it fails
30
- @max_retries = max_retries
31
-
32
- # Pause in seconds between retries
33
- @retry_interval = retry_interval
34
-
35
- # The amount to multiply each successive retry's interval amount
36
- # by in order to provide backoff
37
- @backoff_factor = backoff_factor
38
-
39
- # Current API environment
40
- @environment = environment
41
-
42
- # OAuth 2.0 Access Token
43
- @access_token = access_token
44
-
45
- # The Http Client to use for making requests.
46
- @http_client = create_http_client
47
- end
48
-
49
- def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
50
- backoff_factor: nil, environment: nil, access_token: nil)
51
- timeout ||= self.timeout
52
- max_retries ||= self.max_retries
53
- retry_interval ||= self.retry_interval
54
- backoff_factor ||= self.backoff_factor
55
- environment ||= self.environment
56
- access_token ||= self.access_token
57
-
58
- Configuration.new(timeout: timeout, max_retries: max_retries,
59
- retry_interval: retry_interval,
60
- backoff_factor: backoff_factor,
61
- environment: environment, access_token: access_token)
62
- end
63
-
64
- def create_http_client
65
- FaradayClient.new(timeout: timeout, max_retries: max_retries,
66
- retry_interval: retry_interval,
67
- backoff_factor: backoff_factor)
68
- end
69
-
70
- # All the environments the SDK can run in.
71
- @environments = {
72
- 'production' => {
73
- 'default' => 'https://connect.squareup.com'
74
- },
75
- 'sandbox' => {
76
- 'default' => 'https://connect.squareupsandbox.com'
77
- }
78
- }
79
-
80
- # Generates the appropriate base URI for the environment and the server.
81
- # @param [Configuration::Server] The server enum for which the base URI is
82
- # required.
83
- # @return [String] The base URI.
84
- def get_base_uri(server = 'default')
85
- self.class.environments[environment][server].clone
86
- end
87
- end
88
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # All configuration including auth info and base URI for the API access
8
+ # are configured in this class.
9
+ class Configuration
10
+ # The attribute readers for properties.
11
+ attr_reader :http_client
12
+ attr_reader :timeout
13
+ attr_reader :max_retries
14
+ attr_reader :retry_interval
15
+ attr_reader :backoff_factor
16
+ attr_reader :environment
17
+ attr_reader :access_token
18
+
19
+ def additional_headers
20
+ @additional_headers.clone
21
+ end
22
+
23
+ class << self
24
+ attr_reader :environments
25
+ end
26
+
27
+ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
28
+ backoff_factor: 1, environment: 'production',
29
+ access_token: 'TODO: Replace', additional_headers: {})
30
+ # The value to use for connection timeout
31
+ @timeout = timeout
32
+
33
+ # The number of times to retry an endpoint call if it fails
34
+ @max_retries = max_retries
35
+
36
+ # Pause in seconds between retries
37
+ @retry_interval = retry_interval
38
+
39
+ # The amount to multiply each successive retry's interval amount
40
+ # by in order to provide backoff
41
+ @backoff_factor = backoff_factor
42
+
43
+ # Current API environment
44
+ @environment = environment
45
+
46
+ # OAuth 2.0 Access Token
47
+ @access_token = access_token
48
+
49
+ # Additional headers to add to each API request
50
+ @additional_headers = additional_headers.clone
51
+
52
+ # The Http Client to use for making requests.
53
+ @http_client = create_http_client
54
+ end
55
+
56
+ def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
57
+ backoff_factor: nil, environment: nil, access_token: nil,
58
+ additional_headers: nil)
59
+ timeout ||= self.timeout
60
+ max_retries ||= self.max_retries
61
+ retry_interval ||= self.retry_interval
62
+ backoff_factor ||= self.backoff_factor
63
+ environment ||= self.environment
64
+ access_token ||= self.access_token
65
+ additional_headers ||= self.additional_headers
66
+
67
+ Configuration.new(timeout: timeout, max_retries: max_retries,
68
+ retry_interval: retry_interval,
69
+ backoff_factor: backoff_factor,
70
+ environment: environment, access_token: access_token,
71
+ additional_headers: additional_headers)
72
+ end
73
+
74
+ def create_http_client
75
+ FaradayClient.new(timeout: timeout, max_retries: max_retries,
76
+ retry_interval: retry_interval,
77
+ backoff_factor: backoff_factor)
78
+ end
79
+
80
+ # All the environments the SDK can run in.
81
+ @environments = {
82
+ 'production' => {
83
+ 'default' => 'https://connect.squareup.com'
84
+ },
85
+ 'sandbox' => {
86
+ 'default' => 'https://connect.squareupsandbox.com'
87
+ }
88
+ }
89
+
90
+ # Generates the appropriate base URI for the environment and the server.
91
+ # @param [Configuration::Server] The server enum for which the base URI is
92
+ # required.
93
+ # @return [String] The base URI.
94
+ def get_base_uri(server = 'default')
95
+ self.class.environments[environment][server].clone
96
+ end
97
+ end
98
+ end