square.rb 44.1.0.20250924 → 45.0.1.20260122

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 (541) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +9 -0
  3. data/.fernignore +20 -0
  4. data/.rubocop.yml +60 -0
  5. data/LICENSE +1 -1
  6. data/Rakefile +29 -0
  7. data/custom.gemspec.rb +19 -0
  8. data/lib/square/apple_pay/client.rb +24 -10
  9. data/lib/square/bank_accounts/client.rb +144 -31
  10. data/lib/square/bank_accounts/types/create_bank_account_request.rb +13 -0
  11. data/lib/square/bank_accounts/types/disable_bank_account_request.rb +11 -0
  12. data/lib/square/bank_accounts/types/get_by_v_1_id_bank_accounts_request.rb +1 -1
  13. data/lib/square/bank_accounts/types/list_bank_accounts_request.rb +1 -0
  14. data/lib/square/bookings/client.rb +238 -100
  15. data/lib/square/bookings/custom_attribute_definitions/client.rb +139 -67
  16. data/lib/square/bookings/custom_attribute_definitions/types/create_booking_custom_attribute_definition_request.rb +1 -3
  17. data/lib/square/bookings/custom_attribute_definitions/types/update_booking_custom_attribute_definition_request.rb +1 -3
  18. data/lib/square/bookings/custom_attributes/client.rb +168 -76
  19. data/lib/square/bookings/custom_attributes/types/bulk_delete_booking_custom_attributes_request.rb +1 -3
  20. data/lib/square/bookings/custom_attributes/types/bulk_upsert_booking_custom_attributes_request.rb +1 -3
  21. data/lib/square/bookings/location_profiles/client.rb +44 -24
  22. data/lib/square/bookings/team_member_profiles/client.rb +66 -31
  23. data/lib/square/cards/client.rb +103 -45
  24. data/lib/square/cash_drawers/client.rb +3 -1
  25. data/lib/square/cash_drawers/shifts/client.rb +121 -61
  26. data/lib/square/catalog/client.rb +203 -91
  27. data/lib/square/catalog/images/client.rb +50 -20
  28. data/lib/square/catalog/object/client.rb +66 -29
  29. data/lib/square/catalog/object/types/delete_object_request.rb +1 -1
  30. data/lib/square/catalog/object/types/get_object_request.rb +1 -1
  31. data/lib/square/catalog/types/batch_upsert_catalog_objects_request.rb +1 -3
  32. data/lib/square/catalog/types/search_catalog_items_request.rb +3 -9
  33. data/lib/square/catalog/types/search_catalog_objects_request.rb +1 -3
  34. data/lib/square/channels/client.rb +131 -0
  35. data/lib/square/channels/types/bulk_retrieve_channels_request.rb +11 -0
  36. data/lib/square/channels/types/get_channels_request.rb +11 -0
  37. data/lib/square/channels/types/list_channels_request.rb +15 -0
  38. data/lib/square/checkout/client.rb +77 -31
  39. data/lib/square/checkout/payment_links/client.rb +120 -54
  40. data/lib/square/client.rb +18 -10
  41. data/lib/square/customers/cards/client.rb +43 -16
  42. data/lib/square/customers/client.rb +220 -97
  43. data/lib/square/customers/custom_attribute_definitions/client.rb +157 -74
  44. data/lib/square/customers/custom_attribute_definitions/types/batch_upsert_customer_custom_attributes_request.rb +1 -3
  45. data/lib/square/customers/custom_attribute_definitions/types/create_customer_custom_attribute_definition_request.rb +1 -3
  46. data/lib/square/customers/custom_attribute_definitions/types/update_customer_custom_attribute_definition_request.rb +1 -3
  47. data/lib/square/customers/custom_attributes/client.rb +117 -53
  48. data/lib/square/customers/groups/client.rb +156 -67
  49. data/lib/square/customers/segments/client.rb +62 -31
  50. data/lib/square/customers/types/bulk_create_customers_request.rb +1 -3
  51. data/lib/square/customers/types/bulk_update_customers_request.rb +1 -3
  52. data/lib/square/devices/client.rb +66 -31
  53. data/lib/square/devices/codes/client.rb +83 -38
  54. data/lib/square/disputes/client.rb +140 -60
  55. data/lib/square/disputes/evidence/client.rb +83 -39
  56. data/lib/square/employees/client.rb +66 -31
  57. data/lib/square/events/client.rb +80 -38
  58. data/lib/square/file_param.rb +77 -77
  59. data/lib/square/gift_cards/activities/client.rb +73 -31
  60. data/lib/square/gift_cards/client.rb +163 -69
  61. data/lib/square/internal/http/base_request.rb +6 -0
  62. data/lib/square/internal/http/raw_client.rb +111 -20
  63. data/lib/square/internal/iterators/cursor_item_iterator.rb +28 -0
  64. data/lib/square/internal/iterators/cursor_page_iterator.rb +51 -0
  65. data/lib/square/internal/iterators/item_iterator.rb +65 -0
  66. data/lib/square/internal/iterators/offset_item_iterator.rb +30 -0
  67. data/lib/square/internal/iterators/offset_page_iterator.rb +83 -0
  68. data/lib/square/internal/json/request.rb +2 -1
  69. data/lib/square/internal/multipart/multipart_request.rb +2 -1
  70. data/lib/square/internal/types/enum.rb +8 -0
  71. data/lib/square/internal/types/model/field.rb +11 -1
  72. data/lib/square/internal/types/model.rb +14 -4
  73. data/lib/square/internal/types/union.rb +88 -7
  74. data/lib/square/internal/types/utils.rb +20 -4
  75. data/lib/square/inventory/client.rb +100 -76
  76. data/lib/square/invoices/client.rb +228 -99
  77. data/lib/square/labor/break_types/client.rb +120 -53
  78. data/lib/square/labor/client.rb +205 -81
  79. data/lib/square/labor/employee_wages/client.rb +64 -31
  80. data/lib/square/labor/shifts/client.rb +94 -37
  81. data/lib/square/labor/team_member_wages/client.rb +64 -31
  82. data/lib/square/labor/types/bulk_publish_scheduled_shifts_request.rb +2 -6
  83. data/lib/square/labor/types/publish_scheduled_shift_request.rb +1 -3
  84. data/lib/square/labor/workweek_configs/client.rb +65 -32
  85. data/lib/square/locations/client.rb +102 -41
  86. data/lib/square/locations/custom_attribute_definitions/client.rb +135 -64
  87. data/lib/square/locations/custom_attribute_definitions/types/create_location_custom_attribute_definition_request.rb +1 -3
  88. data/lib/square/locations/custom_attribute_definitions/types/update_location_custom_attribute_definition_request.rb +1 -3
  89. data/lib/square/locations/custom_attributes/client.rb +156 -68
  90. data/lib/square/locations/custom_attributes/types/bulk_delete_location_custom_attributes_request.rb +1 -3
  91. data/lib/square/locations/custom_attributes/types/bulk_upsert_location_custom_attributes_request.rb +1 -3
  92. data/lib/square/locations/transactions/client.rb +93 -37
  93. data/lib/square/locations/types/create_checkout_request.rb +1 -3
  94. data/lib/square/loyalty/accounts/client.rb +109 -44
  95. data/lib/square/loyalty/accounts/types/search_loyalty_accounts_request.rb +1 -3
  96. data/lib/square/loyalty/client.rb +20 -8
  97. data/lib/square/loyalty/programs/client.rb +72 -29
  98. data/lib/square/loyalty/programs/promotions/client.rb +106 -46
  99. data/lib/square/loyalty/programs/promotions/types/cancel_promotions_request.rb +1 -1
  100. data/lib/square/loyalty/programs/promotions/types/get_promotions_request.rb +1 -1
  101. data/lib/square/loyalty/rewards/client.rb +96 -38
  102. data/lib/square/loyalty/rewards/types/search_loyalty_rewards_request.rb +1 -3
  103. data/lib/square/merchants/client.rb +60 -31
  104. data/lib/square/merchants/custom_attribute_definitions/client.rb +137 -65
  105. data/lib/square/merchants/custom_attribute_definitions/types/create_merchant_custom_attribute_definition_request.rb +1 -3
  106. data/lib/square/merchants/custom_attribute_definitions/types/update_merchant_custom_attribute_definition_request.rb +1 -3
  107. data/lib/square/merchants/custom_attributes/client.rb +156 -68
  108. data/lib/square/merchants/custom_attributes/types/bulk_delete_merchant_custom_attributes_request.rb +1 -3
  109. data/lib/square/merchants/custom_attributes/types/bulk_upsert_merchant_custom_attributes_request.rb +1 -3
  110. data/lib/square/o_auth/client.rb +76 -31
  111. data/lib/square/o_auth/types/obtain_token_request.rb +1 -0
  112. data/lib/square/orders/client.rb +156 -63
  113. data/lib/square/orders/custom_attribute_definitions/client.rb +137 -65
  114. data/lib/square/orders/custom_attribute_definitions/types/create_order_custom_attribute_definition_request.rb +1 -3
  115. data/lib/square/orders/custom_attribute_definitions/types/update_order_custom_attribute_definition_request.rb +1 -3
  116. data/lib/square/orders/custom_attributes/client.rb +159 -69
  117. data/lib/square/orders/custom_attributes/types/bulk_delete_order_custom_attributes_request.rb +1 -3
  118. data/lib/square/orders/custom_attributes/types/bulk_upsert_order_custom_attributes_request.rb +1 -3
  119. data/lib/square/orders/types/calculate_order_request.rb +1 -3
  120. data/lib/square/payments/client.rb +182 -70
  121. data/lib/square/payouts/client.rb +116 -54
  122. data/lib/square/refunds/client.rb +97 -40
  123. data/lib/square/refunds/types/refund_payment_request.rb +1 -3
  124. data/lib/square/sites/client.rb +26 -11
  125. data/lib/square/snippets/client.rb +73 -28
  126. data/lib/square/subscriptions/client.rb +271 -117
  127. data/lib/square/team/client.rb +81 -36
  128. data/lib/square/team_members/client.rb +119 -49
  129. data/lib/square/team_members/types/batch_create_team_members_request.rb +1 -3
  130. data/lib/square/team_members/types/batch_update_team_members_request.rb +1 -3
  131. data/lib/square/team_members/wage_setting/client.rb +48 -19
  132. data/lib/square/terminal/actions/client.rb +75 -30
  133. data/lib/square/terminal/checkouts/client.rb +76 -30
  134. data/lib/square/terminal/client.rb +60 -23
  135. data/lib/square/terminal/refunds/client.rb +78 -31
  136. data/lib/square/transfer_orders/client.rb +292 -0
  137. data/lib/square/transfer_orders/types/cancel_transfer_order_request.rb +13 -0
  138. data/lib/square/transfer_orders/types/create_transfer_order_request.rb +12 -0
  139. data/lib/square/transfer_orders/types/delete_transfer_orders_request.rb +12 -0
  140. data/lib/square/transfer_orders/types/get_transfer_orders_request.rb +11 -0
  141. data/lib/square/transfer_orders/types/receive_transfer_order_request.rb +14 -0
  142. data/lib/square/transfer_orders/types/search_transfer_orders_request.rb +13 -0
  143. data/lib/square/transfer_orders/types/start_transfer_order_request.rb +13 -0
  144. data/lib/square/transfer_orders/types/update_transfer_order_request.rb +14 -0
  145. data/lib/square/types/address.rb +2 -1
  146. data/lib/square/types/application_details.rb +1 -3
  147. data/lib/square/types/application_type.rb +23 -0
  148. data/lib/square/types/availability.rb +3 -4
  149. data/lib/square/types/bank_account.rb +1 -0
  150. data/lib/square/types/batch_create_team_members_response.rb +1 -3
  151. data/lib/square/types/batch_create_vendors_response.rb +1 -3
  152. data/lib/square/types/batch_get_catalog_objects_response.rb +1 -3
  153. data/lib/square/types/batch_get_vendors_response.rb +1 -3
  154. data/lib/square/types/batch_update_team_members_response.rb +1 -3
  155. data/lib/square/types/batch_update_vendors_response.rb +1 -3
  156. data/lib/square/types/batch_upsert_catalog_objects_response.rb +1 -3
  157. data/lib/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.rb +2 -1
  158. data/lib/square/types/batch_upsert_customer_custom_attributes_response.rb +4 -4
  159. data/lib/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.rb +3 -1
  160. data/lib/square/types/booking.rb +2 -6
  161. data/lib/square/types/booking_created_event.rb +2 -1
  162. data/lib/square/types/booking_custom_attribute_definition_visible_created_event.rb +2 -1
  163. data/lib/square/types/booking_custom_attribute_definition_visible_deleted_event.rb +2 -1
  164. data/lib/square/types/booking_custom_attribute_definition_visible_updated_event.rb +2 -1
  165. data/lib/square/types/booking_custom_attribute_delete_request.rb +4 -2
  166. data/lib/square/types/booking_custom_attribute_delete_response.rb +3 -1
  167. data/lib/square/types/booking_custom_attribute_upsert_request.rb +2 -1
  168. data/lib/square/types/booking_custom_attribute_upsert_response.rb +3 -1
  169. data/lib/square/types/booking_updated_event.rb +2 -1
  170. data/lib/square/types/bulk_create_customers_response.rb +1 -3
  171. data/lib/square/types/bulk_delete_booking_custom_attributes_response.rb +4 -4
  172. data/lib/square/types/bulk_delete_customers_response.rb +1 -3
  173. data/lib/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.rb +2 -1
  174. data/lib/square/types/bulk_delete_location_custom_attributes_response.rb +4 -4
  175. data/lib/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.rb +2 -1
  176. data/lib/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.rb +2 -1
  177. data/lib/square/types/bulk_delete_merchant_custom_attributes_response.rb +4 -4
  178. data/lib/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.rb +2 -1
  179. data/lib/square/types/bulk_delete_order_custom_attributes_response.rb +1 -3
  180. data/lib/square/types/bulk_publish_scheduled_shifts_response.rb +1 -3
  181. data/lib/square/types/bulk_retrieve_bookings_response.rb +1 -3
  182. data/lib/square/types/bulk_retrieve_channels_request_constants.rb +23 -0
  183. data/lib/square/types/bulk_retrieve_channels_response.rb +12 -0
  184. data/lib/square/types/bulk_retrieve_customers_response.rb +1 -3
  185. data/lib/square/types/bulk_retrieve_team_member_booking_profiles_response.rb +3 -4
  186. data/lib/square/types/bulk_update_customers_response.rb +1 -3
  187. data/lib/square/types/bulk_upsert_booking_custom_attributes_response.rb +4 -4
  188. data/lib/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.rb +2 -1
  189. data/lib/square/types/bulk_upsert_location_custom_attributes_response.rb +4 -4
  190. data/lib/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.rb +3 -1
  191. data/lib/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.rb +2 -1
  192. data/lib/square/types/bulk_upsert_merchant_custom_attributes_response.rb +4 -4
  193. data/lib/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.rb +3 -1
  194. data/lib/square/types/bulk_upsert_order_custom_attributes_response.rb +1 -3
  195. data/lib/square/types/business_appointment_settings.rb +4 -12
  196. data/lib/square/types/business_booking_profile.rb +2 -6
  197. data/lib/square/types/buy_now_pay_later_details.rb +1 -0
  198. data/lib/square/types/cancel_transfer_order_response.rb +11 -0
  199. data/lib/square/types/card.rb +2 -0
  200. data/lib/square/types/card_issuer_alert.rb +23 -0
  201. data/lib/square/types/catalog_category.rb +1 -3
  202. data/lib/square/types/catalog_custom_attribute_definition.rb +6 -18
  203. data/lib/square/types/catalog_custom_attribute_definition_selection_config.rb +1 -3
  204. data/lib/square/types/catalog_id_mapping.rb +1 -1
  205. data/lib/square/types/catalog_info_response.rb +1 -3
  206. data/lib/square/types/catalog_item.rb +6 -12
  207. data/lib/square/types/catalog_item_food_and_beverage_details.rb +2 -6
  208. data/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference.rb +2 -6
  209. data/lib/square/types/catalog_item_food_and_beverage_details_ingredient.rb +2 -6
  210. data/lib/square/types/catalog_item_modifier_list_info.rb +6 -9
  211. data/lib/square/types/catalog_item_variation.rb +17 -13
  212. data/lib/square/types/catalog_modifier.rb +4 -4
  213. data/lib/square/types/catalog_modifier_list.rb +4 -2
  214. data/lib/square/types/catalog_modifier_override.rb +2 -2
  215. data/lib/square/types/catalog_modifier_toggle_override_type.rb +13 -0
  216. data/lib/square/types/catalog_object.rb +7 -3
  217. data/lib/square/types/catalog_object_base.rb +2 -4
  218. data/lib/square/types/catalog_object_category.rb +3 -4
  219. data/lib/square/types/catalog_object_custom_attribute_definition.rb +1 -3
  220. data/lib/square/types/catalog_object_quick_amounts_settings.rb +1 -3
  221. data/lib/square/types/catalog_object_reference.rb +1 -1
  222. data/lib/square/types/catalog_object_subscription_plan_variation.rb +1 -3
  223. data/lib/square/types/catalog_query.rb +11 -13
  224. data/lib/square/types/catalog_query_prefix.rb +2 -1
  225. data/lib/square/types/catalog_query_text.rb +2 -1
  226. data/lib/square/types/catalog_subscription_plan.rb +5 -5
  227. data/lib/square/types/catalog_subscription_plan_variation.rb +4 -2
  228. data/lib/square/types/catalog_v_1_id.rb +1 -1
  229. data/lib/square/types/catalog_version_updated_event_object.rb +1 -3
  230. data/lib/square/types/channel.rb +16 -0
  231. data/lib/square/types/channel_status.rb +12 -0
  232. data/lib/square/types/checkout.rb +1 -3
  233. data/lib/square/types/checkout_location_settings.rb +1 -3
  234. data/lib/square/types/checkout_location_settings_branding.rb +2 -6
  235. data/lib/square/types/checkout_merchant_settings.rb +1 -3
  236. data/lib/square/types/checkout_merchant_settings_payment_methods.rb +4 -12
  237. data/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.rb +2 -6
  238. data/lib/square/types/component.rb +4 -12
  239. data/lib/square/types/create_bank_account_response.rb +11 -0
  240. data/lib/square/types/create_booking_custom_attribute_definition_response.rb +4 -4
  241. data/lib/square/types/create_catalog_image_request.rb +1 -1
  242. data/lib/square/types/create_customer_custom_attribute_definition_response.rb +4 -4
  243. data/lib/square/types/create_location_custom_attribute_definition_response.rb +4 -4
  244. data/lib/square/types/create_merchant_custom_attribute_definition_response.rb +4 -4
  245. data/lib/square/types/create_order_custom_attribute_definition_response.rb +1 -3
  246. data/lib/square/types/create_transfer_order_data.rb +19 -0
  247. data/lib/square/types/create_transfer_order_line_data.rb +12 -0
  248. data/lib/square/types/create_transfer_order_response.rb +11 -0
  249. data/lib/square/types/create_webhook_subscription_response.rb +2 -1
  250. data/lib/square/types/custom_attribute.rb +1 -1
  251. data/lib/square/types/custom_attribute_definition.rb +1 -3
  252. data/lib/square/types/custom_attribute_definition_event_data_object.rb +1 -3
  253. data/lib/square/types/custom_field.rb +2 -1
  254. data/lib/square/types/customer_address_filter.rb +2 -1
  255. data/lib/square/types/customer_created_event.rb +4 -2
  256. data/lib/square/types/customer_created_event_event_context_merge.rb +2 -1
  257. data/lib/square/types/customer_creation_source_filter.rb +1 -3
  258. data/lib/square/types/customer_custom_attribute_filter.rb +2 -1
  259. data/lib/square/types/customer_custom_attribute_filter_value.rb +2 -1
  260. data/lib/square/types/customer_custom_attribute_filters.rb +7 -6
  261. data/lib/square/types/customer_custom_attribute_visible_updated_event.rb +6 -3
  262. data/lib/square/types/customer_deleted_event.rb +4 -2
  263. data/lib/square/types/customer_deleted_event_event_context_merge.rb +2 -1
  264. data/lib/square/types/customer_tax_ids.rb +4 -2
  265. data/lib/square/types/customer_updated_event.rb +4 -2
  266. data/lib/square/types/delete_booking_custom_attribute_definition_response.rb +5 -2
  267. data/lib/square/types/delete_booking_custom_attribute_response.rb +2 -1
  268. data/lib/square/types/delete_customer_custom_attribute_response.rb +2 -1
  269. data/lib/square/types/delete_location_custom_attribute_response.rb +2 -1
  270. data/lib/square/types/delete_merchant_custom_attribute_response.rb +2 -1
  271. data/lib/square/types/delete_subscription_action_response.rb +2 -1
  272. data/lib/square/types/delete_transfer_order_response.rb +10 -0
  273. data/lib/square/types/delete_webhook_subscription_response.rb +2 -1
  274. data/lib/square/types/destination_details.rb +1 -3
  275. data/lib/square/types/device_checkout_options.rb +1 -0
  276. data/lib/square/types/device_component_details_ethernet_details.rb +1 -1
  277. data/lib/square/types/device_component_details_wi_fi_details.rb +1 -1
  278. data/lib/square/types/digital_wallet_details.rb +1 -0
  279. data/lib/square/types/disable_bank_account_response.rb +11 -0
  280. data/lib/square/types/dispute.rb +2 -1
  281. data/lib/square/types/dispute_evidence_added_event.rb +2 -1
  282. data/lib/square/types/dispute_evidence_created_event.rb +2 -1
  283. data/lib/square/types/employee_wage.rb +2 -1
  284. data/lib/square/types/error_code.rb +2 -0
  285. data/lib/square/types/event_data.rb +1 -3
  286. data/lib/square/types/fulfillment.rb +4 -7
  287. data/lib/square/types/fulfillment_delivery_details.rb +1 -3
  288. data/lib/square/types/fulfillment_pickup_details.rb +1 -3
  289. data/lib/square/types/get_bank_account_response.rb +1 -1
  290. data/lib/square/types/get_booking_request.rb +23 -0
  291. data/lib/square/types/get_business_booking_profile_request.rb +23 -0
  292. data/lib/square/types/get_card_request.rb +23 -0
  293. data/lib/square/types/get_catalog_object_response.rb +1 -3
  294. data/lib/square/types/get_customer_custom_attribute_definition_response.rb +4 -4
  295. data/lib/square/types/get_customer_custom_attribute_response.rb +2 -1
  296. data/lib/square/types/get_customer_group_request.rb +23 -0
  297. data/lib/square/types/get_customer_request.rb +23 -0
  298. data/lib/square/types/get_customer_segment_request.rb +23 -0
  299. data/lib/square/types/get_dispute_evidence_request.rb +23 -0
  300. data/lib/square/types/get_dispute_request.rb +23 -0
  301. data/lib/square/types/get_employee_request.rb +23 -0
  302. data/lib/square/types/get_gift_card_request.rb +23 -0
  303. data/lib/square/types/get_inventory_adjustment_request.rb +23 -0
  304. data/lib/square/types/get_inventory_physical_count_request.rb +23 -0
  305. data/lib/square/types/get_inventory_transfer_request.rb +23 -0
  306. data/lib/square/types/get_location_request.rb +23 -0
  307. data/lib/square/types/get_loyalty_account_request.rb +23 -0
  308. data/lib/square/types/get_loyalty_program_request.rb +23 -0
  309. data/lib/square/types/get_loyalty_promotion_request.rb +23 -0
  310. data/lib/square/types/get_loyalty_reward_request.rb +23 -0
  311. data/lib/square/types/get_merchant_request.rb +23 -0
  312. data/lib/square/types/get_order_request.rb +23 -0
  313. data/lib/square/types/get_payment_link_request.rb +23 -0
  314. data/lib/square/types/get_snippet_request.rb +23 -0
  315. data/lib/square/types/get_team_member_booking_profile_request.rb +23 -0
  316. data/lib/square/types/get_team_member_booking_profile_response.rb +1 -3
  317. data/lib/square/types/get_team_member_request.rb +23 -0
  318. data/lib/square/types/get_transaction_request.rb +23 -0
  319. data/lib/square/types/get_vendor_request.rb +23 -0
  320. data/lib/square/types/get_wage_setting_request.rb +23 -0
  321. data/lib/square/types/get_webhook_subscription_request.rb +23 -0
  322. data/lib/square/types/get_webhook_subscription_response.rb +2 -1
  323. data/lib/square/types/gift_card_activity.rb +8 -24
  324. data/lib/square/types/gift_card_activity_block_reason.rb +23 -0
  325. data/lib/square/types/gift_card_activity_unblock_reason.rb +23 -0
  326. data/lib/square/types/gift_card_activity_updated_event.rb +2 -1
  327. data/lib/square/types/inventory_count_updated_event_object.rb +1 -3
  328. data/lib/square/types/invoice.rb +6 -13
  329. data/lib/square/types/invoice_accepted_payment_methods.rb +2 -1
  330. data/lib/square/types/invoice_attachment.rb +1 -1
  331. data/lib/square/types/invoice_custom_field.rb +2 -1
  332. data/lib/square/types/invoice_payment_made_event.rb +2 -1
  333. data/lib/square/types/invoice_payment_request.rb +6 -8
  334. data/lib/square/types/invoice_refunded_event.rb +2 -1
  335. data/lib/square/types/invoice_sort_field.rb +23 -0
  336. data/lib/square/types/labor_scheduled_shift_created_event_object.rb +1 -1
  337. data/lib/square/types/labor_scheduled_shift_published_event_object.rb +1 -1
  338. data/lib/square/types/labor_scheduled_shift_updated_event_object.rb +1 -1
  339. data/lib/square/types/list_bank_accounts_response.rb +1 -1
  340. data/lib/square/types/list_booking_custom_attribute_definitions_response.rb +4 -4
  341. data/lib/square/types/list_booking_custom_attributes_response.rb +3 -4
  342. data/lib/square/types/list_cash_drawer_shift_events_response.rb +1 -3
  343. data/lib/square/types/list_cash_drawer_shifts_response.rb +1 -3
  344. data/lib/square/types/list_channels_request_constants.rb +23 -0
  345. data/lib/square/types/list_channels_response.rb +11 -0
  346. data/lib/square/types/list_customer_custom_attribute_definitions_response.rb +4 -4
  347. data/lib/square/types/list_customer_custom_attributes_response.rb +3 -4
  348. data/lib/square/types/list_gift_card_activities_response.rb +1 -3
  349. data/lib/square/types/list_location_booking_profiles_response.rb +1 -3
  350. data/lib/square/types/list_location_custom_attribute_definitions_response.rb +4 -4
  351. data/lib/square/types/list_location_custom_attributes_response.rb +3 -4
  352. data/lib/square/types/list_loyalty_promotions_response.rb +1 -3
  353. data/lib/square/types/list_merchant_custom_attribute_definitions_response.rb +4 -4
  354. data/lib/square/types/list_merchant_custom_attributes_response.rb +3 -4
  355. data/lib/square/types/list_order_custom_attribute_definitions_response.rb +1 -3
  356. data/lib/square/types/list_order_custom_attributes_response.rb +1 -3
  357. data/lib/square/types/list_subscription_events_response.rb +1 -3
  358. data/lib/square/types/list_team_member_booking_profiles_response.rb +1 -3
  359. data/lib/square/types/list_team_member_wages_response.rb +1 -3
  360. data/lib/square/types/list_webhook_subscriptions_response.rb +1 -3
  361. data/lib/square/types/list_workweek_configs_response.rb +1 -3
  362. data/lib/square/types/location.rb +1 -3
  363. data/lib/square/types/location_booking_profile.rb +2 -1
  364. data/lib/square/types/location_custom_attribute_visible_updated_event.rb +6 -3
  365. data/lib/square/types/loyalty_account.rb +1 -3
  366. data/lib/square/types/loyalty_account_mapping_type.rb +23 -0
  367. data/lib/square/types/loyalty_event.rb +3 -4
  368. data/lib/square/types/loyalty_event_filter.rb +1 -3
  369. data/lib/square/types/loyalty_program.rb +4 -7
  370. data/lib/square/types/loyalty_program_accrual_rule.rb +3 -4
  371. data/lib/square/types/loyalty_program_reward_tier.rb +3 -1
  372. data/lib/square/types/loyalty_promotion_incentive.rb +2 -6
  373. data/lib/square/types/loyalty_promotion_incentive_points_addition_data.rb +2 -1
  374. data/lib/square/types/loyalty_promotion_incentive_points_multiplier_data.rb +2 -1
  375. data/lib/square/types/loyalty_promotion_trigger_limit.rb +2 -1
  376. data/lib/square/types/loyalty_reward.rb +4 -2
  377. data/lib/square/types/measurement_unit_generic.rb +23 -0
  378. data/lib/square/types/oauth_authorization_revoked_event_object.rb +1 -3
  379. data/lib/square/types/oauth_authorization_revoked_event_revocation_object.rb +1 -3
  380. data/lib/square/types/order.rb +2 -6
  381. data/lib/square/types/order_card_surcharge_treatment_type.rb +12 -0
  382. data/lib/square/types/order_custom_attribute_definition_owned_created_event.rb +2 -1
  383. data/lib/square/types/order_custom_attribute_definition_owned_deleted_event.rb +2 -1
  384. data/lib/square/types/order_custom_attribute_definition_owned_updated_event.rb +2 -1
  385. data/lib/square/types/order_custom_attribute_definition_visible_created_event.rb +2 -1
  386. data/lib/square/types/order_custom_attribute_definition_visible_deleted_event.rb +2 -1
  387. data/lib/square/types/order_custom_attribute_definition_visible_updated_event.rb +2 -1
  388. data/lib/square/types/order_custom_attribute_owned_deleted_event.rb +2 -1
  389. data/lib/square/types/order_custom_attribute_owned_updated_event.rb +2 -1
  390. data/lib/square/types/order_custom_attribute_visible_deleted_event.rb +2 -1
  391. data/lib/square/types/order_custom_attribute_visible_updated_event.rb +2 -1
  392. data/lib/square/types/order_fulfillment_updated.rb +1 -3
  393. data/lib/square/types/order_line_item.rb +4 -12
  394. data/lib/square/types/order_line_item_applied_tax.rb +1 -0
  395. data/lib/square/types/order_line_item_pricing_blocklists.rb +3 -6
  396. data/lib/square/types/order_line_item_pricing_blocklists_blocked_service_charge.rb +14 -0
  397. data/lib/square/types/order_return.rb +3 -9
  398. data/lib/square/types/order_return_line_item.rb +4 -12
  399. data/lib/square/types/order_return_service_charge.rb +3 -6
  400. data/lib/square/types/order_service_charge.rb +2 -6
  401. data/lib/square/types/payment.rb +1 -3
  402. data/lib/square/types/payment_link_related_resources.rb +1 -3
  403. data/lib/square/types/payment_refund.rb +1 -3
  404. data/lib/square/types/payout_entry.rb +24 -72
  405. data/lib/square/types/pre_populated_data.rb +2 -1
  406. data/lib/square/types/product_type.rb +23 -0
  407. data/lib/square/types/receive_transfer_order_response.rb +11 -0
  408. data/lib/square/types/reference.rb +10 -0
  409. data/lib/square/types/reference_type.rb +25 -0
  410. data/lib/square/types/refund.rb +1 -3
  411. data/lib/square/types/retrieve_booking_custom_attribute_definition_response.rb +4 -4
  412. data/lib/square/types/retrieve_booking_custom_attribute_response.rb +2 -1
  413. data/lib/square/types/retrieve_channel_response.rb +10 -0
  414. data/lib/square/types/retrieve_location_custom_attribute_definition_response.rb +4 -4
  415. data/lib/square/types/retrieve_location_custom_attribute_response.rb +2 -1
  416. data/lib/square/types/retrieve_merchant_custom_attribute_definition_response.rb +4 -4
  417. data/lib/square/types/retrieve_merchant_custom_attribute_response.rb +2 -1
  418. data/lib/square/types/retrieve_order_custom_attribute_definition_response.rb +1 -3
  419. data/lib/square/types/retrieve_transfer_order_response.rb +11 -0
  420. data/lib/square/types/scheduled_shift_filter.rb +3 -7
  421. data/lib/square/types/scheduled_shift_workday.rb +1 -3
  422. data/lib/square/types/search_availability_filter.rb +1 -3
  423. data/lib/square/types/search_catalog_items_response.rb +2 -1
  424. data/lib/square/types/search_catalog_objects_response.rb +1 -3
  425. data/lib/square/types/search_events_sort_field.rb +23 -0
  426. data/lib/square/types/search_loyalty_accounts_request_loyalty_account_query.rb +1 -3
  427. data/lib/square/types/search_loyalty_accounts_response.rb +1 -3
  428. data/lib/square/types/search_orders_date_time_filter.rb +2 -1
  429. data/lib/square/types/search_orders_fulfillment_filter.rb +2 -6
  430. data/lib/square/types/search_orders_source_filter.rb +2 -0
  431. data/lib/square/types/search_scheduled_shifts_response.rb +1 -3
  432. data/lib/square/types/search_transfer_orders_response.rb +12 -0
  433. data/lib/square/types/shift_filter.rb +3 -2
  434. data/lib/square/types/shift_query.rb +2 -1
  435. data/lib/square/types/shift_sort.rb +2 -1
  436. data/lib/square/types/shift_wage.rb +2 -1
  437. data/lib/square/types/shift_workday.rb +2 -1
  438. data/lib/square/types/snippet.rb +2 -1
  439. data/lib/square/types/standard_unit_description_group.rb +1 -3
  440. data/lib/square/types/start_transfer_order_response.rb +11 -0
  441. data/lib/square/types/subscription_event.rb +1 -3
  442. data/lib/square/types/subscription_phase.rb +2 -1
  443. data/lib/square/types/subscription_test_result.rb +5 -3
  444. data/lib/square/types/team_member_assigned_locations.rb +1 -3
  445. data/lib/square/types/team_member_booking_profile.rb +2 -1
  446. data/lib/square/types/tender.rb +2 -6
  447. data/lib/square/types/tender_buy_now_pay_later_details.rb +1 -3
  448. data/lib/square/types/terminal_refund.rb +2 -1
  449. data/lib/square/types/test_webhook_subscription_response.rb +5 -5
  450. data/lib/square/types/timecard_filter.rb +1 -1
  451. data/lib/square/types/transfer_order.rb +35 -0
  452. data/lib/square/types/transfer_order_created_event.rb +14 -0
  453. data/lib/square/types/transfer_order_created_event_data.rb +11 -0
  454. data/lib/square/types/transfer_order_created_event_object.rb +9 -0
  455. data/lib/square/types/transfer_order_deleted_event.rb +14 -0
  456. data/lib/square/types/transfer_order_deleted_event_data.rb +11 -0
  457. data/lib/square/types/transfer_order_filter.rb +12 -0
  458. data/lib/square/types/transfer_order_goods_receipt.rb +27 -0
  459. data/lib/square/types/transfer_order_goods_receipt_line_item.rb +13 -0
  460. data/lib/square/types/transfer_order_line.rb +18 -0
  461. data/lib/square/types/transfer_order_query.rb +11 -0
  462. data/lib/square/types/transfer_order_sort.rb +11 -0
  463. data/lib/square/types/transfer_order_sort_field.rb +12 -0
  464. data/lib/square/types/transfer_order_status.rb +15 -0
  465. data/lib/square/types/transfer_order_updated_event.rb +14 -0
  466. data/lib/square/types/transfer_order_updated_event_data.rb +11 -0
  467. data/lib/square/types/transfer_order_updated_event_object.rb +9 -0
  468. data/lib/square/types/update_booking_custom_attribute_definition_response.rb +4 -4
  469. data/lib/square/types/update_customer_custom_attribute_definition_response.rb +4 -4
  470. data/lib/square/types/update_location_custom_attribute_definition_response.rb +4 -4
  471. data/lib/square/types/update_merchant_custom_attribute_definition_response.rb +4 -4
  472. data/lib/square/types/update_order_custom_attribute_definition_response.rb +1 -3
  473. data/lib/square/types/update_transfer_order_data.rb +15 -0
  474. data/lib/square/types/update_transfer_order_line_data.rb +13 -0
  475. data/lib/square/types/update_transfer_order_response.rb +11 -0
  476. data/lib/square/types/update_webhook_subscription_response.rb +2 -1
  477. data/lib/square/types/update_webhook_subscription_signature_key_response.rb +3 -1
  478. data/lib/square/types/upsert_booking_custom_attribute_response.rb +2 -1
  479. data/lib/square/types/upsert_catalog_object_response.rb +1 -3
  480. data/lib/square/types/upsert_customer_custom_attribute_response.rb +2 -1
  481. data/lib/square/types/upsert_location_custom_attribute_response.rb +2 -1
  482. data/lib/square/types/upsert_merchant_custom_attribute_response.rb +2 -1
  483. data/lib/square/types/v_1_get_payment_request.rb +23 -0
  484. data/lib/square/types/v_1_get_settlement_request.rb +23 -0
  485. data/lib/square/types/v_1_order.rb +1 -3
  486. data/lib/square/types/vendor_created_event_object_operation.rb +23 -0
  487. data/lib/square/types/vendor_updated_event_object_operation.rb +23 -0
  488. data/lib/square/types/wage_setting.rb +1 -3
  489. data/lib/square/v_1_transactions/client.rb +72 -29
  490. data/lib/square/vendors/client.rb +126 -51
  491. data/lib/square/vendors/types/batch_update_vendors_request.rb +1 -3
  492. data/lib/square/version.rb +1 -1
  493. data/lib/square/webhooks/client.rb +3 -1
  494. data/lib/square/webhooks/event_types/client.rb +25 -14
  495. data/lib/square/webhooks/subscriptions/client.rb +164 -69
  496. data/lib/square.rb +106 -5
  497. data/lib/square_legacy/utilities/webhooks_helper.rb +1 -1
  498. data/reference.md +29588 -0
  499. data/wiremock/docker-compose.test.yml +14 -0
  500. data/wiremock/wiremock-mappings.json +1 -0
  501. metadata +118 -45
  502. data/lib/square/mobile/client.rb +0 -50
  503. data/lib/square/mobile/types/create_mobile_authorization_code_request.rb +0 -11
  504. data/lib/square/types/create_mobile_authorization_code_response.rb +0 -13
  505. data/test/square/integration/client_tests/test_cash_drawers.rb +0 -27
  506. data/test/square/integration/client_tests/test_catalog.rb +0 -704
  507. data/test/square/integration/client_tests/test_customers.rb +0 -65
  508. data/test/square/integration/client_tests/test_customers_groups.rb +0 -144
  509. data/test/square/integration/client_tests/test_customers_segments.rb +0 -36
  510. data/test/square/integration/client_tests/test_devices.rb +0 -67
  511. data/test/square/integration/client_tests/test_inventory.rb +0 -28
  512. data/test/square/integration/client_tests/test_locations.rb +0 -18
  513. data/test/square/integration/client_tests/test_merchants.rb +0 -40
  514. data/test/square/integration/client_tests/test_mobile.rb +0 -21
  515. data/test/square/integration/client_tests/test_orders.rb +0 -177
  516. data/test/square/integration/client_tests/test_payments.rb +0 -167
  517. data/test/square/integration/client_tests/test_refunds.rb +0 -133
  518. data/test/square/integration/client_tests/test_team_members.rb +0 -97
  519. data/test/square/integration/client_tests/test_terminal.rb +0 -107
  520. data/test/square/integration/integration_test_base.rb +0 -16
  521. data/test/square/integration/testdata/image.jpeg +0 -0
  522. data/test/square/internal/multipart/test_form_data.rb +0 -311
  523. data/test/square/internal/types/test_array.rb +0 -37
  524. data/test/square/internal/types/test_boolean.rb +0 -35
  525. data/test/square/internal/types/test_enum.rb +0 -42
  526. data/test/square/internal/types/test_hash.rb +0 -50
  527. data/test/square/internal/types/test_model.rb +0 -105
  528. data/test/square/internal/types/test_union.rb +0 -52
  529. data/test/square/internal/types/test_utils.rb +0 -216
  530. data/test/square_legacy/api/api_test_base.rb +0 -27
  531. data/test/square_legacy/api/test_catalog_api.rb +0 -57
  532. data/test/square_legacy/api/test_customers_api.rb +0 -43
  533. data/test/square_legacy/api/test_employees_api.rb +0 -34
  534. data/test/square_legacy/api/test_labor_api.rb +0 -82
  535. data/test/square_legacy/api/test_locations_api.rb +0 -22
  536. data/test/square_legacy/api/test_merchants_api.rb +0 -38
  537. data/test/square_legacy/api/test_payments_api.rb +0 -40
  538. data/test/square_legacy/api/test_refunds_api.rb +0 -42
  539. data/test/square_legacy/http_response_catcher.rb +0 -14
  540. data/test/square_legacy/webhooks/test_webhooks_helper.rb +0 -153
  541. data/test/test_helper.rb +0 -123
@@ -4,48 +4,71 @@ module Square
4
4
  module Customers
5
5
  module CustomAttributeDefinitions
6
6
  class Client
7
- # @return [Square::Customers::CustomAttributeDefinitions::Client]
7
+ # @param client [Square::Internal::Http::RawClient]
8
+ #
9
+ # @return [void]
8
10
  def initialize(client:)
9
11
  @client = client
10
12
  end
11
13
 
12
- # Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account.
14
+ # Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a
15
+ # Square seller account.
13
16
  #
14
17
  # When all response pages are retrieved, the results include all custom attribute definitions
15
18
  # that are visible to the requesting application, including those that are created by other
16
19
  # applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that
17
- # seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
20
+ # seller-defined custom attributes (also known as custom fields) are always set to
21
+ # `VISIBILITY_READ_WRITE_VALUES`.
22
+ #
23
+ # @param request_options [Hash]
24
+ # @param params [Hash]
25
+ # @option request_options [String] :base_url
26
+ # @option request_options [Hash{String => Object}] :additional_headers
27
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
28
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
29
+ # @option request_options [Integer] :timeout_in_seconds
30
+ # @option params [Integer, nil] :limit
31
+ # @option params [String, nil] :cursor
18
32
  #
19
33
  # @return [Square::Types::ListCustomerCustomAttributeDefinitionsResponse]
20
34
  def list(request_options: {}, **params)
21
- _query_param_names = [
22
- %w[limit cursor],
23
- %i[limit cursor]
24
- ].flatten
25
- _query = params.slice(*_query_param_names)
26
- params.except(*_query_param_names)
35
+ params = Square::Internal::Types::Utils.normalize_keys(params)
36
+ query_param_names = %i[limit cursor]
37
+ query_params = {}
38
+ query_params["limit"] = params[:limit] if params.key?(:limit)
39
+ query_params["cursor"] = params[:cursor] if params.key?(:cursor)
40
+ params.except(*query_param_names)
27
41
 
28
- _request = Square::Internal::JSON::Request.new(
29
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
30
- method: "GET",
31
- path: "v2/customers/custom-attribute-definitions",
32
- query: _query
33
- )
34
- begin
35
- _response = @client.send(_request)
36
- rescue Net::HTTPRequestTimeout
37
- raise Square::Errors::TimeoutError
38
- end
39
- code = _response.code.to_i
40
- if code.between?(200, 299)
41
- Square::Types::ListCustomerCustomAttributeDefinitionsResponse.load(_response.body)
42
- else
43
- error_class = Square::Errors::ResponseError.subclass_for_code(code)
44
- raise error_class.new(_response.body, code: code)
42
+ Square::Internal::CursorItemIterator.new(
43
+ cursor_field: :cursor,
44
+ item_field: :custom_attribute_definitions,
45
+ initial_cursor: query_params[:cursor]
46
+ ) do |next_cursor|
47
+ query_params[:cursor] = next_cursor
48
+ request = Square::Internal::JSON::Request.new(
49
+ base_url: request_options[:base_url],
50
+ method: "GET",
51
+ path: "v2/customers/custom-attribute-definitions",
52
+ query: query_params,
53
+ request_options: request_options
54
+ )
55
+ begin
56
+ response = @client.send(request)
57
+ rescue Net::HTTPRequestTimeout
58
+ raise Square::Errors::TimeoutError
59
+ end
60
+ code = response.code.to_i
61
+ if code.between?(200, 299)
62
+ Square::Types::ListCustomerCustomAttributeDefinitionsResponse.load(response.body)
63
+ else
64
+ error_class = Square::Errors::ResponseError.subclass_for_code(code)
65
+ raise error_class.new(response.body, code: code)
66
+ end
45
67
  end
46
68
  end
47
69
 
48
- # Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
70
+ # Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller
71
+ # account.
49
72
  # Use this endpoint to define a custom attribute that can be associated with customer profiles.
50
73
  #
51
74
  # A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
@@ -57,64 +80,87 @@ module Square
57
80
  # Sellers can view all custom attributes in exported customer data, including those set to
58
81
  # `VISIBILITY_HIDDEN`.
59
82
  #
83
+ # @param request_options [Hash]
84
+ # @param params [Square::Customers::CustomAttributeDefinitions::Types::CreateCustomerCustomAttributeDefinitionRequest]
85
+ # @option request_options [String] :base_url
86
+ # @option request_options [Hash{String => Object}] :additional_headers
87
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
88
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
89
+ # @option request_options [Integer] :timeout_in_seconds
90
+ #
60
91
  # @return [Square::Types::CreateCustomerCustomAttributeDefinitionResponse]
61
92
  def create(request_options: {}, **params)
62
- _request = Square::Internal::JSON::Request.new(
63
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
93
+ params = Square::Internal::Types::Utils.normalize_keys(params)
94
+ request = Square::Internal::JSON::Request.new(
95
+ base_url: request_options[:base_url],
64
96
  method: "POST",
65
97
  path: "v2/customers/custom-attribute-definitions",
66
- body: params
98
+ body: Square::Customers::CustomAttributeDefinitions::Types::CreateCustomerCustomAttributeDefinitionRequest.new(params).to_h,
99
+ request_options: request_options
67
100
  )
68
101
  begin
69
- _response = @client.send(_request)
102
+ response = @client.send(request)
70
103
  rescue Net::HTTPRequestTimeout
71
104
  raise Square::Errors::TimeoutError
72
105
  end
73
- code = _response.code.to_i
106
+ code = response.code.to_i
74
107
  if code.between?(200, 299)
75
- Square::Types::CreateCustomerCustomAttributeDefinitionResponse.load(_response.body)
108
+ Square::Types::CreateCustomerCustomAttributeDefinitionResponse.load(response.body)
76
109
  else
77
110
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
78
- raise error_class.new(_response.body, code: code)
111
+ raise error_class.new(response.body, code: code)
79
112
  end
80
113
  end
81
114
 
82
- # Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
115
+ # Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square
116
+ # seller account.
83
117
  #
84
118
  # To retrieve a custom attribute definition created by another application, the `visibility`
85
- # setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
119
+ # setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom
120
+ # attributes
86
121
  # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
87
122
  #
123
+ # @param request_options [Hash]
124
+ # @param params [Hash]
125
+ # @option request_options [String] :base_url
126
+ # @option request_options [Hash{String => Object}] :additional_headers
127
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
128
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
129
+ # @option request_options [Integer] :timeout_in_seconds
130
+ # @option params [String] :key
131
+ # @option params [Integer, nil] :version
132
+ #
88
133
  # @return [Square::Types::GetCustomerCustomAttributeDefinitionResponse]
89
134
  def get(request_options: {}, **params)
90
- _query_param_names = [
91
- ["version"],
92
- %i[version]
93
- ].flatten
94
- _query = params.slice(*_query_param_names)
95
- params = params.except(*_query_param_names)
135
+ params = Square::Internal::Types::Utils.normalize_keys(params)
136
+ query_param_names = %i[version]
137
+ query_params = {}
138
+ query_params["version"] = params[:version] if params.key?(:version)
139
+ params = params.except(*query_param_names)
96
140
 
97
- _request = Square::Internal::JSON::Request.new(
98
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
141
+ request = Square::Internal::JSON::Request.new(
142
+ base_url: request_options[:base_url],
99
143
  method: "GET",
100
144
  path: "v2/customers/custom-attribute-definitions/#{params[:key]}",
101
- query: _query
145
+ query: query_params,
146
+ request_options: request_options
102
147
  )
103
148
  begin
104
- _response = @client.send(_request)
149
+ response = @client.send(request)
105
150
  rescue Net::HTTPRequestTimeout
106
151
  raise Square::Errors::TimeoutError
107
152
  end
108
- code = _response.code.to_i
153
+ code = response.code.to_i
109
154
  if code.between?(200, 299)
110
- Square::Types::GetCustomerCustomAttributeDefinitionResponse.load(_response.body)
155
+ Square::Types::GetCustomerCustomAttributeDefinitionResponse.load(response.body)
111
156
  else
112
157
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
113
- raise error_class.new(_response.body, code: code)
158
+ raise error_class.new(response.body, code: code)
114
159
  end
115
160
  end
116
161
 
117
- # Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.
162
+ # Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller
163
+ # account.
118
164
  #
119
165
  # Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
120
166
  # `schema` for a `Selection` data type.
@@ -122,55 +168,80 @@ module Square
122
168
  # Only the definition owner can update a custom attribute definition. Note that sellers can view
123
169
  # all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
124
170
  #
171
+ # @param request_options [Hash]
172
+ # @param params [Square::Customers::CustomAttributeDefinitions::Types::UpdateCustomerCustomAttributeDefinitionRequest]
173
+ # @option request_options [String] :base_url
174
+ # @option request_options [Hash{String => Object}] :additional_headers
175
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
176
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
177
+ # @option request_options [Integer] :timeout_in_seconds
178
+ # @option params [String] :key
179
+ #
125
180
  # @return [Square::Types::UpdateCustomerCustomAttributeDefinitionResponse]
126
181
  def update(request_options: {}, **params)
127
- _path_param_names = ["key"]
182
+ params = Square::Internal::Types::Utils.normalize_keys(params)
183
+ request_data = Square::Customers::CustomAttributeDefinitions::Types::UpdateCustomerCustomAttributeDefinitionRequest.new(params).to_h
184
+ non_body_param_names = ["key"]
185
+ body = request_data.except(*non_body_param_names)
128
186
 
129
- _request = Square::Internal::JSON::Request.new(
130
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
187
+ request = Square::Internal::JSON::Request.new(
188
+ base_url: request_options[:base_url],
131
189
  method: "PUT",
132
190
  path: "v2/customers/custom-attribute-definitions/#{params[:key]}",
133
- body: params.except(*_path_param_names)
191
+ body: body,
192
+ request_options: request_options
134
193
  )
135
194
  begin
136
- _response = @client.send(_request)
195
+ response = @client.send(request)
137
196
  rescue Net::HTTPRequestTimeout
138
197
  raise Square::Errors::TimeoutError
139
198
  end
140
- code = _response.code.to_i
199
+ code = response.code.to_i
141
200
  if code.between?(200, 299)
142
- Square::Types::UpdateCustomerCustomAttributeDefinitionResponse.load(_response.body)
201
+ Square::Types::UpdateCustomerCustomAttributeDefinitionResponse.load(response.body)
143
202
  else
144
203
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
145
- raise error_class.new(_response.body, code: code)
204
+ raise error_class.new(response.body, code: code)
146
205
  end
147
206
  end
148
207
 
149
- # Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account.
208
+ # Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square
209
+ # seller account.
150
210
  #
151
211
  # Deleting a custom attribute definition also deletes the corresponding custom attribute from
152
212
  # all customer profiles in the seller's Customer Directory.
153
213
  #
154
214
  # Only the definition owner can delete a custom attribute definition.
155
215
  #
216
+ # @param request_options [Hash]
217
+ # @param params [Hash]
218
+ # @option request_options [String] :base_url
219
+ # @option request_options [Hash{String => Object}] :additional_headers
220
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
221
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
222
+ # @option request_options [Integer] :timeout_in_seconds
223
+ # @option params [String] :key
224
+ #
156
225
  # @return [Square::Types::DeleteCustomerCustomAttributeDefinitionResponse]
157
226
  def delete(request_options: {}, **params)
158
- _request = Square::Internal::JSON::Request.new(
159
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
227
+ params = Square::Internal::Types::Utils.normalize_keys(params)
228
+ request = Square::Internal::JSON::Request.new(
229
+ base_url: request_options[:base_url],
160
230
  method: "DELETE",
161
- path: "v2/customers/custom-attribute-definitions/#{params[:key]}"
231
+ path: "v2/customers/custom-attribute-definitions/#{params[:key]}",
232
+ request_options: request_options
162
233
  )
163
234
  begin
164
- _response = @client.send(_request)
235
+ response = @client.send(request)
165
236
  rescue Net::HTTPRequestTimeout
166
237
  raise Square::Errors::TimeoutError
167
238
  end
168
- code = _response.code.to_i
239
+ code = response.code.to_i
169
240
  if code.between?(200, 299)
170
- Square::Types::DeleteCustomerCustomAttributeDefinitionResponse.load(_response.body)
241
+ Square::Types::DeleteCustomerCustomAttributeDefinitionResponse.load(response.body)
171
242
  else
172
243
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
173
- raise error_class.new(_response.body, code: code)
244
+ raise error_class.new(response.body, code: code)
174
245
  end
175
246
  end
176
247
 
@@ -178,7 +249,9 @@ module Square
178
249
  #
179
250
  # Use this endpoint to set the value of one or more custom attributes for one or more customer profiles.
180
251
  # A custom attribute is based on a custom attribute definition in a Square seller account, which is
181
- # created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
252
+ # created using the
253
+ # [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition)
254
+ # endpoint.
182
255
  #
183
256
  # This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
184
257
  # requests and returns a map of individual upsert responses. Each upsert request has a unique ID
@@ -189,25 +262,35 @@ module Square
189
262
  # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
190
263
  # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
191
264
  #
265
+ # @param request_options [Hash]
266
+ # @param params [Square::Customers::CustomAttributeDefinitions::Types::BatchUpsertCustomerCustomAttributesRequest]
267
+ # @option request_options [String] :base_url
268
+ # @option request_options [Hash{String => Object}] :additional_headers
269
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
270
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
271
+ # @option request_options [Integer] :timeout_in_seconds
272
+ #
192
273
  # @return [Square::Types::BatchUpsertCustomerCustomAttributesResponse]
193
274
  def batch_upsert(request_options: {}, **params)
194
- _request = Square::Internal::JSON::Request.new(
195
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
275
+ params = Square::Internal::Types::Utils.normalize_keys(params)
276
+ request = Square::Internal::JSON::Request.new(
277
+ base_url: request_options[:base_url],
196
278
  method: "POST",
197
279
  path: "v2/customers/custom-attributes/bulk-upsert",
198
- body: params
280
+ body: Square::Customers::CustomAttributeDefinitions::Types::BatchUpsertCustomerCustomAttributesRequest.new(params).to_h,
281
+ request_options: request_options
199
282
  )
200
283
  begin
201
- _response = @client.send(_request)
284
+ response = @client.send(request)
202
285
  rescue Net::HTTPRequestTimeout
203
286
  raise Square::Errors::TimeoutError
204
287
  end
205
- code = _response.code.to_i
288
+ code = response.code.to_i
206
289
  if code.between?(200, 299)
207
- Square::Types::BatchUpsertCustomerCustomAttributesResponse.load(_response.body)
290
+ Square::Types::BatchUpsertCustomerCustomAttributesResponse.load(response.body)
208
291
  else
209
292
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
210
- raise error_class.new(_response.body, code: code)
293
+ raise error_class.new(response.body, code: code)
211
294
  end
212
295
  end
213
296
  end
@@ -5,9 +5,7 @@ module Square
5
5
  module CustomAttributeDefinitions
6
6
  module Types
7
7
  class BatchUpsertCustomerCustomAttributesRequest < Internal::Types::Model
8
- field :values, lambda {
9
- Internal::Types::Hash[String, Square::Types::BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest]
10
- }, optional: false, nullable: false
8
+ field :values, -> { Internal::Types::Hash[String, Square::Types::BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest] }, optional: false, nullable: false
11
9
  end
12
10
  end
13
11
  end
@@ -5,9 +5,7 @@ module Square
5
5
  module CustomAttributeDefinitions
6
6
  module Types
7
7
  class CreateCustomerCustomAttributeDefinitionRequest < Internal::Types::Model
8
- field :custom_attribute_definition, lambda {
9
- Square::Types::CustomAttributeDefinition
10
- }, optional: false, nullable: false
8
+ field :custom_attribute_definition, -> { Square::Types::CustomAttributeDefinition }, optional: false, nullable: false
11
9
  field :idempotency_key, -> { String }, optional: true, nullable: false
12
10
  end
13
11
  end
@@ -6,9 +6,7 @@ module Square
6
6
  module Types
7
7
  class UpdateCustomerCustomAttributeDefinitionRequest < Internal::Types::Model
8
8
  field :key, -> { String }, optional: false, nullable: false
9
- field :custom_attribute_definition, lambda {
10
- Square::Types::CustomAttributeDefinition
11
- }, optional: false, nullable: false
9
+ field :custom_attribute_definition, -> { Square::Types::CustomAttributeDefinition }, optional: false, nullable: false
12
10
  field :idempotency_key, -> { String }, optional: true, nullable: false
13
11
  end
14
12
  end
@@ -4,7 +4,9 @@ module Square
4
4
  module Customers
5
5
  module CustomAttributes
6
6
  class Client
7
- # @return [Square::Customers::CustomAttributes::Client]
7
+ # @param client [Square::Internal::Http::RawClient]
8
+ #
9
+ # @return [void]
8
10
  def initialize(client:)
9
11
  @client = client
10
12
  end
@@ -18,32 +20,53 @@ module Square
18
20
  # visible to the requesting application, including those that are owned by other applications
19
21
  # and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
20
22
  #
23
+ # @param request_options [Hash]
24
+ # @param params [Hash]
25
+ # @option request_options [String] :base_url
26
+ # @option request_options [Hash{String => Object}] :additional_headers
27
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
28
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
29
+ # @option request_options [Integer] :timeout_in_seconds
30
+ # @option params [String] :customer_id
31
+ # @option params [Integer, nil] :limit
32
+ # @option params [String, nil] :cursor
33
+ # @option params [Boolean, nil] :with_definitions
34
+ #
21
35
  # @return [Square::Types::ListCustomerCustomAttributesResponse]
22
36
  def list(request_options: {}, **params)
23
- _query_param_names = [
24
- %w[limit cursor with_definitions],
25
- %i[limit cursor with_definitions]
26
- ].flatten
27
- _query = params.slice(*_query_param_names)
28
- params = params.except(*_query_param_names)
37
+ params = Square::Internal::Types::Utils.normalize_keys(params)
38
+ query_param_names = %i[limit cursor with_definitions]
39
+ query_params = {}
40
+ query_params["limit"] = params[:limit] if params.key?(:limit)
41
+ query_params["cursor"] = params[:cursor] if params.key?(:cursor)
42
+ query_params["with_definitions"] = params[:with_definitions] if params.key?(:with_definitions)
43
+ params = params.except(*query_param_names)
29
44
 
30
- _request = Square::Internal::JSON::Request.new(
31
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
32
- method: "GET",
33
- path: "v2/customers/#{params[:customer_id]}/custom-attributes",
34
- query: _query
35
- )
36
- begin
37
- _response = @client.send(_request)
38
- rescue Net::HTTPRequestTimeout
39
- raise Square::Errors::TimeoutError
40
- end
41
- code = _response.code.to_i
42
- if code.between?(200, 299)
43
- Square::Types::ListCustomerCustomAttributesResponse.load(_response.body)
44
- else
45
- error_class = Square::Errors::ResponseError.subclass_for_code(code)
46
- raise error_class.new(_response.body, code: code)
45
+ Square::Internal::CursorItemIterator.new(
46
+ cursor_field: :cursor,
47
+ item_field: :custom_attributes,
48
+ initial_cursor: query_params[:cursor]
49
+ ) do |next_cursor|
50
+ query_params[:cursor] = next_cursor
51
+ request = Square::Internal::JSON::Request.new(
52
+ base_url: request_options[:base_url],
53
+ method: "GET",
54
+ path: "v2/customers/#{params[:customer_id]}/custom-attributes",
55
+ query: query_params,
56
+ request_options: request_options
57
+ )
58
+ begin
59
+ response = @client.send(request)
60
+ rescue Net::HTTPRequestTimeout
61
+ raise Square::Errors::TimeoutError
62
+ end
63
+ code = response.code.to_i
64
+ if code.between?(200, 299)
65
+ Square::Types::ListCustomerCustomAttributesResponse.load(response.body)
66
+ else
67
+ error_class = Square::Errors::ResponseError.subclass_for_code(code)
68
+ raise error_class.new(response.body, code: code)
69
+ end
47
70
  end
48
71
  end
49
72
 
@@ -56,32 +79,45 @@ module Square
56
79
  # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
57
80
  # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
58
81
  #
82
+ # @param request_options [Hash]
83
+ # @param params [Hash]
84
+ # @option request_options [String] :base_url
85
+ # @option request_options [Hash{String => Object}] :additional_headers
86
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
87
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
88
+ # @option request_options [Integer] :timeout_in_seconds
89
+ # @option params [String] :customer_id
90
+ # @option params [String] :key
91
+ # @option params [Boolean, nil] :with_definition
92
+ # @option params [Integer, nil] :version
93
+ #
59
94
  # @return [Square::Types::GetCustomerCustomAttributeResponse]
60
95
  def get(request_options: {}, **params)
61
- _query_param_names = [
62
- %w[with_definition version],
63
- %i[with_definition version]
64
- ].flatten
65
- _query = params.slice(*_query_param_names)
66
- params = params.except(*_query_param_names)
96
+ params = Square::Internal::Types::Utils.normalize_keys(params)
97
+ query_param_names = %i[with_definition version]
98
+ query_params = {}
99
+ query_params["with_definition"] = params[:with_definition] if params.key?(:with_definition)
100
+ query_params["version"] = params[:version] if params.key?(:version)
101
+ params = params.except(*query_param_names)
67
102
 
68
- _request = Square::Internal::JSON::Request.new(
69
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
103
+ request = Square::Internal::JSON::Request.new(
104
+ base_url: request_options[:base_url],
70
105
  method: "GET",
71
106
  path: "v2/customers/#{params[:customer_id]}/custom-attributes/#{params[:key]}",
72
- query: _query
107
+ query: query_params,
108
+ request_options: request_options
73
109
  )
74
110
  begin
75
- _response = @client.send(_request)
111
+ response = @client.send(request)
76
112
  rescue Net::HTTPRequestTimeout
77
113
  raise Square::Errors::TimeoutError
78
114
  end
79
- code = _response.code.to_i
115
+ code = response.code.to_i
80
116
  if code.between?(200, 299)
81
- Square::Types::GetCustomerCustomAttributeResponse.load(_response.body)
117
+ Square::Types::GetCustomerCustomAttributeResponse.load(response.body)
82
118
  else
83
119
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
84
- raise error_class.new(_response.body, code: code)
120
+ raise error_class.new(response.body, code: code)
85
121
  end
86
122
  end
87
123
 
@@ -89,33 +125,49 @@ module Square
89
125
  #
90
126
  # Use this endpoint to set the value of a custom attribute for a specified customer profile.
91
127
  # A custom attribute is based on a custom attribute definition in a Square seller account, which
92
- # is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint.
128
+ # is created using the
129
+ # [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition)
130
+ # endpoint.
93
131
  #
94
132
  # To create or update a custom attribute owned by another application, the `visibility` setting
95
133
  # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
96
134
  # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
97
135
  #
136
+ # @param request_options [Hash]
137
+ # @param params [Square::Customers::CustomAttributes::Types::UpsertCustomerCustomAttributeRequest]
138
+ # @option request_options [String] :base_url
139
+ # @option request_options [Hash{String => Object}] :additional_headers
140
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
141
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
142
+ # @option request_options [Integer] :timeout_in_seconds
143
+ # @option params [String] :customer_id
144
+ # @option params [String] :key
145
+ #
98
146
  # @return [Square::Types::UpsertCustomerCustomAttributeResponse]
99
147
  def upsert(request_options: {}, **params)
100
- _path_param_names = %w[customer_id key]
148
+ params = Square::Internal::Types::Utils.normalize_keys(params)
149
+ request_data = Square::Customers::CustomAttributes::Types::UpsertCustomerCustomAttributeRequest.new(params).to_h
150
+ non_body_param_names = %w[customer_id key]
151
+ body = request_data.except(*non_body_param_names)
101
152
 
102
- _request = Square::Internal::JSON::Request.new(
103
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
153
+ request = Square::Internal::JSON::Request.new(
154
+ base_url: request_options[:base_url],
104
155
  method: "POST",
105
156
  path: "v2/customers/#{params[:customer_id]}/custom-attributes/#{params[:key]}",
106
- body: params.except(*_path_param_names)
157
+ body: body,
158
+ request_options: request_options
107
159
  )
108
160
  begin
109
- _response = @client.send(_request)
161
+ response = @client.send(request)
110
162
  rescue Net::HTTPRequestTimeout
111
163
  raise Square::Errors::TimeoutError
112
164
  end
113
- code = _response.code.to_i
165
+ code = response.code.to_i
114
166
  if code.between?(200, 299)
115
- Square::Types::UpsertCustomerCustomAttributeResponse.load(_response.body)
167
+ Square::Types::UpsertCustomerCustomAttributeResponse.load(response.body)
116
168
  else
117
169
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
118
- raise error_class.new(_response.body, code: code)
170
+ raise error_class.new(response.body, code: code)
119
171
  end
120
172
  end
121
173
 
@@ -125,24 +177,36 @@ module Square
125
177
  # `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes
126
178
  # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`.
127
179
  #
180
+ # @param request_options [Hash]
181
+ # @param params [Hash]
182
+ # @option request_options [String] :base_url
183
+ # @option request_options [Hash{String => Object}] :additional_headers
184
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
185
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
186
+ # @option request_options [Integer] :timeout_in_seconds
187
+ # @option params [String] :customer_id
188
+ # @option params [String] :key
189
+ #
128
190
  # @return [Square::Types::DeleteCustomerCustomAttributeResponse]
129
191
  def delete(request_options: {}, **params)
130
- _request = Square::Internal::JSON::Request.new(
131
- base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
192
+ params = Square::Internal::Types::Utils.normalize_keys(params)
193
+ request = Square::Internal::JSON::Request.new(
194
+ base_url: request_options[:base_url],
132
195
  method: "DELETE",
133
- path: "v2/customers/#{params[:customer_id]}/custom-attributes/#{params[:key]}"
196
+ path: "v2/customers/#{params[:customer_id]}/custom-attributes/#{params[:key]}",
197
+ request_options: request_options
134
198
  )
135
199
  begin
136
- _response = @client.send(_request)
200
+ response = @client.send(request)
137
201
  rescue Net::HTTPRequestTimeout
138
202
  raise Square::Errors::TimeoutError
139
203
  end
140
- code = _response.code.to_i
204
+ code = response.code.to_i
141
205
  if code.between?(200, 299)
142
- Square::Types::DeleteCustomerCustomAttributeResponse.load(_response.body)
206
+ Square::Types::DeleteCustomerCustomAttributeResponse.load(response.body)
143
207
  else
144
208
  error_class = Square::Errors::ResponseError.subclass_for_code(code)
145
- raise error_class.new(_response.body, code: code)
209
+ raise error_class.new(response.body, code: code)
146
210
  end
147
211
  end
148
212
  end