levelup 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +36 -0
  3. data/.rubocop.yml +427 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +58 -0
  6. data/LICENSE +21 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +113 -0
  9. data/Rakefile +1 -0
  10. data/levelup.gemspec +32 -0
  11. data/lib/levelup.rb +55 -0
  12. data/lib/levelup/api.rb +102 -0
  13. data/lib/levelup/configuration.rb +23 -0
  14. data/lib/levelup/endpoints/access_tokens.rb +40 -0
  15. data/lib/levelup/endpoints/app_users.rb +30 -0
  16. data/lib/levelup/endpoints/apps.rb +30 -0
  17. data/lib/levelup/endpoints/base.rb +25 -0
  18. data/lib/levelup/endpoints/credit_cards.rb +26 -0
  19. data/lib/levelup/endpoints/location_orders.rb +32 -0
  20. data/lib/levelup/endpoints/merchant_funded_credits.rb +19 -0
  21. data/lib/levelup/endpoints/merchant_locations.rb +32 -0
  22. data/lib/levelup/endpoints/merchant_orders.rb +28 -0
  23. data/lib/levelup/endpoints/orders.rb +19 -0
  24. data/lib/levelup/endpoints/permissions_requests.rb +28 -0
  25. data/lib/levelup/endpoints/qr_codes.rb +28 -0
  26. data/lib/levelup/endpoints/specific_location.rb +24 -0
  27. data/lib/levelup/endpoints/specific_merchant.rb +28 -0
  28. data/lib/levelup/endpoints/specific_order.rb +28 -0
  29. data/lib/levelup/endpoints/specific_permissions_request.rb +26 -0
  30. data/lib/levelup/endpoints/user_addresses.rb +25 -0
  31. data/lib/levelup/endpoints/user_orders.rb +18 -0
  32. data/lib/levelup/endpoints/users.rb +16 -0
  33. data/lib/levelup/errors/invalid_request.rb +8 -0
  34. data/lib/levelup/errors/unauthenticated.rb +8 -0
  35. data/lib/levelup/requests/authenticate_app.rb +19 -0
  36. data/lib/levelup/requests/authenticate_merchant.rb +26 -0
  37. data/lib/levelup/requests/base.rb +87 -0
  38. data/lib/levelup/requests/create_address.rb +19 -0
  39. data/lib/levelup/requests/create_card.rb +21 -0
  40. data/lib/levelup/requests/create_order.rb +33 -0
  41. data/lib/levelup/requests/create_user.rb +34 -0
  42. data/lib/levelup/requests/get_order.rb +17 -0
  43. data/lib/levelup/requests/get_qr_code.rb +16 -0
  44. data/lib/levelup/requests/get_user.rb +17 -0
  45. data/lib/levelup/requests/give_merchant_credit.rb +23 -0
  46. data/lib/levelup/requests/list_addresses.rb +20 -0
  47. data/lib/levelup/requests/list_locations.rb +24 -0
  48. data/lib/levelup/requests/list_orders.rb +23 -0
  49. data/lib/levelup/requests/list_user_orders.rb +20 -0
  50. data/lib/levelup/requests/refund_order.rb +21 -0
  51. data/lib/levelup/requests/request_permissions.rb +27 -0
  52. data/lib/levelup/requests/show_permissions_request.rb +21 -0
  53. data/lib/levelup/responses/error.rb +36 -0
  54. data/lib/levelup/responses/success.rb +11 -0
  55. data/lib/levelup/templates/data_parcel.rb +41 -0
  56. data/lib/levelup/templates/merchant_and_user_authenticated.rb +21 -0
  57. data/lib/levelup/templates/merchant_authenticated.rb +19 -0
  58. data/lib/levelup/templates/user_address_data.rb +20 -0
  59. data/lib/levelup/templates/user_authenticated.rb +17 -0
  60. data/spec/data_objects/requests/authenticate_app_spec.rb +13 -0
  61. data/spec/data_objects/requests/authenticate_merchant_spec.rb +14 -0
  62. data/spec/data_objects/requests/create_order_spec.rb +14 -0
  63. data/spec/data_objects/requests/get_order_spec.rb +13 -0
  64. data/spec/data_objects/requests/list_locations_spec.rb +13 -0
  65. data/spec/data_objects/requests/list_orders_spec.rb +13 -0
  66. data/spec/data_objects/requests/refund_order_spec.rb +19 -0
  67. data/spec/data_objects/requests/request_permissions_spec.rb +21 -0
  68. data/spec/data_objects/responses/error_spec.rb +67 -0
  69. data/spec/data_objects/responses/response_spec.rb +13 -0
  70. data/spec/endpoints/access_tokens_spec.rb +81 -0
  71. data/spec/endpoints/app_users_spec.rb +43 -0
  72. data/spec/endpoints/location_orders_spec.rb +34 -0
  73. data/spec/endpoints/merchant_funded_credits_spec.rb +16 -0
  74. data/spec/endpoints/merchant_locations_spec.rb +35 -0
  75. data/spec/endpoints/orders_spec.rb +37 -0
  76. data/spec/endpoints/permissions_requests_spec.rb +22 -0
  77. data/spec/endpoints/qr_codes_spec.rb +12 -0
  78. data/spec/endpoints/specific_order_spec.rb +33 -0
  79. data/spec/endpoints/specific_permissions_request_spec.rb +24 -0
  80. data/spec/endpoints/user_addresses_spec.rb +41 -0
  81. data/spec/endpoints/user_orders_spec.rb +12 -0
  82. data/spec/fixtures/keys.yml.example +15 -0
  83. data/spec/spec_helper.rb +28 -0
  84. data/spec/support/vcr_filter_sensitive_data.rb +53 -0
  85. metadata +281 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in levelup_api.gemspec
4
+ gemspec
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ levelup (0.9.2)
5
+ httparty (~> 0.13.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.3.6)
11
+ ast (2.0.0)
12
+ crack (0.4.2)
13
+ safe_yaml (~> 1.0.0)
14
+ diff-lcs (1.2.5)
15
+ httparty (0.13.1)
16
+ json (~> 1.8)
17
+ multi_xml (>= 0.5.2)
18
+ json (1.8.1)
19
+ multi_xml (0.5.5)
20
+ parser (2.1.9)
21
+ ast (>= 1.1, < 3.0)
22
+ slop (~> 3.4, >= 3.4.5)
23
+ powerpack (0.0.9)
24
+ rainbow (1.99.2)
25
+ rake (10.3.1)
26
+ rspec (2.14.1)
27
+ rspec-core (~> 2.14.0)
28
+ rspec-expectations (~> 2.14.0)
29
+ rspec-mocks (~> 2.14.0)
30
+ rspec-core (2.14.8)
31
+ rspec-expectations (2.14.5)
32
+ diff-lcs (>= 1.1.3, < 2.0)
33
+ rspec-mocks (2.14.6)
34
+ rubocop (0.16.0)
35
+ parser (~> 2.1)
36
+ powerpack (~> 0.0.6)
37
+ rainbow (>= 1.1.4)
38
+ safe_yaml (1.0.3)
39
+ settingslogic (2.0.9)
40
+ slop (3.5.0)
41
+ vcr (2.9.0)
42
+ webmock (1.17.4)
43
+ addressable (>= 2.2.7)
44
+ crack (>= 0.3.2)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.6)
51
+ levelup!
52
+ rake (~> 10.3.1)
53
+ rspec (~> 2.14)
54
+ rspec-mocks (~> 2.14.6)
55
+ rubocop (~> 0.16.0)
56
+ settingslogic (~> 2.0.9)
57
+ vcr (~> 2.9.0)
58
+ webmock (~> 1.17.4)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 LevelUp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 SCVNGR, Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,113 @@
1
+ # LevelUp Ruby SDK
2
+
3
+ Early alpha version of the LevelUp Ruby SDK - designed for e-commerce and online
4
+ food ordering sites to provide the option to easily pay with a LevelUp account.
5
+
6
+ Subject to drastic change without warning for duration of alpha period.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'levelup'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install levelup
21
+
22
+ ## Usage
23
+
24
+ 1. Create an instance of the LevelUp client and authenticate it.
25
+
26
+ ```ruby
27
+ api = Levelup::Api.new
28
+ auth_response = api.access_tokens.create_for_app(
29
+ api_key: 'your_api_key',
30
+ client_secret: 'your_secret')
31
+ api.app_access_token = auth_response.token
32
+
33
+ # or if you've saved your access token (recommended) just:
34
+ api = Levelup::Api.new(app_access_token: 'your_access_token')
35
+ ```
36
+
37
+ 2. Ensure you have permissions to manage orders for your merchant (if you haven't already done so)
38
+
39
+ ```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.
45
+
46
+ # See http://developer.thelevelup.com/api-reference/v15/user-permissions/
47
+ # for more on receiving access tokens.
48
+ ```
49
+
50
+ 3. Ask a user for permission to make an order for them.
51
+
52
+ ```ruby
53
+ api.apps.permissions_requests.create(
54
+ email: 'user@email.com',
55
+ permission_keynames: ['create_orders'])
56
+ # wait for the user to approve the request. you will receive a user
57
+ # access token in the same manner as above.
58
+ ```
59
+
60
+ 3. Create an order for the specified merchant.
61
+
62
+ ```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: [
68
+ {
69
+ # item data
70
+ }
71
+ ],
72
+ merchant_access_token: 'merchant-token',
73
+ user_access_token: 'user-token')
74
+ ```
75
+
76
+ All other functions of the Ruby SDK mirror the v15 LevelUp API described at http://developer.thelevelup.com/
77
+ as well as a very small number of v14 endpoints.
78
+
79
+ ## Errors
80
+
81
+ If the LevelUp API returns an error response (Any HTTP code 400 or greater), it will return an object
82
+ containing useful info about the error. It can be handled like so:
83
+ ```ruby
84
+ error = api.access_tokens.create_for_app(
85
+ api_key: 'bogus_api_key',
86
+ client_secret: 'bogus_client_secret'
87
+ )
88
+
89
+ puts error.success? # => false
90
+ puts error.headers['Cache-Control'] # => 'private' (Map of header names to values)
91
+ puts error.status_code # => 422
92
+ puts error.errors[0] # => object with message, object, property values
93
+ puts error.errors[0].message # => 'API Key is invalid.'
94
+ puts error.errors[0].property # => 'api_key'
95
+ ```
96
+
97
+ ## Contributing
98
+
99
+ 1. Fork it ( https://github.com/TheLevelup/pos-ruby-sdk/fork )
100
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
101
+ 3. Ensure that Rubocop gives you a clean bill of health
102
+ ```
103
+ cd path/to/my/ruby-sdk-folder
104
+ rubocop
105
+ ```
106
+ 4. Ensure that all RSpec tests pass (and write some for your code!)
107
+ ```
108
+ cd path/to/my/ruby-sdk-folder
109
+ rspec
110
+ ```
111
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
112
+ 5. Push to the branch (`git push origin my-new-feature`)
113
+ 6. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,32 @@
1
+ $LOAD_PATH << File.expand_path('../lib', __FILE__)
2
+
3
+ require 'levelup/configuration'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'levelup'
7
+ spec.version = Levelup::Configuration::VERSION
8
+ spec.authors = ['LevelUp POS Team']
9
+ spec.email = ['pos-support@thelevelup.com']
10
+ spec.summary = %q(A Ruby client for communicating with the LevelUp API)
11
+ spec.description = %q(A tool to simplify, streamline, and quickly
12
+ communicate with the LevelUp REST API, allowing for companies to easily
13
+ implement the ability to pay with LevelUp on their e-commerce platforms.)
14
+ spec.homepage = 'http://developer.thelevelup.com'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(/^(test|spec|features)/)
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.6'
23
+ spec.add_development_dependency 'rake', '~> 10.3.1'
24
+ spec.add_development_dependency 'rspec', '~> 2.14'
25
+ spec.add_development_dependency 'rspec-mocks', '~> 2.14.6'
26
+ spec.add_development_dependency 'rubocop', '~> 0.16.0'
27
+ spec.add_development_dependency 'settingslogic', '~> 2.0.9'
28
+ spec.add_development_dependency 'vcr', '~> 2.9.0'
29
+ spec.add_development_dependency 'webmock', '~> 1.17.4'
30
+
31
+ spec.add_runtime_dependency 'httparty', '~> 0.13.1'
32
+ end
@@ -0,0 +1,55 @@
1
+ require 'httparty'
2
+
3
+ require 'levelup/errors/invalid_request'
4
+ require 'levelup/errors/unauthenticated'
5
+ require 'levelup/configuration'
6
+
7
+ require 'levelup/templates/data_parcel'
8
+ require 'levelup/templates/user_address_data'
9
+ require 'levelup/templates/merchant_authenticated'
10
+ require 'levelup/templates/merchant_and_user_authenticated'
11
+ require 'levelup/templates/user_authenticated'
12
+
13
+ require 'levelup/requests/base'
14
+ require 'levelup/requests/authenticate_app'
15
+ require 'levelup/requests/authenticate_merchant'
16
+ require 'levelup/requests/create_address'
17
+ require 'levelup/requests/create_card'
18
+ require 'levelup/requests/create_order'
19
+ require 'levelup/requests/create_user'
20
+ require 'levelup/requests/get_order'
21
+ require 'levelup/requests/get_qr_code'
22
+ require 'levelup/requests/get_user'
23
+ require 'levelup/requests/give_merchant_credit'
24
+ require 'levelup/requests/list_addresses'
25
+ require 'levelup/requests/list_locations'
26
+ require 'levelup/requests/list_orders'
27
+ require 'levelup/requests/list_user_orders'
28
+ require 'levelup/requests/refund_order'
29
+ require 'levelup/requests/request_permissions'
30
+ require 'levelup/requests/show_permissions_request'
31
+
32
+ require 'levelup/responses/success'
33
+ require 'levelup/responses/error'
34
+
35
+ require 'levelup/endpoints/base'
36
+ require 'levelup/endpoints/access_tokens'
37
+ require 'levelup/endpoints/app_users'
38
+ require 'levelup/endpoints/apps'
39
+ require 'levelup/endpoints/credit_cards'
40
+ require 'levelup/endpoints/location_orders'
41
+ require 'levelup/endpoints/merchant_funded_credits'
42
+ require 'levelup/endpoints/merchant_locations'
43
+ require 'levelup/endpoints/merchant_orders'
44
+ require 'levelup/endpoints/orders'
45
+ require 'levelup/endpoints/permissions_requests'
46
+ require 'levelup/endpoints/qr_codes'
47
+ require 'levelup/endpoints/specific_location'
48
+ require 'levelup/endpoints/specific_merchant'
49
+ require 'levelup/endpoints/specific_order'
50
+ require 'levelup/endpoints/specific_permissions_request'
51
+ require 'levelup/endpoints/user_addresses'
52
+ require 'levelup/endpoints/user_orders'
53
+ require 'levelup/endpoints/users'
54
+
55
+ require 'levelup/api'
@@ -0,0 +1,102 @@
1
+ # The LevelUp Ruby SDK provides an interface for Ruby and Rails developers to
2
+ # easily and intuitively access the LevelUp API, specifically for the purpose
3
+ # of utilizing LevelUp for online ordering and web payments.
4
+
5
+ module Levelup
6
+ # This API is the base class that handles all requests made to the LevelUp
7
+ # API.
8
+ class Api
9
+ # Token to access app-authenticated endpoints
10
+ attr_writer :app_access_token
11
+ # App API key to automatically generate an app access token
12
+ attr_writer :api_key
13
+ # App secret to automatically generate an app access token
14
+ attr_writer :secret
15
+
16
+ # Accepts any combination of the listed parameters, though +api_key+ and
17
+ # +secret+ work in tandem.
18
+ def initialize(app_access_token: nil, api_key: nil, secret: nil)
19
+ self.app_access_token = app_access_token
20
+ self.api_key = api_key
21
+ self.secret = secret
22
+ end
23
+
24
+ # Generates an interface for the +access_tokens+ endpoint.
25
+ def access_tokens
26
+ Endpoints::AccessTokens.new(
27
+ api_key: api_key,
28
+ secret: secret
29
+ )
30
+ end
31
+
32
+ # Generates an interface for the +apps+ endpoint.
33
+ def apps
34
+ Endpoints::Apps.new(app_access_token)
35
+ end
36
+
37
+ # Verifies if an access token is present for app-authenticated endpoints
38
+ def app_authenticated?
39
+ !@app_access_token.nil?
40
+ end
41
+
42
+ def credit_cards
43
+ Endpoints::CreditCards.new
44
+ end
45
+
46
+ # Generates the interface for the +locations+ endpoint for a specific
47
+ # location ID.
48
+ def locations(location_id)
49
+ Endpoints::SpecificLocation.new(location_id)
50
+ end
51
+
52
+ # Generates an interface for the +merchants+ endpoint for a specific
53
+ # merchant ID.
54
+ def merchants(merchant_id)
55
+ Endpoints::SpecificMerchant.new(merchant_id)
56
+ end
57
+
58
+ def merchant_funded_credits
59
+ Endpoints::MerchantFundedCredits.new
60
+ end
61
+
62
+ # Generates the interface for the +orders+ endpoint. Supply an order UUID if
63
+ # you would like to access endpoints for a specific order, otherwise, supply
64
+ # no parameters.
65
+ def orders(order_uuid = nil)
66
+ if order_uuid
67
+ Endpoints::SpecificOrder.new(order_uuid)
68
+ else
69
+ Endpoints::Orders.new
70
+ end
71
+ end
72
+
73
+ def qr_codes
74
+ Endpoints::QrCodes.new
75
+ end
76
+
77
+ # Generates an interface the +user_addresses+ endpoint.
78
+ def user_addresses
79
+ Endpoints::UserAddresses.new
80
+ end
81
+
82
+ def users
83
+ Endpoints::Users.new
84
+ end
85
+
86
+ private
87
+
88
+ attr_reader :api_key, :secret
89
+
90
+ def app_access_token
91
+ unless app_authenticated?
92
+ auto_auth = access_tokens.create_for_app
93
+
94
+ if auto_auth.success?
95
+ @app_access_token = auto_auth.token
96
+ end
97
+ end
98
+
99
+ @app_access_token
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,23 @@
1
+ module Levelup
2
+ class Configuration
3
+ VERSION = '0.9.2'
4
+ DEFAULT_API_VERSION = :v15
5
+
6
+ class << self
7
+ attr_accessor :base_api_url
8
+ end
9
+
10
+ self.base_api_url = 'https://api.thelevelup.com/'
11
+
12
+ def self.api_url(version)
13
+ base_api_url + VERSIONS[version]
14
+ end
15
+
16
+ private
17
+
18
+ VERSIONS = {
19
+ v14: 'v14',
20
+ v15: 'v15'
21
+ }
22
+ end
23
+ end
@@ -0,0 +1,40 @@
1
+ module Levelup
2
+ module Endpoints
3
+ # The endpoint holding all functions related to the management of access
4
+ # tokens.
5
+ class AccessTokens < Base
6
+ # The API key assigned to your app. Preconfigured key.
7
+ attr_writer :api_key
8
+ # The client secret assigned to your app. Preconfigured key.
9
+ attr_writer :secret
10
+
11
+ def initialize(api_key: nil, secret: nil)
12
+ @api_key = api_key
13
+ @secret = secret
14
+ end
15
+
16
+ # Generates a new app access token. If passed no parameters, attempts to
17
+ # pass the preconfigured API key and client secret to the endpoint.
18
+ 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)
24
+ end
25
+
26
+ # Generates a new merchant access token.
27
+ 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))
31
+ end
32
+
33
+ private
34
+
35
+ def path
36
+ 'access_tokens'
37
+ end
38
+ end
39
+ end
40
+ end