mercadopago-sdk 0.3.5 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +10 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  5. data/.github/workflows/ruby.yml +35 -0
  6. data/.gitignore +2 -1
  7. data/.rubocop.yml +1 -0
  8. data/.rubocop_todo.yml +104 -0
  9. data/.ruby-version +1 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/CODING_GUIDELINES.md +70 -0
  12. data/CONTRIBUTING.md +57 -0
  13. data/Gemfile +6 -1
  14. data/Gemfile.lock +45 -17
  15. data/LICENSE.txt +21 -0
  16. data/README.md +54 -143
  17. data/Rakefile +3 -1
  18. data/docs/CODE_OF_CONDUCT_md.html +154 -0
  19. data/docs/CODING_GUIDELINES_md.html +188 -0
  20. data/docs/CONTRIBUTING_md.html +165 -0
  21. data/docs/LICENSE_txt.html +96 -0
  22. data/docs/Mercadopago.html +123 -0
  23. data/docs/Mercadopago/AdvancedPayment.html +279 -0
  24. data/docs/Mercadopago/Card.html +204 -0
  25. data/docs/Mercadopago/CardToken.html +160 -0
  26. data/docs/Mercadopago/Config.html +266 -0
  27. data/docs/Mercadopago/Customer.html +228 -0
  28. data/docs/Mercadopago/DisbursementRefund.html +183 -0
  29. data/docs/Mercadopago/HttpClient.html +249 -0
  30. data/docs/Mercadopago/IdentificationType.html +136 -0
  31. data/docs/Mercadopago/MPBase.html +316 -0
  32. data/docs/Mercadopago/MerchantOrder.html +209 -0
  33. data/docs/Mercadopago/Payment.html +208 -0
  34. data/docs/Mercadopago/PaymentMethods.html +136 -0
  35. data/docs/Mercadopago/Preference.html +184 -0
  36. data/docs/Mercadopago/Refund.html +160 -0
  37. data/docs/Mercadopago/RequestOptions.html +433 -0
  38. data/docs/Mercadopago/SDK.html +528 -0
  39. data/docs/Mercadopago/User.html +136 -0
  40. data/docs/README_md.html +181 -0
  41. data/docs/created.rid +25 -0
  42. data/docs/css/fonts.css +167 -0
  43. data/docs/css/rdoc.css +619 -0
  44. data/docs/fonts/Lato-Light.ttf +0 -0
  45. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  46. data/docs/fonts/Lato-Regular.ttf +0 -0
  47. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  48. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  49. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  50. data/docs/images/add.png +0 -0
  51. data/docs/images/arrow_up.png +0 -0
  52. data/docs/images/brick.png +0 -0
  53. data/docs/images/brick_link.png +0 -0
  54. data/docs/images/bug.png +0 -0
  55. data/docs/images/bullet_black.png +0 -0
  56. data/docs/images/bullet_toggle_minus.png +0 -0
  57. data/docs/images/bullet_toggle_plus.png +0 -0
  58. data/docs/images/date.png +0 -0
  59. data/docs/images/delete.png +0 -0
  60. data/docs/images/find.png +0 -0
  61. data/docs/images/loadingAnimation.gif +0 -0
  62. data/docs/images/macFFBgHack.png +0 -0
  63. data/docs/images/package.png +0 -0
  64. data/docs/images/page_green.png +0 -0
  65. data/docs/images/page_white_text.png +0 -0
  66. data/docs/images/page_white_width.png +0 -0
  67. data/docs/images/plugin.png +0 -0
  68. data/docs/images/ruby.png +0 -0
  69. data/docs/images/tag_blue.png +0 -0
  70. data/docs/images/tag_green.png +0 -0
  71. data/docs/images/transparent.png +0 -0
  72. data/docs/images/wrench.png +0 -0
  73. data/docs/images/wrench_orange.png +0 -0
  74. data/docs/images/zoom.png +0 -0
  75. data/docs/index.html +109 -0
  76. data/docs/js/darkfish.js +84 -0
  77. data/docs/js/navigation.js +105 -0
  78. data/docs/js/navigation.js.gz +0 -0
  79. data/docs/js/search.js +110 -0
  80. data/docs/js/search_index.js +1 -0
  81. data/docs/js/search_index.js.gz +0 -0
  82. data/docs/js/searcher.js +229 -0
  83. data/docs/js/searcher.js.gz +0 -0
  84. data/docs/table_of_contents.html +562 -0
  85. data/lib/mercadopago.rb +24 -347
  86. data/lib/mercadopago/config/config.rb +42 -0
  87. data/lib/mercadopago/config/request_options.rb +85 -0
  88. data/lib/mercadopago/core/mp_base.rb +77 -0
  89. data/lib/mercadopago/http/http_client.rb +74 -0
  90. data/lib/mercadopago/resources/advanced_payment.rb +48 -0
  91. data/lib/mercadopago/resources/card.rb +31 -0
  92. data/lib/mercadopago/resources/card_token.rb +19 -0
  93. data/lib/mercadopago/resources/customer.rb +36 -0
  94. data/lib/mercadopago/resources/disbursement_refund.rb +24 -0
  95. data/lib/mercadopago/resources/identification_type.rb +13 -0
  96. data/lib/mercadopago/resources/merchant_order.rb +32 -0
  97. data/lib/mercadopago/resources/payment.rb +35 -0
  98. data/lib/mercadopago/resources/payment_methods.rb +13 -0
  99. data/lib/mercadopago/resources/preference.rb +26 -0
  100. data/lib/mercadopago/resources/refund.rb +24 -0
  101. data/lib/mercadopago/resources/user.rb +13 -0
  102. data/lib/mercadopago/sdk.rb +85 -0
  103. data/mercadopago.gemspec +11 -11
  104. data/tests/test_card.rb +79 -0
  105. data/tests/test_card_token.rb +39 -0
  106. data/tests/test_customer.rb +54 -0
  107. data/tests/test_identification_type.rb +16 -0
  108. data/tests/test_merchant_order.rb +94 -0
  109. data/tests/test_payment.rb +102 -0
  110. data/tests/test_payment_methods.rb +14 -0
  111. data/tests/test_preference.rb +49 -0
  112. data/tests/test_refund.rb +88 -0
  113. data/tests/test_user.rb +17 -0
  114. data/tests/tests.rb +12 -56
  115. metadata +127 -27
  116. data/.travis.yml +0 -14
  117. data/examples/checkout-buttons/basic_preference/button.rb +0 -28
  118. data/examples/instant-payment-notifications/receive-ipn.rb +0 -25
  119. data/examples/payment-search/search-approved-payments.rb +0 -23
  120. data/examples/payment-search/search-creditcard-payments.rb +0 -23
  121. data/examples/payment-search/search-funded-payments-by-name.rb +0 -23
  122. data/examples/payment-search/search-payments-from-email-and-date.rb +0 -23
  123. data/examples/payment-search/search-payments.rb +0 -23
  124. data/examples/preapproval-payments/button.rb +0 -42
  125. data/lib/ssl_options_patch.rb +0 -15
  126. data/lib/version.rb +0 -1
  127. data/mercadopago-sdk-0.3.2.gem +0 -0
  128. data/mercadopago-sdk-0.3.3.gem +0 -0
  129. data/travis_Gemfile +0 -4
@@ -0,0 +1,77 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ##
6
+ # Module Base
7
+ class MPBase
8
+ def initialize(request_options, http_client)
9
+ unless request_options.is_a?(RequestOptions)
10
+ raise TypeError,
11
+ 'Param request_options must be a RequestOptions object'
12
+ end
13
+
14
+ @request_options = request_options
15
+ @http_client = http_client
16
+ @config = Config.new
17
+ end
18
+
19
+ def _check_request_options(request_options = nil)
20
+ request_options = @request_options if request_options.nil?
21
+ unless request_options.is_a?(RequestOptions)
22
+ raise TypeError,
23
+ 'Param request_options must be a RequestOptions object'
24
+ end
25
+
26
+ request_options.access_token = @request_options.access_token if request_options.access_token.nil?
27
+
28
+ request_options
29
+ end
30
+
31
+ def _check_headers(request_options = nil, extra_headers = nil)
32
+ headers = request_options.nil? ? request_options.get_headers : @request_options.get_headers
33
+
34
+ headers.merge!(extra_headers) unless extra_headers.nil?
35
+
36
+ headers
37
+ end
38
+
39
+ def _get(uri:, filters: nil, request_options: nil)
40
+ raise TypeError, 'Filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)
41
+
42
+ request_options = _check_request_options(request_options)
43
+ headers = _check_headers(request_options)
44
+
45
+ @http_client.get(url: @config.api_base_url + uri, headers: headers, params: filters,
46
+ timeout: request_options.connection_timeout, maxretries: request_options.max_retries)
47
+ end
48
+
49
+ def _post(uri:, data:, request_options: nil)
50
+ raise TypeError, 'Data must be a Hash' unless data.nil? || data.is_a?(Hash)
51
+
52
+ request_options = _check_request_options(request_options)
53
+ headers = _check_headers(request_options, { 'Content-Type': @config.mime_json })
54
+
55
+ @http_client.post(url: @config.api_base_url + uri, data: data.to_json, headers: headers,
56
+ timeout: request_options.connection_timeout)
57
+ end
58
+
59
+ def _put(uri:, data:, request_options: nil)
60
+ raise TypeError, 'Data must be a Hash' unless data.nil? || data.is_a?(Hash)
61
+
62
+ request_options = _check_request_options(request_options)
63
+ headers = _check_headers(request_options, { 'Content-Type': @config.mime_json })
64
+
65
+ @http_client.put(url: @config.api_base_url + uri, data: data.to_json, headers: headers,
66
+ timeout: request_options.connection_timeout)
67
+ end
68
+
69
+ def _delete(uri:, request_options: nil)
70
+ request_options = _check_request_options(request_options)
71
+ headers = _check_headers(request_options)
72
+
73
+ @http_client.delete(url: @config.api_base_url + uri, headers: headers,
74
+ timeout: request_options.connection_timeout)
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,74 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require 'rest-client'
5
+ require 'json'
6
+
7
+ module Mercadopago
8
+ class HttpClient
9
+ def get(url:, headers:, params: nil, timeout: nil, maxretries: nil)
10
+ try = 0
11
+ headers = {} if headers.nil?
12
+ headers[:params] = params unless params.nil?
13
+
14
+ begin
15
+ result = RestClient::Request.execute(method: :get, url: url, headers: headers, timeout: timeout)
16
+ {
17
+ status: result.code,
18
+ response: JSON.parse(result.body)
19
+ }
20
+ rescue RestClient::Exception => e
21
+ try += 1
22
+ if [429, 500, 502, 503, 504].include?(e.http_code) && (try < maxretries)
23
+ sleep(1)
24
+ retry
25
+ end
26
+ {
27
+ status: e.http_code,
28
+ response: JSON.parse(e.response.body)
29
+ }
30
+ end
31
+ end
32
+
33
+ def post(url:, data:, headers:, timeout: nil)
34
+ result = RestClient::Request.execute(method: :post, url: url, payload: data, headers: headers,
35
+ timeout: timeout)
36
+ {
37
+ status: result.code,
38
+ response: JSON.parse(result.body)
39
+ }
40
+ rescue RestClient::Exception => e
41
+ {
42
+ status: e.http_code,
43
+ response: JSON.parse(e.response.body)
44
+ }
45
+ end
46
+
47
+ def put(url:, data:, headers:, timeout: nil)
48
+ result = RestClient::Request.execute(method: :put, url: url, payload: data, headers: headers,
49
+ timeout: timeout)
50
+ {
51
+ status: result.code,
52
+ response: JSON.parse(result.body)
53
+ }
54
+ rescue RestClient::Exception => e
55
+ {
56
+ status: e.http_code,
57
+ response: JSON.parse(e.response.body)
58
+ }
59
+ end
60
+
61
+ def delete(url:, headers:, timeout: nil)
62
+ result = RestClient::Request.execute(method: 'delete', url: url, headers: headers, timeout: timeout)
63
+ {
64
+ status: result.code,
65
+ response: JSON.parse(result.body)
66
+ }
67
+ rescue RestClient::Exception => e
68
+ {
69
+ status: e.http_code,
70
+ response: JSON.parse(e.response.body)
71
+ }
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,48 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # Access to Advanced Payments
7
+
8
+ class AdvancedPayment < MPBase
9
+ def search(filters: nil, request_options: nil)
10
+ raise TypeError, 'Param filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)
11
+
12
+ _get(uri: '/v1/advanced_payments/search', filters: filters, request_options: request_options)
13
+ end
14
+
15
+ def get(advanced_payment_id, request_options: nil)
16
+ _get(uri: "/v1/advanced_payments/#{advanced_payment_id}", request_options: request_options)
17
+ end
18
+
19
+ def create(advanced_payment_data, request_options: nil)
20
+ raise TypeError, 'Param advanced_payment_data must be a Hash' unless advanced_payment_data.is_a?(Hash)
21
+
22
+ _post(uri: '/v1/advanced_payments', data: advanced_payment_data, request_options: request_options)
23
+ end
24
+
25
+ def capture(advanced_payment_id, request_options: nil)
26
+ capture_data = { capture: true }
27
+ _put(uri: "/v1/advanced_payments/#{advanced_payment_id}", data: capture_data, request_options: request_options)
28
+ end
29
+
30
+ def update(advanced_payment_id, advanced_payment_data, request_options: nil)
31
+ raise TypeError, 'Param advanced_payment_data must be a Hash' unless advanced_payment_data.is_a?(Hash)
32
+
33
+ _put(uri: "/v1/advanced_payments/#{advanced_payment_id}", data: advanced_payment_data,
34
+ request_options: request_options)
35
+ end
36
+
37
+ def cancel(advanced_payment_id, request_options: nil)
38
+ cancel_data = { status: 'cancelled' }
39
+ _put(uri: "/v1/advanced_payments/#{advanced_payment_id}", data: cancel_data, request_options: request_options)
40
+ end
41
+
42
+ def update_release_date(advanced_payment_id, release_date, request_options: nil)
43
+ disbursement_data = { money_release_date: release_date.strftime('%Y-%m-%d %H:%M:%S.%f') }
44
+ _post(uri: "/v1/advanced_payments/#{advanced_payment_id}/disburses", data: disbursement_data,
45
+ request_options: request_options)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,31 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # The cards class is the way to store card data of your customers safely to improve the shopping experience.
7
+ # This will allow your customers to complete their purchases much faster and easily, since they will not have to complete their card data again.
8
+
9
+ # This class must be used in conjunction with the Customer class.
10
+ # [Click here for more infos](https://www.mercadopago.com/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards)
11
+
12
+ class Card < MPBase
13
+ def get(customer_id, card_id, request_options: nil)
14
+ _get(uri: "/v1/customers/#{customer_id}/cards/#{card_id}", request_options: request_options)
15
+ end
16
+
17
+ def create(customer_id, card_data, request_options: nil)
18
+ raise TypeError, 'Param card_data must be a Hash' if card_data.nil? || !card_data.is_a?(Hash)
19
+
20
+ _post(uri: "/v1/customers/#{customer_id}/cards/", data: card_data, request_options: request_options)
21
+ end
22
+
23
+ def delete(customer_id, card_id, request_options: nil)
24
+ _delete(uri: "/v1/customers/#{customer_id}/cards/#{card_id}", request_options: request_options)
25
+ end
26
+
27
+ def list(customer_id, request_options: nil)
28
+ _get(uri: "/v1/customers/#{customer_id}/cards", request_options: request_options)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ##
6
+ # This class will allow you to send your customers card data for Mercado Pago server and receive a token to complete the payments transactions.
7
+
8
+ class CardToken < MPBase
9
+ def get(card_token_id, request_options: nil)
10
+ _get(uri: "/v1/card_tokens/#{card_token_id}", request_options: request_options)
11
+ end
12
+
13
+ def create(card_token_data, request_options: nil)
14
+ raise TypeError, 'Param card_token_data must be a Hash' unless card_token_data.is_a?(Hash)
15
+
16
+ _post(uri: '/v1/card_tokens', data: card_token_data, request_options: request_options)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,36 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # This class allows you to store customers data safely to improve the shopping experience.
7
+
8
+ # This will allow your customer to complete their purchases much faster and easily when used in conjunction with the Cards class.
9
+ # [Click here for more infos](https://mercadopago.com.br/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards)
10
+
11
+ class Customer < MPBase
12
+ def search(filters: nil, request_options: nil)
13
+ _get(uri: '/v1/customers/search', filters: filters, request_options: request_options)
14
+ end
15
+
16
+ def get(customer_id, request_options: nil)
17
+ _get(uri: "/v1/customers/#{customer_id}", request_options: request_options)
18
+ end
19
+
20
+ def create(customer_data, request_options: nil)
21
+ raise TypeError, 'Param customer_data must be a Hash' unless customer_data.is_a?(Hash)
22
+
23
+ _post(uri: '/v1/customers', data: customer_data, request_options: request_options)
24
+ end
25
+
26
+ def update(customer_id, customer_data, request_options: nil)
27
+ raise TypeError, 'Param customer_data must be a Hash' unless customer_data.is_a?(Hash)
28
+
29
+ _put(uri: "/v1/customers/#{customer_id}", data: customer_data, request_options: request_options)
30
+ end
31
+
32
+ def delete(customer_id, request_options: nil)
33
+ _delete(uri: "/v1/customers/#{customer_id}", request_options: request_options)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ # ###
6
+ # #Access to Advanced Payments Refunds
7
+
8
+ class DisbursementRefund < MPBase
9
+ def list(advanced_payment_id, request_options: nil)
10
+ _get(uri: "/v1/advanced_payments/#{advanced_payment_id}/refunds", request_options: nil)
11
+ end
12
+
13
+ def create_all(advanced_payment_id, request_options: nil)
14
+ _post(uri: "/v1/advanced_payments/#{advanced_payment_id}/refunds", request_options: request_options)
15
+ end
16
+
17
+ def create(advanced_payment_id, disbursement_id, amount: nil, request_options: nil)
18
+ disbursement_refund_data = amount.nil? ? nil : { amount: amount }
19
+
20
+ _post(uri: "/v1/advanced_payments/#{advanced_payment_id}/disbursements/#{disbursement_id}/refunds",
21
+ data: disbursement_refund_data, request_options: request_options)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,13 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # Access to Identification Types
7
+
8
+ class IdentificationType < MPBase
9
+ def get(request_options: nil)
10
+ _get(uri: '/v1/identification_types', request_options: request_options)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # This class will allow you to create and manage your orders. You can attach one or more payments in your merchant order.
7
+
8
+ class MerchantOrder < MPBase
9
+ def search(filters: nil, request_options: nil)
10
+ raise TypeError, 'Param filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)
11
+
12
+ _get(uri: '/merchant_orders/search', filters: filters, request_options: request_options)
13
+ end
14
+
15
+ def get(merchant_order_id, request_options: nil)
16
+ _get(uri: "/merchant_orders/#{merchant_order_id}", request_options: request_options)
17
+ end
18
+
19
+ def create(merchant_order_data, request_options: nil)
20
+ raise TypeError, 'Param merchant_orders_object must be a Hash' unless merchant_order_data.is_a?(Hash)
21
+
22
+ _post(uri: '/merchant_orders', data: merchant_order_data, request_options: request_options)
23
+ end
24
+
25
+ def update(merchant_order_id, merchant_order_data, request_options: nil)
26
+ raise TypeError, 'Param merchant_orders_object must be a Hash' unless merchant_order_data.is_a?(Hash)
27
+
28
+ _put(uri: "/merchant_orders/#{merchant_order_id}", data: merchant_order_data,
29
+ request_options: request_options)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # This class provides the methods to access the API that will allow you to create your own payment experience on your website.
7
+
8
+ # From basic to advanced configurations, you control the whole experience.
9
+
10
+ # [Click here for more infos](https://www.mercadopago.com.br/developers/en/guides/online-payments/checkout-api/introduction/)
11
+
12
+ class Payment < MPBase
13
+ def search(filters: nil, request_options: nil)
14
+ raise TypeError, 'Param filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)
15
+
16
+ _get(uri: '/v1/payments/search', filters: filters, request_options: request_options)
17
+ end
18
+
19
+ def get(payment_id, request_options: nil)
20
+ _get(uri: "/v1/payments/#{payment_id}", request_options: request_options)
21
+ end
22
+
23
+ def create(payment_data, request_options: nil)
24
+ raise TypeError, 'Param payment_data must be a Hash' unless payment_data.is_a?(Hash)
25
+
26
+ _post(uri: '/v1/payments/', data: payment_data, request_options: request_options)
27
+ end
28
+
29
+ def update(payment_id, payment_data, request_options: nil)
30
+ raise TypeError, 'Param payment_data must be a Hash' unless payment_data.is_a?(Hash)
31
+
32
+ _put(uri: "/v1/payments/#{payment_id}", data: payment_data, request_options: request_options)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ###
6
+ # Access to Payment Methods
7
+
8
+ class PaymentMethods < MPBase
9
+ def get(request_options: nil)
10
+ _get(uri: '/v1/payment_methods', request_options: request_options)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Mercadopago
5
+ ##
6
+ # This class will allow you to charge your customers through our web form from any device in a simple, fast and secure way.
7
+ # [Click here for more infos](https://www.mercadopago.com.br/developers/en/guides/online-payments/checkout-pro/introduction)
8
+
9
+ class Preference < MPBase
10
+ def get(preference_id, request_options: nil)
11
+ _get(uri: "/checkout/preferences/#{preference_id}", request_options: request_options)
12
+ end
13
+
14
+ def create(preference_data, request_options: nil)
15
+ raise TypeError, 'Param preference_data must be a Hash' unless preference_data.is_a?(Hash)
16
+
17
+ _post(uri: '/checkout/preferences', data: preference_data, request_options: request_options)
18
+ end
19
+
20
+ def update(preference_id, preference_data, request_options: nil)
21
+ raise TypeError, 'Param preference_data must be a Hash' unless preference_data.is_a?(Hash)
22
+
23
+ _put(uri: "/checkout/preferences/#{preference_id}", data: preference_data, request_options: request_options)
24
+ end
25
+ end
26
+ end