levelup 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +32 -305
  3. data/Gemfile.lock +1 -1
  4. data/README.md +131 -38
  5. data/levelup.gemspec +1 -1
  6. data/lib/levelup.rb +4 -0
  7. data/lib/levelup/api.rb +1 -2
  8. data/lib/levelup/configuration.rb +1 -1
  9. data/lib/levelup/endpoints/access_tokens.rb +7 -10
  10. data/lib/levelup/endpoints/app_locations.rb +4 -6
  11. data/lib/levelup/endpoints/app_users.rb +1 -7
  12. data/lib/levelup/endpoints/credit_cards.rb +3 -4
  13. data/lib/levelup/endpoints/location_credit.rb +6 -8
  14. data/lib/levelup/endpoints/location_merchant_funded_credit.rb +23 -0
  15. data/lib/levelup/endpoints/location_orders.rb +8 -14
  16. data/lib/levelup/endpoints/merchant_funded_credits.rb +4 -6
  17. data/lib/levelup/endpoints/merchant_locations.rb +8 -13
  18. data/lib/levelup/endpoints/merchant_orders.rb +6 -8
  19. data/lib/levelup/endpoints/orders.rb +3 -3
  20. data/lib/levelup/endpoints/permissions_requests.rb +1 -2
  21. data/lib/levelup/endpoints/qr_codes.rb +3 -4
  22. data/lib/levelup/endpoints/specific_app.rb +1 -2
  23. data/lib/levelup/endpoints/specific_location.rb +13 -8
  24. data/lib/levelup/endpoints/specific_merchant.rb +4 -5
  25. data/lib/levelup/endpoints/specific_order.rb +4 -8
  26. data/lib/levelup/endpoints/specific_permissions_request.rb +3 -5
  27. data/lib/levelup/endpoints/user_addresses.rb +6 -7
  28. data/lib/levelup/endpoints/user_orders.rb +2 -3
  29. data/lib/levelup/endpoints/users.rb +5 -0
  30. data/lib/levelup/requests/authenticate_merchant.rb +1 -2
  31. data/lib/levelup/requests/create_address.rb +3 -4
  32. data/lib/levelup/requests/create_card.rb +2 -3
  33. data/lib/levelup/requests/create_order.rb +1 -2
  34. data/lib/levelup/requests/create_user.rb +4 -13
  35. data/lib/levelup/requests/get_location_credit.rb +1 -2
  36. data/lib/levelup/requests/get_location_merchant_funded_credit.rb +16 -0
  37. data/lib/levelup/requests/get_order.rb +1 -2
  38. data/lib/levelup/requests/give_merchant_credit.rb +1 -2
  39. data/lib/levelup/requests/list_addresses.rb +3 -4
  40. data/lib/levelup/requests/list_app_locations.rb +1 -2
  41. data/lib/levelup/requests/list_locations.rb +2 -3
  42. data/lib/levelup/requests/list_orders.rb +2 -3
  43. data/lib/levelup/requests/list_user_orders.rb +3 -4
  44. data/lib/levelup/requests/show_permissions_request.rb +1 -2
  45. data/lib/levelup/responses/success_paginated.rb +1 -2
  46. data/lib/levelup/templates/app_authenticated.rb +1 -3
  47. data/lib/levelup/templates/merchant_and_user_authenticated.rb +4 -9
  48. data/lib/levelup/templates/merchant_authenticated.rb +2 -5
  49. data/lib/levelup/utils/payment_calculator.rb +83 -0
  50. data/spec/endpoints/access_tokens_spec.rb +2 -4
  51. data/spec/endpoints/app_users_spec.rb +6 -22
  52. data/spec/endpoints/location_credit_spec.rb +1 -2
  53. data/spec/endpoints/location_merchant_funded_credit_spec.rb +12 -0
  54. data/spec/endpoints/location_orders_spec.rb +3 -4
  55. data/spec/endpoints/merchant_funded_credits_spec.rb +1 -2
  56. data/spec/endpoints/merchant_locations_spec.rb +4 -4
  57. data/spec/endpoints/qr_codes_spec.rb +1 -2
  58. data/spec/endpoints/specific_order_spec.rb +3 -4
  59. data/spec/endpoints/specific_permissions_request_spec.rb +1 -2
  60. data/spec/endpoints/user_addresses_spec.rb +1 -2
  61. data/spec/endpoints/user_orders_spec.rb +1 -2
  62. data/spec/endpoints/users_spec.rb +22 -0
  63. data/spec/{data_objects/requests → requests}/authenticate_app_spec.rb +0 -0
  64. data/spec/{data_objects/requests → requests}/authenticate_merchant_spec.rb +0 -0
  65. data/spec/{data_objects/requests → requests}/create_order_spec.rb +0 -0
  66. data/spec/{data_objects/requests → requests}/get_order_spec.rb +0 -0
  67. data/spec/{data_objects/requests → requests}/list_locations_spec.rb +0 -0
  68. data/spec/{data_objects/requests → requests}/list_orders_spec.rb +0 -0
  69. data/spec/{data_objects/requests → requests}/refund_order_spec.rb +0 -0
  70. data/spec/{data_objects/requests → requests}/request_permissions_spec.rb +1 -2
  71. data/spec/{data_objects/responses → responses}/error_spec.rb +0 -0
  72. data/spec/{data_objects/responses → responses}/response_spec.rb +0 -0
  73. data/spec/{data_objects/responses → responses}/success_paginated_spec.rb +1 -2
  74. data/spec/utils/payment_calculator/payment_calculator_spec.rb +164 -0
  75. metadata +36 -26
@@ -15,7 +15,7 @@ GEM
15
15
  httparty (0.13.1)
16
16
  json (~> 1.8)
17
17
  multi_xml (>= 0.5.2)
18
- json (1.8.1)
18
+ json (1.8.2)
19
19
  multi_xml (0.5.5)
20
20
  parser (2.1.9)
21
21
  ast (>= 1.1, < 3.0)
data/README.md CHANGED
@@ -19,52 +19,98 @@ Or install it yourself as:
19
19
 
20
20
  $ gem install levelup
21
21
 
22
+ ## Documentation
23
+
24
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/levelup/frames)
25
+
22
26
  ## Usage
23
27
 
24
- 1. Create an instance of the LevelUp client and authenticate it.
28
+ ### Do once per LevelUp-powered application:
29
+ - Create an instance of the LevelUp client and authenticate it.
25
30
 
26
31
  ```ruby
27
32
  api = Levelup::Api.new
33
+
34
+ # While testing:
35
+ Levelup::Configuration.base_api_url = 'https://sandbox.thelevelup.com/'
36
+
37
+ # For production, these should be ENV variables:
38
+ api_key = '23eef8c2895ce66eb4500bb5e324b200f5339e6fe6d8665f6de0205f43f3b563'
39
+ client_secret = '4d71e958b9fb6a62af624390c4ef394df15d168ea12b3b12735643ff0694520f'
40
+
28
41
  auth_response = api.access_tokens.create_for_app(
29
- api_key: 'your_api_key',
30
- client_secret: 'your_secret')
42
+ api_key: api_key,
43
+ client_secret: client_secret)
44
+
31
45
  api.app_access_token = auth_response.token
46
+ ```
47
+
48
+ ### Do once per merchant account
32
49
 
33
- # or if you've saved your access token (recommended) just:
34
- api = Levelup::Api.new(app_access_token: 'your_access_token')
50
+ - Authenticate merchants using LevelUp email and password
51
+
52
+ ```ruby
53
+ username = 'sandboxdevexample@thelevelup.com'
54
+ password = 'fod2yau4flu6vok6'
55
+
56
+ merchant_token = api.access_tokens.create_for_merchant(
57
+ api_key: api_key, username: username, password: password)
35
58
  ```
36
59
 
37
- 2. Ensure you have permissions to manage orders for your merchant (if you haven't already done so)
60
+ ### Do for each merchant location
61
+
62
+ - Prompt merchant to map LevelUp locations to each of their online ordering locations
38
63
 
39
64
  ```ruby
40
- api.apps.permissions_requests.create(
41
- email: 'merchant@email.com',
42
- permission_keynames: ['manage_merchant_orders'])
43
- # Approve the request through the merchant email and the LevelUp API
44
- # will post you a merchant access token.
65
+ locations_response = api.merchants(merchant_id).locations.list(merchant_access_token)
45
66
 
46
- # See http://developer.thelevelup.com/api-reference/v15/user-permissions/
47
- # for more on receiving access tokens.
67
+ # For testing purposes, we'll use the first location
68
+
69
+ location = locations_response.locations[0]
70
+ location_id = location.id
48
71
  ```
49
72
 
50
- 3. Ask a user for permission to make an order for them.
73
+ ### Do for each customer
74
+
75
+ - Ask a user for permission to make an order for them (alternatively you can use our
76
+ [OpenID](http://developer.thelevelup.com/resources-and-guides/web-authentication-flow/) or
77
+ [Oauth2](http://developer.thelevelup.com/resources-and-guides/web-authorization-flow/) flows).
78
+ For more information on available permissions, see the
79
+ [LevelUp permissions list](http://developer.thelevelup.com/resources-and-guides/permissions-list/)
51
80
 
52
81
  ```ruby
53
82
  api.apps.permissions_requests.create(
54
83
  email: 'user@email.com',
55
- permission_keynames: ['create_orders'])
84
+ permission_keynames: ['create_orders', 'read_qr_code'])
56
85
  # wait for the user to approve the request. you will receive a user
57
86
  # access token in the same manner as above.
58
87
  ```
59
88
 
60
- 3. Create an order for the specified merchant.
89
+ - Retrieve a user's QR code
90
+
91
+ ```ruby
92
+ qr_code_response = api.qr_codes.get(customer_token)
93
+
94
+ qr_code = qr_code_response.code
95
+ ```
96
+
97
+ - Create an order for the specified merchant.
61
98
 
62
99
  ```ruby
63
- response = api.orders.create(
64
- identifier_from_merchant: '0123',
65
- location_id: 321,
66
- spend_amount: 350, # in cents; 350 = $3.50
67
- items: [
100
+
101
+ # Check for merchant_funded_credit
102
+
103
+ discount_response = api.locations(location_id).merchant_funded_credit.get(
104
+ qr_code, merchant_access_token)
105
+
106
+ # Define the details from the check
107
+
108
+ check_total_due_including_tax = 110 # Total amount of payment due on the check (in cents)
109
+ exempted_item_total = 0 # Total amount of exempted (milk, cigarettes etc) items (in cents)
110
+ spend_amount_requested = 110 # Total amount of payment requested from LevelUp (in cents)
111
+ tax_amount_due = 10 # Total tax amount due on check (in cents)
112
+ identifier_from_merchant = '01234' # Unique check identifier in your platform (ie, check ID)
113
+ check_items_array = [ # Array of all items on the check
68
114
  {
69
115
  charged_price: 350,
70
116
  description: 'Non-poisonous, supplies vital nutrients',
@@ -75,13 +121,57 @@ response = api.orders.create(
75
121
  standard_price: 350
76
122
  }
77
123
  # more items can go here
78
- ],
79
- merchant_access_token: 'merchant-token',
80
- user_access_token: 'user-token')
124
+ ]
125
+
126
+ # Determine the amount of discount to apply to the check
127
+
128
+ credit_to_apply = Levelup::Utils::PaymentCalculator.levelup_discount_to_apply(
129
+ check_total_due_including_tax: check_total_due_including_tax,
130
+ exempted_item_total: exempted_item_total,
131
+ merchant_funded_credit_available: discount_response.discount_amount,
132
+ payment_amount_requested: spend_amount_requested,
133
+ tax_amount_due: tax_amount_due,
134
+ )
135
+
136
+ # Apply the discount to the check
137
+
138
+ # Create a new order request
139
+ order_response = api.orders.create(
140
+ identifier_from_merchant: identifier_from_merchant,
141
+ location_id: location_id,
142
+ spend_amount: spend_amount_requested,
143
+ items: check_items_array,
144
+ merchant_access_token: merchant_access_token,
145
+ user_access_token: qr_code)
146
+
147
+ calculator = Levelup::Utils::PaymentCalculator.new(
148
+ discount_applied: credit_to_apply,
149
+ gift_card_credit_available: discount_response.gift_card_amount,
150
+ spend_amount_returned_from_levelup: order_response.spend_amount,
151
+ tip_returned_from_levelup: order_response.tip_amount
152
+ )
153
+
154
+ # Get relevant amounts to apply to check and apply as necessary
155
+
156
+ calculator.gift_card_payment_to_apply
157
+ calculator.gift_card_tip_to_apply
158
+ calculator.levelup_payment_to_apply
159
+ calculator.levelup_tip_to_apply
160
+
161
+ # Additional values are also available (if desired)
162
+
163
+ calculator.total_gift_card_payment_to_apply_including_tip
164
+ calculator.gift_card_remaining_balance_after_payment
165
+ calculator.total_levelup_payment_to_apply_including_tip
166
+
167
+ # Apply each payment to the check and close the check (assuming balance due is 0)
81
168
  ```
82
169
 
83
- The LevelUp Ruby SDK mirrors the API as closely as possible, so the call for any given endpoint can be inferred from its URL.
170
+ The LevelUp Ruby SDK mirrors the API as closely as possible, so the call for any given endpoint
171
+ can be inferred from its URL.
172
+
84
173
  For instance:
174
+
85
175
  ```ruby
86
176
  api.apps.permissions_requests.create # points to /v15/apps/permissions_requests/ POST
87
177
  api.user_addresses.list # points to /v15/user_addresses/ GET
@@ -90,10 +180,12 @@ api.orders(uuid).refund # points to /v15/orders/:uuid/refund/ POST
90
180
 
91
181
  ## Pagination
92
182
 
93
- Some requests that return large lists are paginated and only return a small number of values per request.
94
- The LevelUp Ruby SDK handles this by allowing you to request the next page from the paginated response.
183
+ Some requests that return large lists are paginated and only return a small number of values per
184
+ request. The LevelUp Ruby SDK handles this by allowing you to request the next page from the
185
+ paginated response.
95
186
 
96
187
  For instance:
188
+
97
189
  ```ruby
98
190
  locs_response = api.apps(123).locations.list # gets a page of locations associated with an app
99
191
  locs_response.locations # => [location 1, location 2...location 10]
@@ -105,8 +197,9 @@ next_page_response = locs_response.next # gets the next page of results
105
197
 
106
198
  ## Errors
107
199
 
108
- If the LevelUp API returns an error response (Any HTTP code 400 or greater), it will return an object
109
- containing useful info about the error. It can be handled like so:
200
+ If the LevelUp API returns a 422 error response, it will also return an object containing useful
201
+ info about the error. It can be handled like so:
202
+
110
203
  ```ruby
111
204
  error = api.access_tokens.create_for_app(
112
205
  api_key: 'bogus_api_key',
@@ -123,18 +216,18 @@ puts error.errors[0].property # => 'api_key'
123
216
 
124
217
  ## Contributing
125
218
 
126
- 1. Fork it ( https://github.com/TheLevelup/pos-ruby-sdk/fork )
127
- 2. Create your feature branch (`git checkout -b my-new-feature`)
128
- 3. Ensure that Rubocop gives you a clean bill of health
219
+ - Fork it (https://github.com/TheLevelup/levelup-sdk-ruby/fork)
220
+ - Create your feature branch (`git checkout -b my-new-feature`)
221
+ - Ensure that Rubocop gives you a clean bill of health
129
222
  ```
130
223
  cd path/to/my/ruby-sdk-folder
131
- rubocop
224
+ bundle exec rubocop
132
225
  ```
133
- 4. Ensure that all RSpec tests pass (and write some for your code!)
226
+ - Ensure that all RSpec tests pass (and write some for your code!)
134
227
  ```
135
228
  cd path/to/my/ruby-sdk-folder
136
- rspec
229
+ bundle exec rspec
137
230
  ```
138
- 4. Commit your changes (`git commit -am 'Add some feature'`)
139
- 5. Push to the branch (`git push origin my-new-feature`)
140
- 6. Create a new Pull Request
231
+ - Commit your changes (`git commit -am 'Add some feature'`)
232
+ - Push to the branch (`git push origin my-new-feature`)
233
+ - Create a new Pull Request
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_runtime_dependency 'httparty', '~> 0.13.1'
32
32
 
33
- spec.required_ruby_version = '>= 1.9.3'
33
+ spec.required_ruby_version = '>= 2.0.0'
34
34
  end
@@ -19,6 +19,7 @@ require 'levelup/requests/create_card'
19
19
  require 'levelup/requests/create_order'
20
20
  require 'levelup/requests/create_user'
21
21
  require 'levelup/requests/get_location_credit'
22
+ require 'levelup/requests/get_location_merchant_funded_credit'
22
23
  require 'levelup/requests/get_order'
23
24
  require 'levelup/requests/get_qr_code'
24
25
  require 'levelup/requests/get_user'
@@ -43,6 +44,7 @@ require 'levelup/endpoints/app_users'
43
44
  require 'levelup/endpoints/apps'
44
45
  require 'levelup/endpoints/credit_cards'
45
46
  require 'levelup/endpoints/location_credit'
47
+ require 'levelup/endpoints/location_merchant_funded_credit'
46
48
  require 'levelup/endpoints/location_orders'
47
49
  require 'levelup/endpoints/merchant_funded_credits'
48
50
  require 'levelup/endpoints/merchant_locations'
@@ -59,4 +61,6 @@ require 'levelup/endpoints/user_addresses'
59
61
  require 'levelup/endpoints/user_orders'
60
62
  require 'levelup/endpoints/users'
61
63
 
64
+ require 'levelup/utils/payment_calculator'
65
+
62
66
  require 'levelup/api'
@@ -3,8 +3,7 @@
3
3
  # of utilizing LevelUp for online ordering and web payments.
4
4
 
5
5
  module Levelup
6
- # This API is the base class that handles all requests made to the LevelUp
7
- # API.
6
+ # This is the base class that handles all requests made to the LevelUp API.
8
7
  class Api
9
8
  # Token to access app-authenticated endpoints
10
9
  attr_writer :app_access_token
@@ -1,6 +1,6 @@
1
1
  module Levelup
2
2
  class Configuration
3
- VERSION = '0.9.4'
3
+ VERSION = '0.9.5'
4
4
  DEFAULT_API_VERSION = :v15
5
5
 
6
6
  class << self
@@ -1,7 +1,6 @@
1
1
  module Levelup
2
2
  module Endpoints
3
- # The endpoint holding all functions related to the management of access
4
- # tokens.
3
+ # The endpoint holding all functions related to the management of access tokens.
5
4
  class AccessTokens < Base
6
5
  # The API key assigned to your app. Preconfigured key.
7
6
  attr_writer :api_key
@@ -16,18 +15,16 @@ module Levelup
16
15
  # Generates a new app access token. If passed no parameters, attempts to
17
16
  # pass the preconfigured API key and client secret to the endpoint.
18
17
  def create_for_app(app_auth_request = nil)
19
- request = build_request(app_auth_request || { api_key: @api_key,
20
- client_secret: @secret },
21
- Requests::AuthenticateApp)
22
-
23
- request.send_to_api(:post, endpoint_path)
18
+ build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },
19
+ Requests::AuthenticateApp).
20
+ send_to_api(:post, endpoint_path)
24
21
  end
25
22
 
26
23
  # Generates a new merchant access token.
27
24
  def create_for_merchant(merchant_auth_request)
28
- request = build_request(merchant_auth_request,
29
- Requests::AuthenticateMerchant)
30
- request.send_to_api(:post, endpoint_path(:v14))
25
+ build_request(merchant_auth_request,
26
+ Requests::AuthenticateMerchant).
27
+ send_to_api(:post, endpoint_path(:v14))
31
28
  end
32
29
 
33
30
  private
@@ -1,18 +1,16 @@
1
1
  module Levelup
2
2
  module Endpoints
3
3
  # The endpoint holding all functions relating to a specific app's locations.
4
- # This endpoint is a v14 endpoint and should not be expected to remain
5
- # accessible indefinitely.
4
+ # This endpoint is a v14 endpoint and should not be expected to remain accessible indefinitely.
6
5
  class AppLocations < Base
7
6
  def initialize(id)
8
7
  self.id = id
9
8
  end
10
9
 
11
- # Provides a list of locations controlled by this app. This list is
12
- # paginated.
10
+ # Provides a list of locations controlled by this app. This list is paginated.
13
11
  def list
14
- request = Requests::ListAppLocations.new
15
- request.send_to_api(:get, endpoint_path(:v14))
12
+ Requests::ListAppLocations.new.
13
+ send_to_api(:get, endpoint_path(:v14))
16
14
  end
17
15
 
18
16
  private
@@ -1,7 +1,6 @@
1
1
  module Levelup
2
2
  module Endpoints
3
- # The endpoint holding all functions related to managing users under the
4
- # current app.
3
+ # The endpoint holding all functions related to managing users under the current app.
5
4
  class AppUsers < Base
6
5
  def initialize(app_access_token)
7
6
  @app_access_token = app_access_token
@@ -13,11 +12,6 @@ module Levelup
13
12
  request.send_to_api(:post, endpoint_path)
14
13
  end
15
14
 
16
- def get(user_access_token)
17
- request = Requests::GetUser.new(user_access_token: user_access_token)
18
- request.send_to_api(:get, endpoint_path)
19
- end
20
-
21
15
  private
22
16
 
23
17
  attr_reader :app_access_token
@@ -1,14 +1,13 @@
1
1
  module Levelup
2
2
  module Endpoints
3
- # The endpoint holding all functions related to managing users' credit
4
- # cards.
3
+ # The endpoint holding all functions related to managing users' credit cards.
5
4
  class CreditCards < Base
6
5
  # Adds a credit card to a user's account. Requires a user access token
7
6
  # with create_first_credit_card permission.
8
7
  # This request will fail unless the user account has no credit card on it.
9
8
  def create(credit_card_request)
10
- request = build_request(credit_card_request, Requests::CreateCard)
11
- request.send_to_api(:get, endpoint_path)
9
+ build_request(credit_card_request, Requests::CreateCard).
10
+ send_to_api(:get, endpoint_path)
12
11
  end
13
12
 
14
13
  private
@@ -1,22 +1,20 @@
1
1
  module Levelup
2
2
  module Endpoints
3
- # The endpoint holding all functions relating to available credit at
4
- # locations.
3
+ # The endpoint holding all functions relating to available credit at locations.
5
4
  class LocationCredit < Base
6
- attr_reader :id
7
-
8
5
  def initialize(location_id)
9
- @id = location_id
6
+ self.id = location_id
10
7
  end
11
8
 
12
9
  def get(user_access_token)
13
- request =
14
- Requests::GetLocationCredit.new(user_access_token: user_access_token)
15
- request.send_to_api(:get, endpoint_path)
10
+ Requests::GetLocationCredit.new(user_access_token: user_access_token).
11
+ send_to_api :get, endpoint_path
16
12
  end
17
13
 
18
14
  private
19
15
 
16
+ attr_accessor :id
17
+
20
18
  def path
21
19
  "locations/#{id}/credit"
22
20
  end
@@ -0,0 +1,23 @@
1
+ module Levelup
2
+ module Endpoints
3
+ # The endpoint holding all functions relating to managing merchant-funded credit.
4
+ class LocationMerchantFundedCredit < Base
5
+ def initialize(location_id)
6
+ @id = location_id
7
+ end
8
+
9
+ def get(payment_token_data, merchant_access_token)
10
+ @payment_token_data = payment_token_data
11
+ Requests::GetLocationMerchantFundedCredit.new(
12
+ merchant_access_token: merchant_access_token).
13
+ send_to_api :get, endpoint_path
14
+ end
15
+
16
+ private
17
+
18
+ def path
19
+ "locations/#{@id}/merchant_funded_credit?payment_token_data=#{@payment_token_data}"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,28 +1,22 @@
1
1
  module Levelup
2
2
  module Endpoints
3
- # The endpoint holding all functions relating to orders for a specific
4
- # location.
5
- # This is a v14 endpoint and should not be expected to remain functional
6
- # indefinitely.
3
+ # The endpoint holding all functions relating to orders for a specific location.
4
+ # This is a v14 endpoint and should not be expected to remain functional indefinitely.
7
5
  class LocationOrders < Base
8
6
  def initialize(location_id)
9
- @id = location_id
7
+ self.id = location_id
10
8
  end
11
9
 
12
10
  # Gets a list of orders made at this location. This list is paginated.
13
- #
14
- # [merchant_auth_token]
15
- # An access token for the merchant that owns this
16
- # location.
17
- def list(merchant_auth_token)
18
- request = Requests::ListOrders.new(
19
- merchant_access_token: merchant_auth_token)
20
- request.send_to_api(:get, endpoint_path(:v14))
11
+ # @param merchant_access_token [string] An access token for a user that manages this location.
12
+ def list(merchant_access_token)
13
+ Requests::ListOrders.new(merchant_access_token: merchant_access_token).
14
+ send_to_api(:get, endpoint_path(:v14))
21
15
  end
22
16
 
23
17
  private
24
18
 
25
- attr_reader :id
19
+ attr_accessor :id
26
20
 
27
21
  def path
28
22
  "locations/#{id}/orders"