From f12099e3051476de2c58ea10128727a16f7d0344 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 5 Aug 2024 14:33:39 +0200 Subject: [PATCH 01/59] wip --- Gemfile.lock | 8 ++++++-- beyond_api.gemspec | 1 + lib/beyond_api.rb | 5 ++++- lib/beyond_api/connection.rb | 1 + lib/beyond_api/request.rb | 12 ++++++++++-- lib/beyond_api/response.rb | 15 +++++++++++++++ lib/beyond_api/services/base_service.rb | 14 ++++++++++++++ lib/beyond_api/services/product_view/category.rb | 12 ++++++++++++ lib/beyond_api/session.rb | 5 +++++ 9 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 lib/beyond_api/response.rb create mode 100644 lib/beyond_api/services/base_service.rb create mode 100644 lib/beyond_api/services/product_view/category.rb diff --git a/Gemfile.lock b/Gemfile.lock index 2ddf4aa..60b0092 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ PATH specs: beyond_api (0.24.2.pre) faraday (~> 1.9.0) + faraday_middleware GEM remote: https://rubygems.org/ @@ -45,11 +46,13 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) i18n (1.8.11) concurrent-ruby (~> 1.0) method_source (1.0.0) minitest (5.14.4) - multipart-post (2.3.0) + multipart-post (2.4.1) parallel (1.21.0) parser (3.0.3.1) ast (~> 2.4.1) @@ -99,7 +102,7 @@ GEM zeitwerk (2.5.1) PLATFORMS - ruby + x86_64-darwin-22 DEPENDENCIES beyond_api! @@ -107,6 +110,7 @@ DEPENDENCIES dotenv (~> 2.7) factory_bot faker (~> 2.2) + faraday_middleware pry rake (~> 10.0) rspec (~> 3.0) diff --git a/beyond_api.gemspec b/beyond_api.gemspec index 39f661f..63b5dbf 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -32,4 +32,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "yard", "~> 0.9" spec.add_dependency "faraday", "~> 1.9.0" + spec.add_dependency "faraday_middleware" end diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index c00e882..9517d24 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -6,12 +6,15 @@ require "beyond_api/ext" require "beyond_api/utils" +require "beyond_api/services/base_service" +require "beyond_api/services/product_view/category" module BeyondApi autoload :Connection, "beyond_api/connection" autoload :Error, "beyond_api/error" autoload :Logger, "beyond_api/logger" autoload :Request, "beyond_api/request" + autoload :Response, "beyond_api/response" autoload :Session, "beyond_api/session" extend BeyondApi::Logger @@ -53,7 +56,7 @@ def initialize interval_randomness: 0.5, backoff_factor: 2, retry_statuses: [409], - exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed] + # exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed] } end end diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index 511327b..7bd2893 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -17,6 +17,7 @@ def self.default faraday.request(:multipart) faraday.request(:url_encoded) faraday.request(:retry, BeyondApi.configuration.retry_options) + faraday.response(:json, content_type: /\bjson$/) faraday.response :logger, LOGGER, { headers: BeyondApi.configuration.log_headers, bodies: BeyondApi.configuration.log_bodies } end diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 0f60304..75fc9b3 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -3,8 +3,16 @@ require "json" require "faraday" require "beyond_api/utils" +require "forwardable" module BeyondApi + class Response + extend Forwardable + def initialize(response) + @response = response + end + end + class Request class << self [:get, :delete].each do |method| @@ -14,8 +22,8 @@ class << self request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.params = params.to_h.camelize_keys end - - [response.body.blank? ? nil : JSON.parse(response.body), response.status] + response + # [response.body.blank? ? nil : JSON.parse(response.body), response.status] end end diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb new file mode 100644 index 0000000..7f4e3df --- /dev/null +++ b/lib/beyond_api/response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "json" +require "faraday" +require "beyond_api/utils" +require "forwardable" + +module BeyondApi + class Response + extend Forwardable + def initialize(response) + @response = response + end + end +end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb new file mode 100644 index 0000000..1907fa9 --- /dev/null +++ b/lib/beyond_api/services/base_service.rb @@ -0,0 +1,14 @@ +module BeyondApi + class BaseService + include BeyondApi::Utils + + attr_reader :session + + def initialize(session) + @session = session + + # raise InvalidSessionError, "Invalid session" unless session.is_a? BeyondApi::Session + # raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil? + end + end +end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb new file mode 100644 index 0000000..ac0a0b8 --- /dev/null +++ b/lib/beyond_api/services/product_view/category.rb @@ -0,0 +1,12 @@ +module BeyondApi + module ProductView + class Category < BaseService + def find(id) + response = BeyondApi::Request.get(@session, + "/product-view/categories/#{id}") + + response + end + end + end +end diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb index 8ef6e09..233d069 100644 --- a/lib/beyond_api/session.rb +++ b/lib/beyond_api/session.rb @@ -25,6 +25,11 @@ module BeyondApi autoload :Variations, "beyond_api/resources/variations" autoload :WebhookSubscriptions, "beyond_api/resources/webhook_subscriptions" + autoload :BaseService, "beyond_api/services/base_service" + # autoload "ProductView::Category", "beyond_api/services/product_view/category" + # autoload "ProductView::Category", "beyond_api/services/product_view/category" + + class Session class InvalidUriProtocolError < StandardError; end From 75e162c82e920ee526705d11506b37f65fe8e666 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 5 Aug 2024 15:08:56 +0200 Subject: [PATCH 02/59] wip --- Gemfile.lock | 3 +-- beyond_api.gemspec | 2 +- lib/beyond_api/connection.rb | 4 +++- lib/beyond_api/request.rb | 18 +++++------------- lib/beyond_api/response.rb | 7 +++++++ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 60b0092..bd22aa4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: beyond_api (0.24.2.pre) faraday (~> 1.9.0) - faraday_middleware + faraday_middleware (~> 1.1) GEM remote: https://rubygems.org/ @@ -110,7 +110,6 @@ DEPENDENCIES dotenv (~> 2.7) factory_bot faker (~> 2.2) - faraday_middleware pry rake (~> 10.0) rspec (~> 3.0) diff --git a/beyond_api.gemspec b/beyond_api.gemspec index 63b5dbf..965f080 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -32,5 +32,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "yard", "~> 0.9" spec.add_dependency "faraday", "~> 1.9.0" - spec.add_dependency "faraday_middleware" + spec.add_dependency "faraday_middleware", "~> 1.1" end diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index 7bd2893..70329aa 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "faraday" +require "faraday_middleware" module BeyondApi class Connection @@ -14,10 +15,11 @@ def self.default faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i faraday.headers["Accept"] = "application/json" faraday.headers["Content-Type"] = "application/json" + faraday.request(:json) faraday.request(:multipart) faraday.request(:url_encoded) faraday.request(:retry, BeyondApi.configuration.retry_options) - faraday.response(:json, content_type: /\bjson$/) + faraday.response(:json, content_type: "application/json") faraday.response :logger, LOGGER, { headers: BeyondApi.configuration.log_headers, bodies: BeyondApi.configuration.log_bodies } end diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 75fc9b3..cf31654 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -6,13 +6,6 @@ require "forwardable" module BeyondApi - class Response - extend Forwardable - def initialize(response) - @response = response - end - end - class Request class << self [:get, :delete].each do |method| @@ -22,8 +15,7 @@ class << self request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.params = params.to_h.camelize_keys end - response - # [response.body.blank? ? nil : JSON.parse(response.body), response.status] + Response.new(response) end end @@ -38,7 +30,7 @@ class << self request.body = body.respond_to?(:camelize_keys) ? body.camelize_keys.to_json : body end - [response.body.blank? ? nil : JSON.parse(response.body), response.status] + Response.new(response) end end end @@ -52,7 +44,7 @@ def self.upload(session, path, file_binary, content_type, params) request.body = file_binary end - [response.body.blank? ? nil : JSON.parse(response.body), response.status] + Response.new(response) end def self.token(url, params) @@ -61,7 +53,7 @@ def self.token(url, params) request.params = params end - [response.body.blank? ? nil : JSON.parse(response.body), response.status] + Response.new(response) end def self.upload_by_form(session, path, files, params) @@ -76,7 +68,7 @@ def self.upload_by_form(session, path, files, params) request.body = { image: upload_files } end - [response.body.blank? ? nil : JSON.parse(response.body), response.status] + Response.new(response) end end end diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 7f4e3df..c7f5a51 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -8,8 +8,15 @@ module BeyondApi class Response extend Forwardable + + def_delegators :@response, :success?, :body, :status + def initialize(response) @response = response end + + def failure? + !success? + end end end From 19775a7774ee47cdc5b914c9ab276453349601dd Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 5 Aug 2024 16:36:47 +0200 Subject: [PATCH 03/59] wip --- lib/beyond_api/request.rb | 7 +++++-- lib/beyond_api/response.rb | 36 ++++++++++++++++++++++++++++++++++-- lib/beyond_api/utils.rb | 9 +++++---- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index cf31654..5d2bdd4 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -15,7 +15,10 @@ class << self request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.params = params.to_h.camelize_keys end - Response.new(response) + # binding.b + Response.new(response).handle + rescue Faraday::Error => e + raise(Error.new(e)) end end @@ -53,7 +56,7 @@ def self.token(url, params) request.params = params end - Response.new(response) + [response.body.blank? ? nil : JSON.parse(response.body), response.status] end def self.upload_by_form(session, path, files, params) diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index c7f5a51..d9f6ffd 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -15,8 +15,40 @@ def initialize(response) @response = response end - def failure? - !success? + def handle + success? ? sanitize_response(body) : handle_error + end + + private + + def sanitize_key(key) + key.chars.first == "_" ? key[1..-1] : key + end + + def sanitize_response(hash) + {}.tap do |h| + hash.each do |key, value| + next if key == "_links" && BeyondApi.configuration.remove_response_links + + key = sanitize_key(key) if BeyondApi.configuration.remove_response_key_underscores + h[key.underscore.to_sym] = transform(value) + end + end + end + + def transform(thing) + case thing + when Hash then sanitize_response(thing) + when Array then thing.map { |v| transform(v) } + else; thing + end + end + + def handle_error + raise BeyondApi::Error.new(body, status) + # BeyondApi.logger.error "[Beyond API] #{status}: #{response}" + # error = BeyondApi::Error.new(response, status) + # BeyondApi.configuration.raise_error_requests ? raise(error) : error end end end diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index 36a4d03..08cb212 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -41,10 +41,11 @@ def handle_all_request(url, resource, params = {}) end end - def handle_error(response, status) - BeyondApi.logger.error "[Beyond API] #{status}: #{response}" - error = BeyondApi::Error.new(response, status) - BeyondApi.configuration.raise_error_requests ? raise(error) : error + def handle_error(response) + raise BeyondApi::Error.new({}, 500) + # BeyondApi.logger.error "[Beyond API] #{status}: #{response}" + # error = BeyondApi::Error.new(response, status) + # BeyondApi.configuration.raise_error_requests ? raise(error) : error end def handle_response(response, status, respond_with_true: false) From 2516fa5e3417ee98d9a0ec32085aa43f2c7c1a14 Mon Sep 17 00:00:00 2001 From: k4th Date: Tue, 6 Aug 2024 08:37:54 +0200 Subject: [PATCH 04/59] wip --- lib/beyond_api.rb | 3 ++- lib/beyond_api/error.rb | 16 ++++++++++++++++ lib/beyond_api/request.rb | 8 ++++---- lib/beyond_api/response.rb | 7 ++++--- .../services/product_view/category.rb | 9 +++++---- .../services/storefront/script_tag.rb | 19 +++++++++++++++++++ 6 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 lib/beyond_api/services/storefront/script_tag.rb diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 9517d24..4c7b8e5 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -8,13 +8,14 @@ require "beyond_api/utils" require "beyond_api/services/base_service" require "beyond_api/services/product_view/category" +require "beyond_api/services/storefront/script_tag" module BeyondApi autoload :Connection, "beyond_api/connection" autoload :Error, "beyond_api/error" autoload :Logger, "beyond_api/logger" autoload :Request, "beyond_api/request" - autoload :Response, "beyond_api/response" + autoload :Response, "beyond_api/response" autoload :Session, "beyond_api/session" extend BeyondApi::Logger diff --git a/lib/beyond_api/error.rb b/lib/beyond_api/error.rb index 53e504e..5e767c0 100644 --- a/lib/beyond_api/error.rb +++ b/lib/beyond_api/error.rb @@ -1,6 +1,22 @@ # frozen_string_literal: true module BeyondApi + class FaradayError < StandardError + def initialize(data, code) + @data = data + @code = code + + super "faraday err" + end + + def to_json + { + data:, + code: + } + end + end + class Error < StandardError attr_reader :error_id, :details, :trace_id, :full_message, :status_code, :error, :error_description diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 5d2bdd4..1a05603 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -11,14 +11,14 @@ class << self [:get, :delete].each do |method| define_method(method) do |session, path, params = {}| response = BeyondApi::Connection.default.send(method) do |request| + # request.url("https://8a14-80-24-215-151.ngrok-free.app/countries/5/locales") request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.params = params.to_h.camelize_keys end - # binding.b Response.new(response).handle - rescue Faraday::Error => e - raise(Error.new(e)) + rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e + raise(FaradayError.new(e, 599)) end end @@ -33,7 +33,7 @@ class << self request.body = body.respond_to?(:camelize_keys) ? body.camelize_keys.to_json : body end - Response.new(response) + Response.new(response).handle end end end diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index d9f6ffd..723e254 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -26,6 +26,8 @@ def sanitize_key(key) end def sanitize_response(hash) + return {} if hash.blank? + {}.tap do |h| hash.each do |key, value| next if key == "_links" && BeyondApi.configuration.remove_response_links @@ -45,10 +47,9 @@ def transform(thing) end def handle_error + puts "BODY IS #{body}" + puts "STATUS IS #{status}" raise BeyondApi::Error.new(body, status) - # BeyondApi.logger.error "[Beyond API] #{status}: #{response}" - # error = BeyondApi::Error.new(response, status) - # BeyondApi.configuration.raise_error_requests ? raise(error) : error end end end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index ac0a0b8..9e856ca 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -1,11 +1,12 @@ module BeyondApi module ProductView class Category < BaseService - def find(id) - response = BeyondApi::Request.get(@session, - "/product-view/categories/#{id}") + def all(params = {}) + BeyondApi::Request.get(@session, "/product-view/categories", params) + end - response + def find(id) + BeyondApi::Request.get(@session, "/product-view/categories/#{id}") end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb new file mode 100644 index 0000000..7e74f50 --- /dev/null +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -0,0 +1,19 @@ +module BeyondApi + module Storefront + class ScriptTag < BaseService + def all(params = {}) + params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] + + BeyondApi::Request.get(@session, "/script-tags", params) + end + + def create(script_url) + BeyondApi::Request.post(@session, "/script-tags", script_url:) + end + + def delete(id) + BeyondApi::Request.delete(@session, "/script-tags/#{id}") + end + end + end +end From 754fa04cc7fae486dea40a8e9a13ff2bdb24143b Mon Sep 17 00:00:00 2001 From: k4th Date: Tue, 6 Aug 2024 10:29:43 +0200 Subject: [PATCH 05/59] wip --- lib/beyond_api/response.rb | 2 -- lib/beyond_api/services/product_management/image.rb | 9 +++++++++ lib/beyond_api/services/product_management/product.rb | 9 +++++++++ lib/beyond_api/services/product_management/variation.rb | 9 +++++++++ .../services/product_management/variation_image.rb | 9 +++++++++ lib/beyond_api/services/product_view/category.rb | 4 ++++ 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 lib/beyond_api/services/product_management/image.rb create mode 100644 lib/beyond_api/services/product_management/product.rb create mode 100644 lib/beyond_api/services/product_management/variation.rb create mode 100644 lib/beyond_api/services/product_management/variation_image.rb diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 723e254..2a7eacf 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -47,8 +47,6 @@ def transform(thing) end def handle_error - puts "BODY IS #{body}" - puts "STATUS IS #{status}" raise BeyondApi::Error.new(body, status) end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb new file mode 100644 index 0000000..b52aaf5 --- /dev/null +++ b/lib/beyond_api/services/product_management/image.rb @@ -0,0 +1,9 @@ +module BeyondApi + module ProductManagement + class Image < BaseService + def all(id) + BeyondApi::Request.get(@session, "/products/#{id}/images") + end + end + end +end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb new file mode 100644 index 0000000..8906c32 --- /dev/null +++ b/lib/beyond_api/services/product_management/product.rb @@ -0,0 +1,9 @@ +module BeyondApi + module ProductManagement + class Product < BaseService + def find(id) + BeyondApi::Request.get(@session, "/products/#{id}") + end + end + end +end diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb new file mode 100644 index 0000000..07f1755 --- /dev/null +++ b/lib/beyond_api/services/product_management/variation.rb @@ -0,0 +1,9 @@ +module BeyondApi + module ProductManagement + class Variation < BaseService + def all(id) + BeyondApi::Request.get(@session, "/products/#{id}/variations") + end + end + end +end diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb new file mode 100644 index 0000000..0b5077b --- /dev/null +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -0,0 +1,9 @@ +module BeyondApi + module ProductManagement + class VariationImage < BaseService + def all(product_id, variation_id) + BeyondApi::Request.get(@session, "/products/#{product_id}/variations/#{variation_id}/images") + end + end + end +end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index 9e856ca..d490ac0 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -8,6 +8,10 @@ def all(params = {}) def find(id) BeyondApi::Request.get(@session, "/product-view/categories/#{id}") end + + def preview(filters) + BeyondApi::Request.post(@session, "/product-view/categories/preview", filters:) + end end end end From c69d9d33c3942e24a9a02ea5b5afe19ca51c2115 Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 6 Aug 2024 10:30:06 +0200 Subject: [PATCH 06/59] adds some endpoints --- lib/beyond_api/services/checkout/shipping_zone.rb | 10 ++++++++++ lib/beyond_api/services/shop/address.rb | 9 +++++++++ lib/beyond_api/services/shop/shop.rb | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 lib/beyond_api/services/checkout/shipping_zone.rb create mode 100644 lib/beyond_api/services/shop/address.rb create mode 100644 lib/beyond_api/services/shop/shop.rb diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb new file mode 100644 index 0000000..a89ee59 --- /dev/null +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -0,0 +1,10 @@ +module BeyondApi + module Shop + class ShippingZone < BaseService + def all + # TODO: iterate over all pages + BeyondApi::Request.get(@session, "/shipping-zones") + end + end + end +end diff --git a/lib/beyond_api/services/shop/address.rb b/lib/beyond_api/services/shop/address.rb new file mode 100644 index 0000000..20011f1 --- /dev/null +++ b/lib/beyond_api/services/shop/address.rb @@ -0,0 +1,9 @@ +module BeyondApi + module Shop + class Address < BaseService + def get + BeyondApi::Request.get(@session, "/shop/address") + end + end + end +end diff --git a/lib/beyond_api/services/shop/shop.rb b/lib/beyond_api/services/shop/shop.rb new file mode 100644 index 0000000..6b3e07a --- /dev/null +++ b/lib/beyond_api/services/shop/shop.rb @@ -0,0 +1,9 @@ +module BeyondApi + module Shop + class Shop < BaseService + def details + BeyondApi::Request.get(@session, "/shop") + end + end + end +end From 0f5ac374e8b4b2fda8856593c31bec8d2c03f611 Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 6 Aug 2024 10:32:12 +0200 Subject: [PATCH 07/59] require created files --- lib/beyond_api.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 4c7b8e5..d48fd19 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -9,6 +9,9 @@ require "beyond_api/services/base_service" require "beyond_api/services/product_view/category" require "beyond_api/services/storefront/script_tag" +require "beyond_api/services/checkout/shipping_zone" +require "beyond_api/services/shop/address" +require "beyond_api/services/shop/shop" module BeyondApi autoload :Connection, "beyond_api/connection" From a30d08729cc3ed9ba5ae147fca70a0b4bc198987 Mon Sep 17 00:00:00 2001 From: k4th Date: Tue, 6 Aug 2024 10:35:24 +0200 Subject: [PATCH 08/59] Add endpoints --- lib/beyond_api.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index d48fd19..7a84b62 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -7,6 +7,10 @@ require "beyond_api/ext" require "beyond_api/utils" require "beyond_api/services/base_service" +require "beyond_api/services/product_management/image" +require "beyond_api/services/product_management/product" +require "beyond_api/services/product_management/variation" +require "beyond_api/services/product_management/variation_image" require "beyond_api/services/product_view/category" require "beyond_api/services/storefront/script_tag" require "beyond_api/services/checkout/shipping_zone" From 3446eac2a8351024af52626eebbde21762961272 Mon Sep 17 00:00:00 2001 From: k4th Date: Tue, 6 Aug 2024 10:58:19 +0200 Subject: [PATCH 09/59] wip --- lib/beyond_api/services/checkout/shipping_zone.rb | 2 +- lib/beyond_api/services/product_view/category.rb | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb index a89ee59..efc7446 100644 --- a/lib/beyond_api/services/checkout/shipping_zone.rb +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -1,5 +1,5 @@ module BeyondApi - module Shop + module Checkout class ShippingZone < BaseService def all # TODO: iterate over all pages diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index d490ac0..dfec90a 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -9,8 +9,11 @@ def find(id) BeyondApi::Request.get(@session, "/product-view/categories/#{id}") end - def preview(filters) - BeyondApi::Request.post(@session, "/product-view/categories/preview", filters:) + def preview(body, params = {}) + BeyondApi::Request.post(@session, + "/product-view/categories/preview", + body, + params) end end end From c089f9bde53b112e698ab503a9360709e52fc883 Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 6 Aug 2024 15:22:50 +0200 Subject: [PATCH 10/59] removes configs and refactor response --- lib/beyond_api.rb | 15 ++++----- lib/beyond_api/response.rb | 33 +++++++++++-------- .../templates/beyond_api_initializer.rb | 21 ------------ 3 files changed, 26 insertions(+), 43 deletions(-) diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 7a84b62..1795f78 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -38,19 +38,16 @@ def self.setup end class Configuration - attr_accessor :client_id, :client_secret, :open_timeout, :timeout, :remove_response_links, - :remove_response_key_underscores, :object_struct_responses, :raise_error_requests, - :log_headers, :log_bodies, :log_level, :all_pagination_size, :retry_options + attr_accessor :client_id, :client_secret, + :open_timeout, :timeout, + :log_headers, :log_bodies, :log_level, + :all_pagination_size, :retry_options def initialize @client_id = nil @client_secret = nil @open_timeout = 2 @timeout = 5 - @remove_response_links = false - @remove_response_key_underscores = false - @object_struct_responses = false - @raise_error_requests = false @log_level = :info @log_headers = false @@ -59,12 +56,12 @@ def initialize @all_pagination_size = 200 @retry_options = { - max: 5, + max: 3, interval: 0.05, interval_randomness: 0.5, backoff_factor: 2, retry_statuses: [409], - # exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed] + exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed] } end end diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 2a7eacf..45e9985 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -21,28 +21,35 @@ def handle private - def sanitize_key(key) - key.chars.first == "_" ? key[1..-1] : key - end - def sanitize_response(hash) return {} if hash.blank? - {}.tap do |h| + {}.tap do |response_hash| hash.each do |key, value| - next if key == "_links" && BeyondApi.configuration.remove_response_links + key = remove_initial_underscore(key) + key = symbolize_key(key) - key = sanitize_key(key) if BeyondApi.configuration.remove_response_key_underscores - h[key.underscore.to_sym] = transform(value) + response_hash[key] = sanitize_value(value) end end end - def transform(thing) - case thing - when Hash then sanitize_response(thing) - when Array then thing.map { |v| transform(v) } - else; thing + def remove_initial_underscore(key) + key.chars.first == "_" ? key[1..-1] : key + end + + def symbolize_key(key) + key.underscore.to_sym + end + + def sanitize_value(value) + case value + when Hash + sanitize_response(value) + when Array + value.map { |v| sanitize_value(v) } + else + value end end diff --git a/lib/generators/templates/beyond_api_initializer.rb b/lib/generators/templates/beyond_api_initializer.rb index 9b74b94..7341fb4 100644 --- a/lib/generators/templates/beyond_api_initializer.rb +++ b/lib/generators/templates/beyond_api_initializer.rb @@ -30,27 +30,6 @@ # # config.log_bodies = false - # ==> Response configuration - # Configure if :_links should be removed from response. Default is false and - # :_links are gonna be part of the response. - # config.remove_response_links = false - - # Configure if first character underescores should be removed on response hash - # keys. For example, if set to true, :_id will become :id. Default is false. - # config.remove_response_key_underscores = false - - # Configure if responses should be transformed to ObjectStructs. If set to - # true, it gives you the posibility to access response data on a doted way. - # With OpenStructs => response.embeded.products.first.id - # Without OpenStructs => response["embeded"]["products"].first["id"] - # config.object_struct_responses = false - - # Configure if the gem should raise on error requests. Setting it to true is - # useful for working with exceptions. Setting it to false will return a - # BeyondApi::Error object with detailed information of the error. - # Default is false. - # config.raise_error_requests = false - # ==> Retry configuration # Configure the retry options for requests. Default is: # config.retry_options = { From cb645407d49f28c293a3b0fe800829bcf7135504 Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 6 Aug 2024 16:45:29 +0200 Subject: [PATCH 11/59] Beyond api v2 (#63) * add product management category * wip * Fix handle all pages --- lib/beyond_api.rb | 1 + lib/beyond_api/services/base_service.rb | 34 ++++++++ .../services/product_management/category.rb | 9 ++ .../services/product_management/product.rb | 5 ++ .../services/product_view/category.rb | 2 +- lib/beyond_api/utils.rb | 83 ------------------- 6 files changed, 50 insertions(+), 84 deletions(-) create mode 100644 lib/beyond_api/services/product_management/category.rb diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 1795f78..a2648cb 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -7,6 +7,7 @@ require "beyond_api/ext" require "beyond_api/utils" require "beyond_api/services/base_service" +require "beyond_api/services/product_management/category" require "beyond_api/services/product_management/image" require "beyond_api/services/product_management/product" require "beyond_api/services/product_management/variation" diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index 1907fa9..3bb62a0 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -10,5 +10,39 @@ def initialize(session) # raise InvalidSessionError, "Invalid session" unless session.is_a? BeyondApi::Session # raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil? end + + def fetch_all_pages(url, resource, params = {}) + if params[:paginated] == false + result = fetch_pages(url, resource, params, BeyondApi.configuration.all_pagination_size) + adjust_response(result) + result + else + fetch_page(url, params) + end + end + + private + + def adjust_response(result) + result[:page][:size] = result[:page][:total_elements] + result[:page][:total_pages] = 1 + result[:page][:number] = 0 + end + + def fetch_page(url, params = {}) + BeyondApi::Request.get(@session, url, params) + end + + def fetch_pages(url, resource, params, size) + result = fetch_page(url, params.merge(page: 0, size:)) + + (1..result[:page][:total_pages] - 1).each do |page| + result[:embedded][resource].concat( + fetch_page(url, params.merge(page:, size:))[:embedded][resource] + ) + end + + result + end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb new file mode 100644 index 0000000..00a8440 --- /dev/null +++ b/lib/beyond_api/services/product_management/category.rb @@ -0,0 +1,9 @@ +module BeyondApi + module ProductManagement + class Category < BaseService + def find(id) + BeyondApi::Request.get(@session, "/categories/#{id}") + end + end + end +end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 8906c32..4397a2c 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -1,6 +1,11 @@ module BeyondApi module ProductManagement class Product < BaseService + def all(params = {}) + # BeyondApi::Request.get(@session, "/products", params) + fetch_all_pages("/products", :products, params) + end + def find(id) BeyondApi::Request.get(@session, "/products/#{id}") end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index dfec90a..7d43b3d 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductView class Category < BaseService def all(params = {}) - BeyondApi::Request.get(@session, "/product-view/categories", params) + fetch_all_pages("/product-view/categories", :categories, params) end def find(id) diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index 08cb212..2651eb3 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -16,88 +16,5 @@ def file_content_type(file_path) "image/gif" end end - - def handle_all_request(url, resource, params = {}) - paginated_size = BeyondApi.configuration.all_pagination_size - - if params[:paginated] == false - result = all_paginated(url, params.merge(page: 0, size: paginated_size)) - - (1..result[:page][:total_pages] - 1).each do |page| - result[:embedded][resource].concat( - all_paginated(url, - params.merge(page: page, - size: paginated_size))[:embedded][resource] - ) - end - - result[:page][:size] = result[:page][:total_elements] - result[:page][:total_pages] = 1 - result[:page][:number] = 0 - - result - else - all_paginated(url, params) - end - end - - def handle_error(response) - raise BeyondApi::Error.new({}, 500) - # BeyondApi.logger.error "[Beyond API] #{status}: #{response}" - # error = BeyondApi::Error.new(response, status) - # BeyondApi.configuration.raise_error_requests ? raise(error) : error - end - - def handle_response(response, status, respond_with_true: false) - if status.between?(200, 299) - return true if respond_with_true - - response = sanitize_response(response) - BeyondApi.configuration.object_struct_responses ? to_object_struct(response) : response - else - handle_error(response, status) - end - end - - def sanitize_key(key) - key.chars.first == "_" ? key[1..-1] : key - end - - def sanitize_response(hash) - {}.tap do |h| - hash.each do |key, value| - next if key == "_links" && BeyondApi.configuration.remove_response_links - - key = sanitize_key(key) if BeyondApi.configuration.remove_response_key_underscores - h[key.underscore.to_sym] = transform(value) - end - end - end - - def to_object_struct(data) - if data.is_a? Hash - OpenStruct.new(data.map { |key, val| [key, to_object_struct(val)] }.to_h) - elsif data.is_a? Array - data.map { |o| to_object_struct(o) } - else - data - end - end - - private - - def all_paginated(url, params = {}) - response, status = BeyondApi::Request.get(@session, url, params) - - handle_response(response, status) - end - - def transform(thing) - case thing - when Hash then sanitize_response(thing) - when Array then thing.map { |v| transform(v) } - else; thing - end - end end end From 84818d08b63f491c93f10c48722c43b94183e56a Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 6 Aug 2024 17:21:37 +0200 Subject: [PATCH 12/59] adds zeitwerk --- beyond_api.gemspec | 1 + lib/beyond_api.rb | 47 +++++++------------ lib/beyond_api/connection.rb | 3 -- lib/beyond_api/error.rb | 2 - lib/beyond_api/ext.rb | 61 ------------------------- lib/beyond_api/request.rb | 20 ++++---- lib/beyond_api/response.rb | 45 +++++++----------- lib/beyond_api/session.rb | 29 ------------ lib/beyond_api/{resources => }/token.rb | 0 lib/beyond_api/utils.rb | 4 ++ 10 files changed, 46 insertions(+), 166 deletions(-) delete mode 100644 lib/beyond_api/ext.rb rename lib/beyond_api/{resources => }/token.rb (100%) diff --git a/beyond_api.gemspec b/beyond_api.gemspec index 965f080..e079753 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -31,6 +31,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rubocop-rspec", "~> 2.4" spec.add_development_dependency "yard", "~> 0.9" + spec.add_dependency "zeitwerk" spec.add_dependency "faraday", "~> 1.9.0" spec.add_dependency "faraday_middleware", "~> 1.1" end diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index a2648cb..d98916d 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -1,41 +1,26 @@ # frozen_string_literal: true - -require "beyond_api/version" - -require "logger" - -require "beyond_api/ext" -require "beyond_api/utils" -require "beyond_api/services/base_service" -require "beyond_api/services/product_management/category" -require "beyond_api/services/product_management/image" -require "beyond_api/services/product_management/product" -require "beyond_api/services/product_management/variation" -require "beyond_api/services/product_management/variation_image" -require "beyond_api/services/product_view/category" -require "beyond_api/services/storefront/script_tag" -require "beyond_api/services/checkout/shipping_zone" -require "beyond_api/services/shop/address" -require "beyond_api/services/shop/shop" +require 'zeitwerk' +require 'faraday' +require 'faraday_middleware' +require 'json' +require 'forwardeable' module BeyondApi - autoload :Connection, "beyond_api/connection" - autoload :Error, "beyond_api/error" - autoload :Logger, "beyond_api/logger" - autoload :Request, "beyond_api/request" - autoload :Response, "beyond_api/response" - autoload :Session, "beyond_api/session" + loader = Zeitwerk::Loader.for_gem + loader.push_dir("#{__dir__}/beyond_api/services", namespace: BeyondApi) + loader.ignore("#{__dir__}/generators") + loader.setup - extend BeyondApi::Logger + extend Logger class << self attr_accessor :configuration - end - - def self.setup - self.configuration ||= Configuration.new - - yield configuration + + def setup + self.configuration ||= Configuration.new + + yield configuration + end end class Configuration diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index 70329aa..a695de2 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true -require "faraday" -require "faraday_middleware" - module BeyondApi class Connection LOGGER = ::BeyondApi.logger diff --git a/lib/beyond_api/error.rb b/lib/beyond_api/error.rb index 5e767c0..771c719 100644 --- a/lib/beyond_api/error.rb +++ b/lib/beyond_api/error.rb @@ -5,8 +5,6 @@ class FaradayError < StandardError def initialize(data, code) @data = data @code = code - - super "faraday err" end def to_json diff --git a/lib/beyond_api/ext.rb b/lib/beyond_api/ext.rb deleted file mode 100644 index 8d21dcf..0000000 --- a/lib/beyond_api/ext.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -class Hash - def deep_transform_keys(&block) - result = {} - each do |key, value| - result[yield(key)] = case value - when Hash - value.deep_transform_keys(&block) - when Array - value.camelize_keys - else - value - end - end - result - end - - def camelize_keys - deep_transform_keys { |key| key.to_s.camelize(false) } - end - - def underscorize_keys - deep_transform_keys { |key| key.to_s.underscore } - end -end - -class String - def blank? - respond_to?(:empty?) ? !!empty? : !self - end - - def underscore - gsub(/::/, "/") - .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') - .gsub(/([a-z\d])([A-Z])/, '\1_\2') - .tr("-", "_") - .downcase - end - - def camelize(uppercase_first_letter = true) - string = self - if uppercase_first_letter - string = string.sub(/^[a-z\d]*/, &:capitalize) - else - string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/, &:downcase) - end - string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub("/", "::") - end -end - -class Array - def camelize_keys - map do |elem| - case elem - when Hash, Array then elem.camelize_keys - else; elem - end - end - end -end diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 1a05603..488f4f3 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -1,21 +1,16 @@ # frozen_string_literal: true -require "json" -require "faraday" -require "beyond_api/utils" -require "forwardable" - module BeyondApi class Request class << self [:get, :delete].each do |method| define_method(method) do |session, path, params = {}| response = BeyondApi::Connection.default.send(method) do |request| - # request.url("https://8a14-80-24-215-151.ngrok-free.app/countries/5/locales") request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? - request.params = params.to_h.camelize_keys + request.params = camelize_keys(params) end + Response.new(response).handle rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e raise(FaradayError.new(e, 599)) @@ -28,9 +23,9 @@ class << self request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.headers["Content-Type"] = content_type - request.params = params.to_h.camelize_keys + request.params = camelize_keys(params) - request.body = body.respond_to?(:camelize_keys) ? body.camelize_keys.to_json : body + request.body = camelize_keys(body).to_json end Response.new(response).handle @@ -43,7 +38,8 @@ def self.upload(session, path, file_binary, content_type, params) request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.headers["Content-Type"] = content_type - request.params = params.to_h.camelize_keys + request.params = camelize_keys(params) + request.body = file_binary end @@ -64,7 +60,9 @@ def self.upload_by_form(session, path, files, params) request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.options[:params_encoder] = Faraday::FlatParamsEncoder - request.params = params.to_h.camelize_keys + + request.params = camelize_keys(params) + files = files.split unless files.is_a? Array upload_files = files.map{ |file| Faraday::FilePart.new(File.open(file), BeyondApi::Utils.file_content_type(file)) } diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 45e9985..ab3791e 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -1,10 +1,5 @@ # frozen_string_literal: true -require "json" -require "faraday" -require "beyond_api/utils" -require "forwardable" - module BeyondApi class Response extend Forwardable @@ -16,44 +11,36 @@ def initialize(response) end def handle - success? ? sanitize_response(body) : handle_error + success? ? parsed_response : raise_error end private - def sanitize_response(hash) - return {} if hash.blank? + def parsed_response + return {} if body.blank? - {}.tap do |response_hash| - hash.each do |key, value| - key = remove_initial_underscore(key) - key = symbolize_key(key) + remove_initial_underscore_keys! + snake_case_keys! + deep_symbolize_keys! + end - response_hash[key] = sanitize_value(value) - end - end + def remove_initial_underscore_keys! + body.deep_transform_keys!{ |key| remove_initial_underscore(key) } end - def remove_initial_underscore(key) - key.chars.first == "_" ? key[1..-1] : key + def snake_case_keys! + body.deep_transform_keys!{ |key| key.to_s.underscore } end - def symbolize_key(key) - key.underscore.to_sym + def deep_symbolize_keys! + body.deep_symbolize_keys! end - def sanitize_value(value) - case value - when Hash - sanitize_response(value) - when Array - value.map { |v| sanitize_value(v) } - else - value - end + def remove_initial_underscore! + key.starts_with?('_') ? key[1..-1] : key end - def handle_error + def raise_error raise BeyondApi::Error.new(body, status) end end diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb index 233d069..db931b3 100644 --- a/lib/beyond_api/session.rb +++ b/lib/beyond_api/session.rb @@ -1,35 +1,6 @@ # frozen_string_literal: true module BeyondApi - autoload :Base, "beyond_api/resources/base" - autoload :Carts, "beyond_api/resources/carts" - autoload :CategoriesView, "beyond_api/resources/categories_view" - autoload :Categories, "beyond_api/resources/categories" - autoload :CheckoutSettings, "beyond_api/resources/checkout_settings" - autoload :Customers, "beyond_api/resources/customers" - autoload :NewsletterTarget, "beyond_api/resources/newsletter_target" - autoload :OrderSettings, "beyond_api/resources/order_settings" - autoload :Orders, "beyond_api/resources/orders" - autoload :PaymentMethodDefinitions, "beyond_api/resources/payment_method_definitions" - autoload :PickupOptions, "beyond_api/resources/pickup_options" - autoload :PaymentMethods, "beyond_api/resources/payment_methods" - autoload :ProductAttributeDefinitions, "beyond_api/resources/product_attribute_definitions" - autoload :ProductsView, "beyond_api/resources/products_view" - autoload :Products, "beyond_api/resources/products" - autoload :ScriptTags, "beyond_api/resources/script_tags" - autoload :ShippingZones, "beyond_api/resources/shipping_zones" - autoload :Shop, "beyond_api/resources/shop" - autoload :Signers, "beyond_api/resources/signers" - autoload :Token, "beyond_api/resources/token" - autoload :Users, "beyond_api/resources/users" - autoload :Variations, "beyond_api/resources/variations" - autoload :WebhookSubscriptions, "beyond_api/resources/webhook_subscriptions" - - autoload :BaseService, "beyond_api/services/base_service" - # autoload "ProductView::Category", "beyond_api/services/product_view/category" - # autoload "ProductView::Category", "beyond_api/services/product_view/category" - - class Session class InvalidUriProtocolError < StandardError; end diff --git a/lib/beyond_api/resources/token.rb b/lib/beyond_api/token.rb similarity index 100% rename from lib/beyond_api/resources/token.rb rename to lib/beyond_api/token.rb diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index 2651eb3..bf9891b 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -16,5 +16,9 @@ def file_content_type(file_path) "image/gif" end end + + def camelize_keys(hash) + hash.deep_transform_keys { |key| key.to_s.camelize(:lower) } + end end end From 7e5b115f0940763810a0f02a0d9f7880cab3b88d Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 6 Aug 2024 17:42:11 +0200 Subject: [PATCH 13/59] V2 (#62) * add product management category * Fix namespaces --- Gemfile.lock | 1 + lib/beyond_api.rb | 3 +- lib/beyond_api/request.rb | 22 +++++----- lib/beyond_api/response.rb | 4 +- lib/beyond_api/services/base_service.rb | 6 +-- .../services/checkout/shipping_zone.rb | 2 +- .../services/product_management/category.rb | 2 +- .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 4 +- .../services/product_management/variation.rb | 2 +- .../product_management/variation_image.rb | 2 +- .../services/product_view/category.rb | 4 +- lib/beyond_api/services/shop/address.rb | 2 +- lib/beyond_api/services/shop/shop.rb | 2 +- .../services/storefront/script_tag.rb | 6 +-- lib/beyond_api/session.rb | 44 +++++++++---------- lib/beyond_api/token.rb | 2 - lib/beyond_api/utils.rb | 6 +-- 18 files changed, 56 insertions(+), 60 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bd22aa4..2511e25 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,6 +4,7 @@ PATH beyond_api (0.24.2.pre) faraday (~> 1.9.0) faraday_middleware (~> 1.1) + zeitwerk GEM remote: https://rubygems.org/ diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index d98916d..30caccf 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true + require 'zeitwerk' require 'faraday' require 'faraday_middleware' require 'json' -require 'forwardeable' +require 'forwardable' module BeyondApi loader = Zeitwerk::Loader.for_gem diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 488f4f3..eecb656 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -5,10 +5,10 @@ class Request class << self [:get, :delete].each do |method| define_method(method) do |session, path, params = {}| - response = BeyondApi::Connection.default.send(method) do |request| + response = Connection.default.send(method) do |request| request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? - request.params = camelize_keys(params) + request.params = Utils.camelize_keys(params) end Response.new(response).handle @@ -19,13 +19,13 @@ class << self [:post, :put, :patch].each do |method| define_method(method) do |session, path, body = {}, params = {}, content_type = 'application/json'| - response = BeyondApi::Connection.default.send(method) do |request| + response = Connection.default.send(method) do |request| request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.headers["Content-Type"] = content_type - request.params = camelize_keys(params) + request.params = Utils.camelize_keys(params) - request.body = camelize_keys(body).to_json + request.body = Utils.camelize_keys(body).to_json end Response.new(response).handle @@ -34,11 +34,11 @@ class << self end def self.upload(session, path, file_binary, content_type, params) - response = BeyondApi::Connection.default.post do |request| + response = Connection.default.post do |request| request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.headers["Content-Type"] = content_type - request.params = camelize_keys(params) + request.params = Utils.camelize_keys(params) request.body = file_binary end @@ -47,7 +47,7 @@ def self.upload(session, path, file_binary, content_type, params) end def self.token(url, params) - response = BeyondApi::Connection.token.post do |request| + response = Connection.token.post do |request| request.url(url) request.params = params end @@ -56,16 +56,16 @@ def self.token(url, params) end def self.upload_by_form(session, path, files, params) - response = BeyondApi::Connection.multipart.post do |request| + response = Connection.multipart.post do |request| request.url(session.api_url + path) request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? request.options[:params_encoder] = Faraday::FlatParamsEncoder - request.params = camelize_keys(params) + request.params = Utils.camelize_keys(params) files = files.split unless files.is_a? Array upload_files = files.map{ |file| Faraday::FilePart.new(File.open(file), - BeyondApi::Utils.file_content_type(file)) } + Utils.file_content_type(file)) } request.body = { image: upload_files } end diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index ab3791e..9a86015 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -36,12 +36,12 @@ def deep_symbolize_keys! body.deep_symbolize_keys! end - def remove_initial_underscore! + def remove_initial_underscore(key) key.starts_with?('_') ? key[1..-1] : key end def raise_error - raise BeyondApi::Error.new(body, status) + raise Error.new(body, status) end end end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index 3bb62a0..e58b255 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -1,13 +1,11 @@ module BeyondApi class BaseService - include BeyondApi::Utils - attr_reader :session def initialize(session) @session = session - # raise InvalidSessionError, "Invalid session" unless session.is_a? BeyondApi::Session + # raise InvalidSessionError, "Invalid session" unless session.is_a? Session # raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil? end @@ -30,7 +28,7 @@ def adjust_response(result) end def fetch_page(url, params = {}) - BeyondApi::Request.get(@session, url, params) + Request.get(@session, url, params) end def fetch_pages(url, resource, params, size) diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb index efc7446..77ad44e 100644 --- a/lib/beyond_api/services/checkout/shipping_zone.rb +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -3,7 +3,7 @@ module Checkout class ShippingZone < BaseService def all # TODO: iterate over all pages - BeyondApi::Request.get(@session, "/shipping-zones") + Request.get(@session, "/shipping-zones") end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 00a8440..6f2bcfc 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Category < BaseService def find(id) - BeyondApi::Request.get(@session, "/categories/#{id}") + Request.get(@session, "/categories/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index b52aaf5..b17c241 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Image < BaseService def all(id) - BeyondApi::Request.get(@session, "/products/#{id}/images") + Request.get(@session, "/products/#{id}/images") end end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 4397a2c..55223a2 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,12 +2,12 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - # BeyondApi::Request.get(@session, "/products", params) + # Request.get(@session, "/products", params) fetch_all_pages("/products", :products, params) end def find(id) - BeyondApi::Request.get(@session, "/products/#{id}") + Request.get(@session, "/products/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 07f1755..1324f00 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Variation < BaseService def all(id) - BeyondApi::Request.get(@session, "/products/#{id}/variations") + Request.get(@session, "/products/#{id}/variations") end end end diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb index 0b5077b..996f657 100644 --- a/lib/beyond_api/services/product_management/variation_image.rb +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class VariationImage < BaseService def all(product_id, variation_id) - BeyondApi::Request.get(@session, "/products/#{product_id}/variations/#{variation_id}/images") + Request.get(@session, "/products/#{product_id}/variations/#{variation_id}/images") end end end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index 7d43b3d..6fd314a 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -6,11 +6,11 @@ def all(params = {}) end def find(id) - BeyondApi::Request.get(@session, "/product-view/categories/#{id}") + Request.get(@session, "/product-view/categories/#{id}") end def preview(body, params = {}) - BeyondApi::Request.post(@session, + Request.post(@session, "/product-view/categories/preview", body, params) diff --git a/lib/beyond_api/services/shop/address.rb b/lib/beyond_api/services/shop/address.rb index 20011f1..4b1f6f3 100644 --- a/lib/beyond_api/services/shop/address.rb +++ b/lib/beyond_api/services/shop/address.rb @@ -2,7 +2,7 @@ module BeyondApi module Shop class Address < BaseService def get - BeyondApi::Request.get(@session, "/shop/address") + Request.get(@session, "/shop/address") end end end diff --git a/lib/beyond_api/services/shop/shop.rb b/lib/beyond_api/services/shop/shop.rb index 6b3e07a..84a48bb 100644 --- a/lib/beyond_api/services/shop/shop.rb +++ b/lib/beyond_api/services/shop/shop.rb @@ -2,7 +2,7 @@ module BeyondApi module Shop class Shop < BaseService def details - BeyondApi::Request.get(@session, "/shop") + Request.get(@session, "/shop") end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 7e74f50..fedfab4 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -4,15 +4,15 @@ class ScriptTag < BaseService def all(params = {}) params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] - BeyondApi::Request.get(@session, "/script-tags", params) + Request.get(@session, "/script-tags", params) end def create(script_url) - BeyondApi::Request.post(@session, "/script-tags", script_url:) + Request.post(@session, "/script-tags", script_url:) end def delete(id) - BeyondApi::Request.delete(@session, "/script-tags/#{id}") + Request.delete(@session, "/script-tags/#{id}") end end end diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb index db931b3..6cdab45 100644 --- a/lib/beyond_api/session.rb +++ b/lib/beyond_api/session.rb @@ -18,91 +18,91 @@ def initialize(api_url:, access_token: nil, refresh_token: nil) end def carts - BeyondApi::Carts.new(self) + Carts.new(self) end def categories_view - BeyondApi::CategoriesView.new(self) + CategoriesView.new(self) end def categories - BeyondApi::Categories.new(self) + Categories.new(self) end def checkout_settings - BeyondApi::CheckoutSettings.new(self) + CheckoutSettings.new(self) end def customers - BeyondApi::Customers.new(self) + Customers.new(self) end def newsletter_target - BeyondApi::NewsletterTarget.new(self) + NewsletterTarget.new(self) end def order_settings - BeyondApi::OrderSettings.new(self) + OrderSettings.new(self) end def orders - BeyondApi::Orders.new(self) + Orders.new(self) end def payment_method_definitions - BeyondApi::PaymentMethodDefinitions.new(self) + PaymentMethodDefinitions.new(self) end def payment_methods - BeyondApi::PaymentMethods.new(self) + PaymentMethods.new(self) end def pickup_options - BeyondApi::PickupOptions.new(self) + PickupOptions.new(self) end def product_attribute_definitions - BeyondApi::ProductAttributeDefinitions.new(self) + ProductAttributeDefinitions.new(self) end def products_view - BeyondApi::ProductsView.new(self) + ProductsView.new(self) end def products - BeyondApi::Products.new(self) + Products.new(self) end def script_tags - BeyondApi::ScriptTags.new(self) + ScriptTags.new(self) end def shipping_zones - BeyondApi::ShippingZones.new(self) + ShippingZones.new(self) end def shop - BeyondApi::Shop.new(self) + Shop.new(self) end def signers - BeyondApi::Signers.new(self) + Signers.new(self) end def token - BeyondApi::Token.new(self) + Token.new(self) end def users - BeyondApi::Users.new(self) + Users.new(self) end def variations - BeyondApi::Variations.new(self) + Variations.new(self) end def webhook_subscriptions - BeyondApi::WebhookSubscriptions.new(self) + WebhookSubscriptions.new(self) end end end diff --git a/lib/beyond_api/token.rb b/lib/beyond_api/token.rb index 75d729a..c6d9fce 100644 --- a/lib/beyond_api/token.rb +++ b/lib/beyond_api/token.rb @@ -6,8 +6,6 @@ module BeyondApi class Token class InvalidSessionError < StandardError; end - include BeyondApi::Utils - attr_reader :session def initialize(session) diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index bf9891b..755f294 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -4,9 +4,7 @@ module BeyondApi module Utils - extend self - - def file_content_type(file_path) + def self.file_content_type(file_path) case File.extname(file_path) when ".png" "image/png" @@ -17,7 +15,7 @@ def file_content_type(file_path) end end - def camelize_keys(hash) + def self.camelize_keys(hash) hash.deep_transform_keys { |key| key.to_s.camelize(:lower) } end end From 28f075df7e576e39ae2bd101d3ea5788a5db4d80 Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 6 Aug 2024 17:56:00 +0200 Subject: [PATCH 14/59] Update fetch all (#64) * add product management category * Fix namespaces * Update fetch all pages --- lib/beyond_api/services/base_service.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index e58b255..21a4bc9 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -11,11 +11,11 @@ def initialize(session) def fetch_all_pages(url, resource, params = {}) if params[:paginated] == false - result = fetch_pages(url, resource, params, BeyondApi.configuration.all_pagination_size) + result = fetch_pages(url, resource, params) adjust_response(result) result else - fetch_page(url, params) + fetch_page(url, 0, params) end end @@ -27,16 +27,18 @@ def adjust_response(result) result[:page][:number] = 0 end - def fetch_page(url, params = {}) - Request.get(@session, url, params) + # FIXME: find another way + def fetch_page(url, page, params = {}) + params.merge!(page:, size: BeyondApi.configuration.all_pagination_size) + BeyondApi::Request.get(@session, url, params) end - def fetch_pages(url, resource, params, size) - result = fetch_page(url, params.merge(page: 0, size:)) + def fetch_pages(url, resource, params) + result = fetch_page(url, 0, params) (1..result[:page][:total_pages] - 1).each do |page| result[:embedded][resource].concat( - fetch_page(url, params.merge(page:, size:))[:embedded][resource] + fetch_page(url, page, params)[:embedded][resource] ) end From 96293f3aecb5ab875626c50f36348fc2c7f8e4d5 Mon Sep 17 00:00:00 2001 From: citin Date: Wed, 7 Aug 2024 09:10:57 +0200 Subject: [PATCH 15/59] [wip] refactor connection and request --- beyond_api.gemspec | 4 +- lib/beyond_api.rb | 2 +- lib/beyond_api/connection.rb | 79 ++++++++++++++------------ lib/beyond_api/request.rb | 104 ++++++++++++++++++++--------------- lib/beyond_api/session.rb | 88 ----------------------------- 5 files changed, 107 insertions(+), 170 deletions(-) diff --git a/beyond_api.gemspec b/beyond_api.gemspec index e079753..e614dfc 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -32,6 +32,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "yard", "~> 0.9" spec.add_dependency "zeitwerk" - spec.add_dependency "faraday", "~> 1.9.0" - spec.add_dependency "faraday_middleware", "~> 1.1" + spec.add_dependency "faraday", "~> 2.10.0" + spec.add_dependency "faraday-retry" end diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 30caccf..3270bc0 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -2,7 +2,7 @@ require 'zeitwerk' require 'faraday' -require 'faraday_middleware' +require 'faraday/retry' require 'json' require 'forwardable' diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index a695de2..70b6c50 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -2,47 +2,58 @@ module BeyondApi class Connection - LOGGER = ::BeyondApi.logger + LOGGER = BeyondApi.logger LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") - def self.default - Faraday.new(ssl: { verify: true }) do |faraday| - faraday.adapter(:net_http) - faraday.options[:open_timeout] = BeyondApi.configuration.open_timeout.to_i - faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i - faraday.headers["Accept"] = "application/json" - faraday.headers["Content-Type"] = "application/json" - faraday.request(:json) - faraday.request(:multipart) - faraday.request(:url_encoded) - faraday.request(:retry, BeyondApi.configuration.retry_options) - faraday.response(:json, content_type: "application/json") - faraday.response :logger, LOGGER, { headers: BeyondApi.configuration.log_headers, - bodies: BeyondApi.configuration.log_bodies } + class << self + def default + create_connection do |faraday| + faraday.headers["Accept"] = 'application/json' # Set default accept header + faraday.headers["Content-Type"] = 'application/json' # Set default content type + faraday.request :json # Encode request bodies as JSON + faraday.request :retry, BeyondApi.configuration.retry_options + faraday.response :json, content_type: "application/json" + faraday.response :logger, *logger_config + end end - end - def self.token - Faraday.new(ssl: { verify: true }) do |faraday| - faraday.options[:open_timeout] = BeyondApi.configuration.open_timeout.to_i - faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i - faraday.response :logger, LOGGER, { headers: BeyondApi.configuration.log_headers, - bodies: BeyondApi.configuration.log_bodies } do |logger| - logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') - logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') + def token + create_connection do |faraday| + faraday.headers["Accept"] = "application/json" + faraday.request :basic_auth, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret + faraday.response :logger, *logger_config { |logger| apply_filters(logger) } end - faraday.headers['Accept'] = 'application/json' - faraday.adapter(:net_http) - faraday.request :basic_auth, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret end - end - def self.multipart - Faraday.new(ssl: { verify: true }) do |faraday| - faraday.options[:open_timeout] = BeyondApi.configuration.open_timeout.to_i - faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i - faraday.request :multipart, { flat_encode: true } - faraday.adapter Faraday.default_adapter + def multipart + create_connection do |faraday| + faraday.adapter Faraday.default_adapter + faraday.request :multipart, flat_encode: true + end + end + + private + + def create_connection + Faraday.new(ssl: { verify: true }) do |faraday| + faraday.options.timeout = BeyondApi.configuration.timeout.to_i + faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i + + yield(faraday) if block_given? + end + end + + def logger_config + [ + LOGGER, + bodies: BeyondApi.configuration.log_bodies, + headers: BeyondApi.configuration.log_headers + ] + end + + def apply_filters(logger) + logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') + logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') end end end diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index eecb656..8f81dd8 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -2,48 +2,63 @@ module BeyondApi class Request - class << self - [:get, :delete].each do |method| - define_method(method) do |session, path, params = {}| - response = Connection.default.send(method) do |request| - request.url(session.api_url + path) - request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? - request.params = Utils.camelize_keys(params) - end + def initialize(session, connection = Connection.default) + @session = session + @connection = connection + end - Response.new(response).handle - rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e - raise(FaradayError.new(e, 599)) - end - end + def get(path, params = {}) + send_request( + :get, + path, + params: params + ) + end - [:post, :put, :patch].each do |method| - define_method(method) do |session, path, body = {}, params = {}, content_type = 'application/json'| - response = Connection.default.send(method) do |request| - request.url(session.api_url + path) - request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? - request.headers["Content-Type"] = content_type - request.params = Utils.camelize_keys(params) + def delete(path, params = {}) + send_request( + :delete, + path, + params: params + ) + end - request.body = Utils.camelize_keys(body).to_json - end + def post(path, body = {}, params = {}, content_type = 'application/json') + send_request( + :post, + path, + body: body, params: params, content_type: content_type + ) + end - Response.new(response).handle - end - end + def put(path, body = {}, params = {}, content_type = 'application/json') + send_request( + :put, + path, + body: body, params: params, content_type: content_type + ) end - def self.upload(session, path, file_binary, content_type, params) - response = Connection.default.post do |request| - request.url(session.api_url + path) - request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? - request.headers["Content-Type"] = content_type - request.params = Utils.camelize_keys(params) + def patch(path, body = {}, params = {}, content_type = 'application/json') + send_request( + :patch, + path, + body: body, params: params, content_type: content_type + ) + end - request.body = file_binary - end + def upload(path, file_binary, content_type, params) + send_request( + :post, + path, + body: file_binary, params: params, content_type: content_type + ) + end - Response.new(response) + def upload_by_form(path, files, params) + files = files.split unless files.is_a?(Array) + upload_files = files.map { |file| Faraday::FilePart.new(File.open(file), Utils.file_content_type(file)) } + send_request(:post, path, body: { image: upload_files }, params: params, content_type: 'multipart/form-data') end def self.token(url, params) @@ -55,21 +70,20 @@ def self.token(url, params) [response.body.blank? ? nil : JSON.parse(response.body), response.status] end - def self.upload_by_form(session, path, files, params) - response = Connection.multipart.post do |request| - request.url(session.api_url + path) - request.headers["Authorization"] = "Bearer #{session.access_token}" unless session.access_token.nil? - request.options[:params_encoder] = Faraday::FlatParamsEncoder + private + def send_request(method, path, body: {}, params: {}, content_type: 'application/json') + response = Connection.default.send(method) do |request| + request.url(@session.api_url + path) + request.headers["Authorization"] = "Bearer #{@session.access_token}" unless @session.access_token.nil? + request.headers["Content-Type"] = content_type if method != :get request.params = Utils.camelize_keys(params) - - files = files.split unless files.is_a? Array - upload_files = files.map{ |file| Faraday::FilePart.new(File.open(file), - Utils.file_content_type(file)) } - request.body = { image: upload_files } + request.body = Utils.camelize_keys(body) if method != :get end - Response.new(response) + Response.new(response).handle + rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e + raise(FaradayError.new(e, 599)) end end end diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb index 6cdab45..6178d5c 100644 --- a/lib/beyond_api/session.rb +++ b/lib/beyond_api/session.rb @@ -16,93 +16,5 @@ def initialize(api_url:, access_token: nil, refresh_token: nil) @access_token = access_token @refresh_token = refresh_token end - - def carts - Carts.new(self) - end - - def categories_view - CategoriesView.new(self) - end - - def categories - Categories.new(self) - end - - def checkout_settings - CheckoutSettings.new(self) - end - - def customers - Customers.new(self) - end - - def newsletter_target - NewsletterTarget.new(self) - end - - def order_settings - OrderSettings.new(self) - end - - def orders - Orders.new(self) - end - - def payment_method_definitions - PaymentMethodDefinitions.new(self) - end - - def payment_methods - PaymentMethods.new(self) - end - - def pickup_options - PickupOptions.new(self) - end - - def product_attribute_definitions - ProductAttributeDefinitions.new(self) - end - - def products_view - ProductsView.new(self) - end - - def products - Products.new(self) - end - - def script_tags - ScriptTags.new(self) - end - - def shipping_zones - ShippingZones.new(self) - end - - def shop - Shop.new(self) - end - - def signers - Signers.new(self) - end - - def token - Token.new(self) - end - - def users - Users.new(self) - end - - def variations - Variations.new(self) - end - - def webhook_subscriptions - WebhookSubscriptions.new(self) - end end end From 51b86216b50bd25dea2a48b62f841606285696ed Mon Sep 17 00:00:00 2001 From: citin Date: Wed, 7 Aug 2024 11:14:09 +0200 Subject: [PATCH 16/59] [WIP] refactor connection --- .ruby-version | 1 + Gemfile | 4 + Gemfile.lock | 169 ++++++++++-------- lib/beyond_api/connection.rb | 91 +++++----- lib/beyond_api/request.rb | 92 ++-------- lib/beyond_api/services/base_service.rb | 4 +- .../services/checkout/shipping_zone.rb | 2 +- .../services/product_management/category.rb | 2 +- .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 4 +- .../services/product_management/variation.rb | 2 +- .../product_management/variation_image.rb | 2 +- .../services/product_view/category.rb | 10 +- lib/beyond_api/services/shop/address.rb | 2 +- lib/beyond_api/services/shop/shop.rb | 2 +- .../services/storefront/script_tag.rb | 6 +- lib/beyond_api/session.rb | 4 + lib/beyond_api/token.rb | 1 + 18 files changed, 189 insertions(+), 211 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..944880f --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.0 diff --git a/Gemfile b/Gemfile index f1be1b3..803ec0f 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,10 @@ gemspec gem "pry" +group :development do + gem 'ruby-lsp' +end + group :test do gem "factory_bot" end diff --git a/Gemfile.lock b/Gemfile.lock index 2511e25..b665caa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,107 +2,125 @@ PATH remote: . specs: beyond_api (0.24.2.pre) - faraday (~> 1.9.0) - faraday_middleware (~> 1.1) + faraday (~> 2.10.0) + faraday-retry zeitwerk GEM remote: https://rubygems.org/ specs: - activesupport (6.1.4.1) + activesupport (7.1.3.4) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - zeitwerk (~> 2.3) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.8) coderay (1.1.3) - concurrent-ruby (1.1.9) - diff-lcs (1.4.4) - dotenv (2.7.6) - factory_bot (6.2.0) + concurrent-ruby (1.3.3) + connection_pool (2.4.1) + diff-lcs (1.5.1) + dotenv (2.8.1) + drb (2.2.1) + factory_bot (6.4.6) activesupport (>= 5.0.0) - faker (2.19.0) - i18n (>= 1.6, < 2) - faraday (1.9.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) - ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) - faraday_middleware (1.2.0) - faraday (~> 1.0) - i18n (1.8.11) + faker (2.23.0) + i18n (>= 1.8.11, < 2) + faraday (2.10.1) + faraday-net_http (>= 2.0, < 3.2) + logger + faraday-net_http (3.1.1) + net-http + faraday-retry (2.2.1) + faraday (~> 2.0) + i18n (1.14.5) concurrent-ruby (~> 1.0) - method_source (1.0.0) - minitest (5.14.4) - multipart-post (2.4.1) - parallel (1.21.0) - parser (3.0.3.1) + json (2.7.2) + language_server-protocol (3.17.0.3) + logger (1.6.0) + method_source (1.1.0) + minitest (5.24.1) + mutex_m (0.2.0) + net-http (0.4.1) + uri + parallel (1.25.1) + parser (3.3.4.0) ast (~> 2.4.1) - pry (0.14.1) + racc + prism (0.30.0) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - rainbow (3.0.0) + racc (1.8.1) + rainbow (3.1.1) rake (10.5.0) - regexp_parser (2.1.1) - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rbs (3.5.2) + logger + regexp_parser (2.9.2) + rexml (3.3.4) + strscan + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.3) - rubocop (1.23.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.65.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.13.0) - parser (>= 3.0.1.1) - rubocop-ordered_methods (0.9) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.0) + parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-ordered_methods (0.12) rubocop (>= 1.0) - rubocop-rspec (2.6.0) - rubocop (~> 1.19) - ruby-progressbar (1.11.0) - ruby2_keywords (0.0.5) - tzinfo (2.0.4) + rubocop-rspec (2.31.0) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.29.1) + rubocop (~> 1.61) + ruby-lsp (0.17.11) + language_server-protocol (~> 3.17.0) + prism (>= 0.29.0, < 0.31) + rbs (>= 3, < 4) + sorbet-runtime (>= 0.5.10782) + ruby-progressbar (1.13.0) + sorbet-runtime (0.5.11514) + strscan (3.1.0) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) - webrick (1.7.0) - yard (0.9.27) - webrick (~> 1.7.0) - zeitwerk (2.5.1) + unicode-display_width (2.5.0) + uri (0.13.0) + yard (0.9.36) + zeitwerk (2.6.17) PLATFORMS + ruby x86_64-darwin-22 DEPENDENCIES @@ -117,6 +135,7 @@ DEPENDENCIES rubocop (~> 1.20) rubocop-ordered_methods (~> 0.9) rubocop-rspec (~> 2.4) + ruby-lsp yard (~> 0.9) BUNDLED WITH diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index 70b6c50..73b2d30 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -1,60 +1,63 @@ # frozen_string_literal: true module BeyondApi - class Connection + module Connection LOGGER = BeyondApi.logger LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") - class << self - def default - create_connection do |faraday| - faraday.headers["Accept"] = 'application/json' # Set default accept header - faraday.headers["Content-Type"] = 'application/json' # Set default content type - faraday.request :json # Encode request bodies as JSON - faraday.request :retry, BeyondApi.configuration.retry_options - faraday.response :json, content_type: "application/json" - faraday.response :logger, *logger_config + def agent + @agent ||= Faraday.new(ssl: { verify: true }) do |faraday| + # Base URL + faraday.url_prefix @session.api_url + + # Timeouts + faraday.options.timeout = BeyondApi.configuration.timeout.to_i + faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i + + # Authorization + if @session && @session.access_token.present? + faraday.request :authorization, "Bearer", @session.access_token + else + faraday.request :authorization, :basic, BeyondApi.configuration.client_id, + BeyondApi.configuration.client_secret end - end - - def token - create_connection do |faraday| - faraday.headers["Accept"] = "application/json" - faraday.request :basic_auth, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret - faraday.response :logger, *logger_config { |logger| apply_filters(logger) } - end - end - - def multipart - create_connection do |faraday| - faraday.adapter Faraday.default_adapter - faraday.request :multipart, flat_encode: true - end - end - private + # Headers + faraday.headers["Accept"] = "application/json" # Set default accept header + faraday.headers["Content-Type"] = "application/json" # Set default content type - def create_connection - Faraday.new(ssl: { verify: true }) do |faraday| - faraday.options.timeout = BeyondApi.configuration.timeout.to_i - faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i + # Request options + faraday.request :json # Encode request bodies as JSON + faraday.request :retry, BeyondApi.configuration.retry_options - yield(faraday) if block_given? - end + # Response options + faraday.response :json, content_type: "application/json" + faraday.response :logger, *logger_config { |logger| apply_filters(logger) } end + end - def logger_config - [ - LOGGER, - bodies: BeyondApi.configuration.log_bodies, - headers: BeyondApi.configuration.log_headers - ] - end + def apply_filters(logger) + logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') + logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') + end - def apply_filters(logger) - logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') - logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') - end + def get(path, params = {}) + @agent.get(path, params) + end + + # def multipart + # create_connection do |faraday| + # faraday.adapter Faraday.default_adapter + # faraday.request :multipart, flat_encode: true + # end + # end + + def logger_config + [ + LOGGER, + { bodies: BeyondApi.configuration.log_bodies, + headers: BeyondApi.configuration.log_headers } + ] end end end diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 8f81dd8..29e5ee2 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -1,89 +1,33 @@ # frozen_string_literal: true module BeyondApi - class Request - def initialize(session, connection = Connection.default) - @session = session - @connection = connection - end - - def get(path, params = {}) - send_request( - :get, - path, - params: params - ) - end - - def delete(path, params = {}) - send_request( - :delete, - path, - params: params - ) - end - - def post(path, body = {}, params = {}, content_type = 'application/json') - send_request( - :post, - path, - body: body, params: params, content_type: content_type - ) - end - - def put(path, body = {}, params = {}, content_type = 'application/json') - send_request( - :put, - path, - body: body, params: params, content_type: content_type - ) - end - - def patch(path, body = {}, params = {}, content_type = 'application/json') - send_request( - :patch, - path, - body: body, params: params, content_type: content_type - ) - end - - def upload(path, file_binary, content_type, params) - send_request( - :post, - path, - body: file_binary, params: params, content_type: content_type - ) + class Connection + class << self + def token + create_connection do |faraday| + faraday.headers["Accept"] = "application/json" + faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret + faraday.response :logger, *logger_config { |logger| apply_filters(logger) } + end + end end + def create_connection + Faraday.new(ssl: { verify: true }) do |faraday| + faraday.options.timeout = BeyondApi.configuration.timeout.to_i + faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i - def upload_by_form(path, files, params) - files = files.split unless files.is_a?(Array) - upload_files = files.map { |file| Faraday::FilePart.new(File.open(file), Utils.file_content_type(file)) } - send_request(:post, path, body: { image: upload_files }, params: params, content_type: 'multipart/form-data') + yield(faraday) if block_given? + end end - + end + class Request def self.token(url, params) - response = Connection.token.post do |request| + response = BeyondApi::Connection.token.post do |request| request.url(url) request.params = params end [response.body.blank? ? nil : JSON.parse(response.body), response.status] end - - private - - def send_request(method, path, body: {}, params: {}, content_type: 'application/json') - response = Connection.default.send(method) do |request| - request.url(@session.api_url + path) - request.headers["Authorization"] = "Bearer #{@session.access_token}" unless @session.access_token.nil? - request.headers["Content-Type"] = content_type if method != :get - request.params = Utils.camelize_keys(params) - request.body = Utils.camelize_keys(body) if method != :get - end - - Response.new(response).handle - rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e - raise(FaradayError.new(e, 599)) - end end end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index 21a4bc9..fb0a85d 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -2,6 +2,8 @@ module BeyondApi class BaseService attr_reader :session + include Connection # @session + def initialize(session) @session = session @@ -30,7 +32,7 @@ def adjust_response(result) # FIXME: find another way def fetch_page(url, page, params = {}) params.merge!(page:, size: BeyondApi.configuration.all_pagination_size) - BeyondApi::Request.get(@session, url, params) + BeyondApi::Request.new(@session).get(url, params) end def fetch_pages(url, resource, params) diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb index 77ad44e..f29a68a 100644 --- a/lib/beyond_api/services/checkout/shipping_zone.rb +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -3,7 +3,7 @@ module Checkout class ShippingZone < BaseService def all # TODO: iterate over all pages - Request.get(@session, "/shipping-zones") + Request.new(@session).get("/shipping-zones") end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 6f2bcfc..75cdbe3 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Category < BaseService def find(id) - Request.get(@session, "/categories/#{id}") + Request.new(@session).get("/categories/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index b17c241..a1e175a 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Image < BaseService def all(id) - Request.get(@session, "/products/#{id}/images") + Request.new(@session).get("/products/#{id}/images") end end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 55223a2..83cfc1d 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,12 +2,12 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - # Request.get(@session, "/products", params) + # Request.new(@session).get("/products", params) fetch_all_pages("/products", :products, params) end def find(id) - Request.get(@session, "/products/#{id}") + Request.new(@session).get("/products/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 1324f00..8e34c24 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Variation < BaseService def all(id) - Request.get(@session, "/products/#{id}/variations") + Request.new(@session).get("/products/#{id}/variations") end end end diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb index 996f657..0eb3eb7 100644 --- a/lib/beyond_api/services/product_management/variation_image.rb +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class VariationImage < BaseService def all(product_id, variation_id) - Request.get(@session, "/products/#{product_id}/variations/#{variation_id}/images") + Request.new(@session).get("/products/#{product_id}/variations/#{variation_id}/images") end end end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index 6fd314a..abeeb34 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -6,14 +6,14 @@ def all(params = {}) end def find(id) - Request.get(@session, "/product-view/categories/#{id}") + get("/product-view/categories/#{id}") end def preview(body, params = {}) - Request.post(@session, - "/product-view/categories/preview", - body, - params) + post( + "/product-view/categories/preview", + body, + params) end end end diff --git a/lib/beyond_api/services/shop/address.rb b/lib/beyond_api/services/shop/address.rb index 4b1f6f3..c01922d 100644 --- a/lib/beyond_api/services/shop/address.rb +++ b/lib/beyond_api/services/shop/address.rb @@ -2,7 +2,7 @@ module BeyondApi module Shop class Address < BaseService def get - Request.get(@session, "/shop/address") + Request.new(@session).get("/shop/address") end end end diff --git a/lib/beyond_api/services/shop/shop.rb b/lib/beyond_api/services/shop/shop.rb index 84a48bb..b758623 100644 --- a/lib/beyond_api/services/shop/shop.rb +++ b/lib/beyond_api/services/shop/shop.rb @@ -2,7 +2,7 @@ module BeyondApi module Shop class Shop < BaseService def details - Request.get(@session, "/shop") + Request.new(@session).get("/shop") end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index fedfab4..2dcbcf4 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -4,15 +4,15 @@ class ScriptTag < BaseService def all(params = {}) params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] - Request.get(@session, "/script-tags", params) + Request.new(@session).get("/script-tags", params) end def create(script_url) - Request.post(@session, "/script-tags", script_url:) + Request.new(@session).post("/script-tags", script_url:) end def delete(id) - Request.delete(@session, "/script-tags/#{id}") + Request.new(@session).delete("/script-tags/#{id}") end end end diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb index 6178d5c..0998b04 100644 --- a/lib/beyond_api/session.rb +++ b/lib/beyond_api/session.rb @@ -16,5 +16,9 @@ def initialize(api_url:, access_token: nil, refresh_token: nil) @access_token = access_token @refresh_token = refresh_token end + + def token + Token.new(self) + end end end diff --git a/lib/beyond_api/token.rb b/lib/beyond_api/token.rb index c6d9fce..fcc70aa 100644 --- a/lib/beyond_api/token.rb +++ b/lib/beyond_api/token.rb @@ -3,6 +3,7 @@ require "beyond_api/utils" module BeyondApi + class Token class InvalidSessionError < StandardError; end From 3f06cc0cc468f918bb3064884b5d3979509eb088 Mon Sep 17 00:00:00 2001 From: citin Date: Wed, 7 Aug 2024 11:46:43 +0200 Subject: [PATCH 17/59] [WIP] refactor token call --- lib/beyond_api/connection.rb | 16 ++++------- lib/beyond_api/request.rb | 54 +++++++++++++++++------------------- lib/beyond_api/token.rb | 23 +++++++++------ 3 files changed, 45 insertions(+), 48 deletions(-) diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index 73b2d30..a51a975 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -5,11 +5,12 @@ module Connection LOGGER = BeyondApi.logger LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") - def agent - @agent ||= Faraday.new(ssl: { verify: true }) do |faraday| - # Base URL - faraday.url_prefix @session.api_url + # def get(path, params = {}) + # @agent.get(path, params) + # end + def agent + @agent ||= Faraday.new(url: @session.api_url, ssl: { verify: true }) do |faraday| # Timeouts faraday.options.timeout = BeyondApi.configuration.timeout.to_i faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i @@ -18,8 +19,7 @@ def agent if @session && @session.access_token.present? faraday.request :authorization, "Bearer", @session.access_token else - faraday.request :authorization, :basic, BeyondApi.configuration.client_id, - BeyondApi.configuration.client_secret + faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret end # Headers @@ -41,10 +41,6 @@ def apply_filters(logger) logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') end - def get(path, params = {}) - @agent.get(path, params) - end - # def multipart # create_connection do |faraday| # faraday.adapter Faraday.default_adapter diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb index 29e5ee2..614005b 100644 --- a/lib/beyond_api/request.rb +++ b/lib/beyond_api/request.rb @@ -1,33 +1,29 @@ # frozen_string_literal: true -module BeyondApi - class Connection - class << self - def token - create_connection do |faraday| - faraday.headers["Accept"] = "application/json" - faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret - faraday.response :logger, *logger_config { |logger| apply_filters(logger) } - end - end - end - def create_connection - Faraday.new(ssl: { verify: true }) do |faraday| - faraday.options.timeout = BeyondApi.configuration.timeout.to_i - faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i +# module BeyondApi +# class Connection +# class << self +# def token +# create_connection do |faraday| +# faraday.headers["Accept"] = "application/json" +# faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret +# faraday.response :logger, *logger_config { |logger| apply_filters(logger) } +# end +# end +# end +# def create_connection +# Faraday.new(ssl: { verify: true }) do |faraday| +# faraday.options.timeout = BeyondApi.configuration.timeout.to_i +# faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i - yield(faraday) if block_given? - end - end - end - class Request - def self.token(url, params) - response = BeyondApi::Connection.token.post do |request| - request.url(url) - request.params = params - end +# yield(faraday) if block_given? +# end +# end +# end - [response.body.blank? ? nil : JSON.parse(response.body), response.status] - end - end -end +# class Request +# def self.token(url, params) + +# end +# end +# end diff --git a/lib/beyond_api/token.rb b/lib/beyond_api/token.rb index fcc70aa..3daa1ea 100644 --- a/lib/beyond_api/token.rb +++ b/lib/beyond_api/token.rb @@ -5,6 +5,8 @@ module BeyondApi class Token + include Connection + class InvalidSessionError < StandardError; end attr_reader :session @@ -34,22 +36,25 @@ def client_credentials private def handle_token_call(grant_type, params = {}) - path = "#{@session.api_url}/oauth/token" + path = "/oauth/token?" + params.merge!(grant_type: grant_type) - response, status = BeyondApi::Request.token(path, - params) + response = agent.post(path, {}) do |request| + request.params = params + end + binding.b - handle_response(response, status) + handle_response(response) end - def handle_response(response, status) - if status.between?(200, 299) - @session.access_token = response["access_token"] - @session.refresh_token = response["refresh_token"] + def handle_response(response) + if response.status.between?(200, 299) + @session.access_token = response.body["access_token"] + @session.refresh_token = response.body["refresh_token"] @session else - handle_error(response, status) + raise Error.new(response.body, response.status) end end end From ed0d19d3cddd3b4219074109d4583027002f9a44 Mon Sep 17 00:00:00 2001 From: Kathia Date: Wed, 7 Aug 2024 13:35:27 +0200 Subject: [PATCH 18/59] Wip v2 (#65) * Fix connection * Update requests --- lib/beyond_api/connection.rb | 19 +++++++++++++++---- .../services/checkout/shipping_zone.rb | 3 +-- .../services/product_management/category.rb | 2 +- .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 7 ++++--- .../services/product_management/variation.rb | 2 +- .../product_management/variation_image.rb | 2 +- .../services/product_view/category.rb | 10 ++++------ lib/beyond_api/services/shop/address.rb | 4 ++-- lib/beyond_api/services/shop/shop.rb | 4 ++-- .../services/storefront/script_tag.rb | 6 +++--- lib/beyond_api/token.rb | 6 +++--- 12 files changed, 38 insertions(+), 29 deletions(-) diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index a51a975..65a38b6 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -5,9 +5,20 @@ module Connection LOGGER = BeyondApi.logger LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") - # def get(path, params = {}) - # @agent.get(path, params) - # end + def get(path, params = {}) + parsed_response agent.get(path, params) + end + + def post(path, body = {}, params = {}) + response = agent.post(path, body) do |request| + request.params = params + end + parsed_response(response) + end + + def parsed_response(response) + Response.new(response).handle + end def agent @agent ||= Faraday.new(url: @session.api_url, ssl: { verify: true }) do |faraday| @@ -16,7 +27,7 @@ def agent faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i # Authorization - if @session && @session.access_token.present? + if @oauth.blank? # @session && @session.access_token.present? faraday.request :authorization, "Bearer", @session.access_token else faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb index f29a68a..d2836c1 100644 --- a/lib/beyond_api/services/checkout/shipping_zone.rb +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -2,8 +2,7 @@ module BeyondApi module Checkout class ShippingZone < BaseService def all - # TODO: iterate over all pages - Request.new(@session).get("/shipping-zones") + get("shipping-zones") end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 75cdbe3..a2c4058 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Category < BaseService def find(id) - Request.new(@session).get("/categories/#{id}") + get("categories/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index a1e175a..50cb0da 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Image < BaseService def all(id) - Request.new(@session).get("/products/#{id}/images") + get("products/#{id}/images") end end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 83cfc1d..56f9c8d 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,12 +2,13 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - # Request.new(@session).get("/products", params) - fetch_all_pages("/products", :products, params) + # Request.new(@session).get("products", params) + # fetch_all_pages("/products", :products, params) + get("products", params) end def find(id) - Request.new(@session).get("/products/#{id}") + get("products/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 8e34c24..12d00a1 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Variation < BaseService def all(id) - Request.new(@session).get("/products/#{id}/variations") + get("products/#{id}/variations") end end end diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb index 0eb3eb7..22194a9 100644 --- a/lib/beyond_api/services/product_management/variation_image.rb +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class VariationImage < BaseService def all(product_id, variation_id) - Request.new(@session).get("/products/#{product_id}/variations/#{variation_id}/images") + get("products/#{product_id}/variations/#{variation_id}/images") end end end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index abeeb34..005042c 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -2,18 +2,16 @@ module BeyondApi module ProductView class Category < BaseService def all(params = {}) - fetch_all_pages("/product-view/categories", :categories, params) + # fetch_all_pages("product-view/categories", :categories, params) + get("product-view/categories", params) end def find(id) - get("/product-view/categories/#{id}") + get("product-view/categories/#{id}") end def preview(body, params = {}) - post( - "/product-view/categories/preview", - body, - params) + post("product-view/categories/preview", body, params) end end end diff --git a/lib/beyond_api/services/shop/address.rb b/lib/beyond_api/services/shop/address.rb index c01922d..cca88aa 100644 --- a/lib/beyond_api/services/shop/address.rb +++ b/lib/beyond_api/services/shop/address.rb @@ -1,8 +1,8 @@ module BeyondApi module Shop class Address < BaseService - def get - Request.new(@session).get("/shop/address") + def show + get("shop/address") end end end diff --git a/lib/beyond_api/services/shop/shop.rb b/lib/beyond_api/services/shop/shop.rb index b758623..d360de1 100644 --- a/lib/beyond_api/services/shop/shop.rb +++ b/lib/beyond_api/services/shop/shop.rb @@ -1,8 +1,8 @@ module BeyondApi module Shop class Shop < BaseService - def details - Request.new(@session).get("/shop") + def show + get("shop") end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 2dcbcf4..e5fd958 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -4,15 +4,15 @@ class ScriptTag < BaseService def all(params = {}) params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] - Request.new(@session).get("/script-tags", params) + get("script-tags", params) end def create(script_url) - Request.new(@session).post("/script-tags", script_url:) + post("script-tags", script_url:) end def delete(id) - Request.new(@session).delete("/script-tags/#{id}") + delete("script-tags/#{id}") end end end diff --git a/lib/beyond_api/token.rb b/lib/beyond_api/token.rb index 3daa1ea..aed0787 100644 --- a/lib/beyond_api/token.rb +++ b/lib/beyond_api/token.rb @@ -36,14 +36,14 @@ def client_credentials private def handle_token_call(grant_type, params = {}) - path = "/oauth/token?" + path = "oauth/token?" + @oauth = true params.merge!(grant_type: grant_type) - response = agent.post(path, {}) do |request| + response = agent.post(path) do |request| request.params = params end - binding.b handle_response(response) end From d12cdcee8795f3c4a3b6a5bb0afc35a6a4bc48f2 Mon Sep 17 00:00:00 2001 From: citin Date: Wed, 7 Aug 2024 16:17:11 +0200 Subject: [PATCH 19/59] [WIP] add authentication --- lib/beyond_api/request.rb | 29 --------- .../services/authentication/token.rb | 18 ++++++ lib/beyond_api/services/base_service.rb | 5 +- lib/beyond_api/session.rb | 34 +++++++++-- lib/beyond_api/token.rb | 61 ------------------- 5 files changed, 48 insertions(+), 99 deletions(-) delete mode 100644 lib/beyond_api/request.rb create mode 100644 lib/beyond_api/services/authentication/token.rb delete mode 100644 lib/beyond_api/token.rb diff --git a/lib/beyond_api/request.rb b/lib/beyond_api/request.rb deleted file mode 100644 index 614005b..0000000 --- a/lib/beyond_api/request.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -# module BeyondApi -# class Connection -# class << self -# def token -# create_connection do |faraday| -# faraday.headers["Accept"] = "application/json" -# faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret -# faraday.response :logger, *logger_config { |logger| apply_filters(logger) } -# end -# end -# end -# def create_connection -# Faraday.new(ssl: { verify: true }) do |faraday| -# faraday.options.timeout = BeyondApi.configuration.timeout.to_i -# faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i - -# yield(faraday) if block_given? -# end -# end -# end - -# class Request -# def self.token(url, params) - -# end -# end -# end diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb new file mode 100644 index 0000000..c743a62 --- /dev/null +++ b/lib/beyond_api/services/authentication/token.rb @@ -0,0 +1,18 @@ +module BeyondApi + module Authentication + class Token < BaseService + def all(params = {}) + # fetch_all_pages("product-view/categories", :categories, params) + get("product-view/categories", params) + end + + def find(id) + get("product-view/categories/#{id}") + end + + def preview(body, params = {}) + post("product-view/categories/preview", body, params) + end + end + end +end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index fb0a85d..2797c06 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -5,10 +5,7 @@ class BaseService include Connection # @session def initialize(session) - @session = session - - # raise InvalidSessionError, "Invalid session" unless session.is_a? Session - # raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil? + @session = Session.new **session end def fetch_all_pages(url, resource, params = {}) diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb index 0998b04..90cb1cf 100644 --- a/lib/beyond_api/session.rb +++ b/lib/beyond_api/session.rb @@ -2,14 +2,12 @@ module BeyondApi class Session - class InvalidUriProtocolError < StandardError; end + include Connection attr_reader :api_url attr_accessor :access_token, :refresh_token def initialize(api_url:, access_token: nil, refresh_token: nil) - raise InvalidUriProtocolError, "Invalid URI protocol" unless api_url.start_with? "https://" - uri = URI.parse(api_url) @api_url = "#{uri.scheme}://#{uri.host}/api" @@ -17,8 +15,34 @@ def initialize(api_url:, access_token: nil, refresh_token: nil) @refresh_token = refresh_token end - def token - Token.new(self) + def authorization_code(code) + handle_token_call("authorization_code", code: code) + end + + def refresh_token + handle_token_call("refresh_token", refresh_token: refresh_token) + end + + def get_client_credentials + handle_token_call("client_credentials") + end + + alias refresh refresh_token + alias create authorization_code + + private + + def handle_token_call(grant_type, params = {}) + path = "oauth/token" + @oauth = true + + params.merge!(grant_type: grant_type) + + response = post(path, {}, params) + + @session.access_token = response[:access_token] + @session.refresh_token = response[:refresh_token] + @session end end end diff --git a/lib/beyond_api/token.rb b/lib/beyond_api/token.rb deleted file mode 100644 index aed0787..0000000 --- a/lib/beyond_api/token.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - - class Token - include Connection - - class InvalidSessionError < StandardError; end - - attr_reader :session - - def initialize(session) - @session = session - - raise InvalidSessionError, "Invalid session" unless session.is_a? BeyondApi::Session - raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil? - end - - def authorization_code(code) - handle_token_call("authorization_code", code: code) - end - - def refresh_token - handle_token_call("refresh_token", refresh_token: @session.refresh_token) - end - - def client_credentials - handle_token_call("client_credentials") - end - - alias refresh refresh_token - alias create authorization_code - - private - - def handle_token_call(grant_type, params = {}) - path = "oauth/token?" - @oauth = true - - params.merge!(grant_type: grant_type) - - response = agent.post(path) do |request| - request.params = params - end - - handle_response(response) - end - - def handle_response(response) - if response.status.between?(200, 299) - @session.access_token = response.body["access_token"] - @session.refresh_token = response.body["refresh_token"] - @session - else - raise Error.new(response.body, response.status) - end - end - end -end From ca812fcf4b91ccf8911f14693eee6be56bd4db21 Mon Sep 17 00:00:00 2001 From: Kathia Date: Wed, 7 Aug 2024 17:16:28 +0200 Subject: [PATCH 20/59] Wip v2 (#66) * Fix connection * Update requests * Update session --- lib/beyond_api/services/authentication/token.rb | 16 ++++++++-------- lib/beyond_api/services/base_service.rb | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb index c743a62..eb0643e 100644 --- a/lib/beyond_api/services/authentication/token.rb +++ b/lib/beyond_api/services/authentication/token.rb @@ -1,17 +1,17 @@ module BeyondApi module Authentication class Token < BaseService - def all(params = {}) - # fetch_all_pages("product-view/categories", :categories, params) - get("product-view/categories", params) + def refresh(refresh_token) + handle_token_call("refresh_token", refresh_token:) end - def find(id) - get("product-view/categories/#{id}") - end + def handle_token_call(grant_type, params = {}) + path = "oauth/token" + @oauth = true + + params.merge!(grant_type:) - def preview(body, params = {}) - post("product-view/categories/preview", body, params) + post(path, {}, params) end end end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index 2797c06..0a4ac98 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -4,8 +4,8 @@ class BaseService include Connection # @session - def initialize(session) - @session = Session.new **session + def initialize(session = nil) + @session = session end def fetch_all_pages(url, resource, params = {}) From e2eaadc130ae32d3b40fb575e9a683297de08e41 Mon Sep 17 00:00:00 2001 From: Andres Bernardi Date: Thu, 8 Aug 2024 10:47:57 +0200 Subject: [PATCH 21/59] refactor session, add autentication types (#67) * refactor session, add autentication types * fix session --- lib/beyond_api/connection.rb | 31 +++++++----- lib/beyond_api/response.rb | 1 + .../services/authentication/token.rb | 22 +++++---- lib/beyond_api/services/base_service.rb | 17 +++++-- .../services/storefront/script_tag.rb | 2 +- lib/beyond_api/session.rb | 48 ------------------- 6 files changed, 48 insertions(+), 73 deletions(-) delete mode 100644 lib/beyond_api/session.rb diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index 65a38b6..a35360e 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -8,39 +8,46 @@ module Connection def get(path, params = {}) parsed_response agent.get(path, params) end - + def post(path, body = {}, params = {}) - response = agent.post(path, body) do |request| - request.params = params - end - parsed_response(response) + response = agent.post(path, body) do |request| + request.params = params end + parsed_response(response) + end + + def delete(path, params = {}) + parsed_response agent.delete(path, params) + end + + private def parsed_response(response) Response.new(response).handle end + + def parsed_body(body) + Utils.camelize_keys(body) + end def agent @agent ||= Faraday.new(url: @session.api_url, ssl: { verify: true }) do |faraday| # Timeouts faraday.options.timeout = BeyondApi.configuration.timeout.to_i faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i - # Authorization - if @oauth.blank? # @session && @session.access_token.present? - faraday.request :authorization, "Bearer", @session.access_token - else + case @authorization + when :basic faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret + when :bearer + faraday.request :authorization, "Bearer", @session.access_token end - # Headers faraday.headers["Accept"] = "application/json" # Set default accept header faraday.headers["Content-Type"] = "application/json" # Set default content type - # Request options faraday.request :json # Encode request bodies as JSON faraday.request :retry, BeyondApi.configuration.retry_options - # Response options faraday.response :json, content_type: "application/json" faraday.response :logger, *logger_config { |logger| apply_filters(logger) } diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 9a86015..746f494 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -16,6 +16,7 @@ def handle private + # TODO: benchmark this ! def parsed_response return {} if body.blank? diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb index eb0643e..f5487ff 100644 --- a/lib/beyond_api/services/authentication/token.rb +++ b/lib/beyond_api/services/authentication/token.rb @@ -1,17 +1,23 @@ module BeyondApi module Authentication - class Token < BaseService - def refresh(refresh_token) - handle_token_call("refresh_token", refresh_token:) + class Token + include Connection # @session, @authorization + + def initialize(session = nil) + @session = session + @authorization = :basic end - def handle_token_call(grant_type, params = {}) - path = "oauth/token" - @oauth = true + def refresh(refresh_token) + post("oauth/token", {}, { grant_type: "refresh_token", refresh_token: }) + end - params.merge!(grant_type:) + def get(code) + post("oauth/token", {}, { grant_type: "authorization_code" , code: }) + end - post(path, {}, params) + def client_credentials + post("oauth/token", {}, { grant_type: "client_credentials" }) end end end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index 0a4ac98..af16fc5 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -1,11 +1,12 @@ module BeyondApi class BaseService - attr_reader :session + include Connection # @session, @authorization - include Connection # @session + ServiceSession = Struct.new(:api_url, :access_token, :refresh_token) - def initialize(session = nil) - @session = session + def initialize(**params) + @session = initialize_session(params) + @authorization = :bearer end def fetch_all_pages(url, resource, params = {}) @@ -20,6 +21,14 @@ def fetch_all_pages(url, resource, params = {}) private + def initialize_session(session) + ServiceSession.new( + session[:api_url], + session[:access_token], + session[:refresh_token] + ) + end + def adjust_response(result) result[:page][:size] = result[:page][:total_elements] result[:page][:total_pages] = 1 diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index e5fd958..6c5eaed 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -11,7 +11,7 @@ def create(script_url) post("script-tags", script_url:) end - def delete(id) + def destroy(id) delete("script-tags/#{id}") end end diff --git a/lib/beyond_api/session.rb b/lib/beyond_api/session.rb deleted file mode 100644 index 90cb1cf..0000000 --- a/lib/beyond_api/session.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -module BeyondApi - class Session - include Connection - - attr_reader :api_url - attr_accessor :access_token, :refresh_token - - def initialize(api_url:, access_token: nil, refresh_token: nil) - uri = URI.parse(api_url) - - @api_url = "#{uri.scheme}://#{uri.host}/api" - @access_token = access_token - @refresh_token = refresh_token - end - - def authorization_code(code) - handle_token_call("authorization_code", code: code) - end - - def refresh_token - handle_token_call("refresh_token", refresh_token: refresh_token) - end - - def get_client_credentials - handle_token_call("client_credentials") - end - - alias refresh refresh_token - alias create authorization_code - - private - - def handle_token_call(grant_type, params = {}) - path = "oauth/token" - @oauth = true - - params.merge!(grant_type: grant_type) - - response = post(path, {}, params) - - @session.access_token = response[:access_token] - @session.refresh_token = response[:refresh_token] - @session - end - end -end From d4af644b0ecb1e4abef381ead3bf21fd6f5a81c7 Mon Sep 17 00:00:00 2001 From: Kathia Date: Thu, 8 Aug 2024 13:31:15 +0200 Subject: [PATCH 22/59] Add webhook and signer endpoints (#68) * Add webhook and signer endpoints * Fix indentation --- lib/beyond_api/connection.rb | 19 ++++++------- .../services/authentication/signer.rb | 17 ++++++++++++ .../services/webhook/subscription.rb | 27 +++++++++++++++++++ 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 lib/beyond_api/services/authentication/signer.rb create mode 100644 lib/beyond_api/services/webhook/subscription.rb diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb index a35360e..2d8c73c 100644 --- a/lib/beyond_api/connection.rb +++ b/lib/beyond_api/connection.rb @@ -8,24 +8,25 @@ module Connection def get(path, params = {}) parsed_response agent.get(path, params) end - + def post(path, body = {}, params = {}) - response = agent.post(path, body) do |request| - request.params = params + response = agent.post(path, body) do |request| + request.params = params + request.body = parsed_body(body) + end + parsed_response(response) end - parsed_response(response) - end - def delete(path, params = {}) - parsed_response agent.delete(path, params) - end + def delete(path, params = {}) + parsed_response agent.delete(path, params) + end private def parsed_response(response) Response.new(response).handle end - + def parsed_body(body) Utils.camelize_keys(body) end diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb new file mode 100644 index 0000000..2e67b2d --- /dev/null +++ b/lib/beyond_api/services/authentication/signer.rb @@ -0,0 +1,17 @@ +module BeyondApi + module Authentication + class Signer < BaseService + def all(params = {}) + get("signers", params) + end + + def create + post("signers") + end + + def destroy(id) + delete("signers/#{id}") + end + end + end +end diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb new file mode 100644 index 0000000..349f80f --- /dev/null +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -0,0 +1,27 @@ +module BeyondApi + module Webhook + class Subscription < BaseService + def all(params = {}) + get("webhook-subscriptions", params) + end + + def create(body) + post("webhook-subscriptions", body) + end + + def delete_all + all.dig(:embedded, :subscriptions).each do |subscription| + destroy(subscription[:id]) + end + end + + def destroy(id) + delete("webhook-subscriptions/#{id}") + end + + def find(id) + get("webhook-subscriptions/#{id}") + end + end + end +end From d5ea45b92959ff7909619a659623d99f6e7379f9 Mon Sep 17 00:00:00 2001 From: citin Date: Thu, 8 Aug 2024 14:44:13 +0200 Subject: [PATCH 23/59] merge-pagination --- .rubocop.yml | 1 - lib/beyond_api/all_pages_handler.rb | 52 ++++++++++++ lib/beyond_api/concerns/connection.rb | 81 +++++++++++++++++++ lib/beyond_api/concerns/pagination.rb | 15 ++++ lib/beyond_api/connection.rb | 78 ------------------ .../services/authentication/token.rb | 2 +- lib/beyond_api/services/base_service.rb | 37 +-------- .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 4 +- .../services/product_management/variation.rb | 2 +- .../product_management/variation_image.rb | 2 +- .../services/product_view/category.rb | 3 +- 12 files changed, 156 insertions(+), 123 deletions(-) create mode 100644 lib/beyond_api/all_pages_handler.rb create mode 100644 lib/beyond_api/concerns/connection.rb create mode 100644 lib/beyond_api/concerns/pagination.rb delete mode 100644 lib/beyond_api/connection.rb diff --git a/.rubocop.yml b/.rubocop.yml index f60d3dc..1af1fa2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,4 @@ require: - - rubocop-ordered_methods - rubocop-rspec AllCops: diff --git a/lib/beyond_api/all_pages_handler.rb b/lib/beyond_api/all_pages_handler.rb new file mode 100644 index 0000000..99ba7ed --- /dev/null +++ b/lib/beyond_api/all_pages_handler.rb @@ -0,0 +1,52 @@ +module BeyondApi + class AllPagesHandler + include Concerns::Connection + + def initialize(session, url, params = {}) + @session = session + @url = url + @params = params + + first_page_data = fetch_page(0) + @response = first_page_data + @resource_key = first_page_data[:embedded].keys.first + @total_pages = first_page_data.dig(:page, :total_pages) + @total_elements = first_page_data.dig(:page, :total_elements) + end + + def call + (1..remaining_pages).each do |page| + process_page(page) + end + + update_response_page_info + + @response + end + + private + + def remaining_pages + @total_pages - 1 + end + + def fetch_page(page) + # Fixed page size + get(@url, @params.merge(page:, size: BeyondApi.configuration.all_pagination_size)) + end + + def process_page(page) + page_data = fetch_page(page) + + @response[:embedded][@resource_key].concat( + page_data[:embedded][@resource_key] + ) + end + + def update_response_page_info + @response[:page][:size] = @total_elements + @response[:page][:total_pages] = 1 + @response[:page][:number] = 0 + end + end +end diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb new file mode 100644 index 0000000..0217a80 --- /dev/null +++ b/lib/beyond_api/concerns/connection.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module BeyondApi + module Concerns + module Connection + LOGGER = BeyondApi.logger + LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") + + def get(path, params = {}) + parsed_response agent.get(path, params) + end + + def post(path, body = {}, params = {}) + response = agent.post(path, body) do |request| + request.params = params + request.body = parsed_body(body) + end + parsed_response(response) + end + + def delete(path, params = {}) + parsed_response agent.delete(path, params) + end + + private + + def parsed_response(response) + Response.new(response).handle + end + + def parsed_body(body) + Utils.camelize_keys(body) + end + + def agent + @agent ||= Faraday.new(url: @session.api_url, ssl: { verify: true }) do |faraday| + # Timeouts + faraday.options.timeout = BeyondApi.configuration.timeout.to_i + faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i + # Authorization + case @authorization + when :basic + faraday.request :authorization, :basic, BeyondApi.configuration.client_id, + BeyondApi.configuration.client_secret + when :bearer + faraday.request :authorization, "Bearer", @session.access_token + end + # Headers + faraday.headers["Accept"] = "application/json" # Set default accept header + faraday.headers["Content-Type"] = "application/json" # Set default content type + # Request options + faraday.request :json # Encode request bodies as JSON + faraday.request :retry, BeyondApi.configuration.retry_options + # Response options + faraday.response :json, content_type: "application/json" + faraday.response :logger, *logger_config { |logger| apply_filters(logger) } + end + end + + def apply_filters(logger) + logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') + logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') + end + + # def multipart + # create_connection do |faraday| + # faraday.adapter Faraday.default_adapter + # faraday.request :multipart, flat_encode: true + # end + # end + + def logger_config + [ + LOGGER, + { bodies: BeyondApi.configuration.log_bodies, + headers: BeyondApi.configuration.log_headers } + ] + end + end + end +end diff --git a/lib/beyond_api/concerns/pagination.rb b/lib/beyond_api/concerns/pagination.rb new file mode 100644 index 0000000..21403cd --- /dev/null +++ b/lib/beyond_api/concerns/pagination.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module BeyondApi + module Concerns + module Pagination + def fetch_all_pages(url, params = {}) + if params[:paginated] == false + AllPagesHandler.new(@session, url, params).call + else + get(url, params) + end + end + end + end +end diff --git a/lib/beyond_api/connection.rb b/lib/beyond_api/connection.rb deleted file mode 100644 index 2d8c73c..0000000 --- a/lib/beyond_api/connection.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -module BeyondApi - module Connection - LOGGER = BeyondApi.logger - LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") - - def get(path, params = {}) - parsed_response agent.get(path, params) - end - - def post(path, body = {}, params = {}) - response = agent.post(path, body) do |request| - request.params = params - request.body = parsed_body(body) - end - parsed_response(response) - end - - def delete(path, params = {}) - parsed_response agent.delete(path, params) - end - - private - - def parsed_response(response) - Response.new(response).handle - end - - def parsed_body(body) - Utils.camelize_keys(body) - end - - def agent - @agent ||= Faraday.new(url: @session.api_url, ssl: { verify: true }) do |faraday| - # Timeouts - faraday.options.timeout = BeyondApi.configuration.timeout.to_i - faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i - # Authorization - case @authorization - when :basic - faraday.request :authorization, :basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret - when :bearer - faraday.request :authorization, "Bearer", @session.access_token - end - # Headers - faraday.headers["Accept"] = "application/json" # Set default accept header - faraday.headers["Content-Type"] = "application/json" # Set default content type - # Request options - faraday.request :json # Encode request bodies as JSON - faraday.request :retry, BeyondApi.configuration.retry_options - # Response options - faraday.response :json, content_type: "application/json" - faraday.response :logger, *logger_config { |logger| apply_filters(logger) } - end - end - - def apply_filters(logger) - logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') - logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') - end - - # def multipart - # create_connection do |faraday| - # faraday.adapter Faraday.default_adapter - # faraday.request :multipart, flat_encode: true - # end - # end - - def logger_config - [ - LOGGER, - { bodies: BeyondApi.configuration.log_bodies, - headers: BeyondApi.configuration.log_headers } - ] - end - end -end diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb index f5487ff..9f52e32 100644 --- a/lib/beyond_api/services/authentication/token.rb +++ b/lib/beyond_api/services/authentication/token.rb @@ -1,7 +1,7 @@ module BeyondApi module Authentication class Token - include Connection # @session, @authorization + include Concerns::Connection # @session, @authorization def initialize(session = nil) @session = session diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index af16fc5..f6ad19d 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -1,6 +1,7 @@ module BeyondApi class BaseService - include Connection # @session, @authorization + include Concerns::Connection # @session, @authorization + include Concerns::Pagination ServiceSession = Struct.new(:api_url, :access_token, :refresh_token) @@ -9,16 +10,6 @@ def initialize(**params) @authorization = :bearer end - def fetch_all_pages(url, resource, params = {}) - if params[:paginated] == false - result = fetch_pages(url, resource, params) - adjust_response(result) - result - else - fetch_page(url, 0, params) - end - end - private def initialize_session(session) @@ -28,29 +19,5 @@ def initialize_session(session) session[:refresh_token] ) end - - def adjust_response(result) - result[:page][:size] = result[:page][:total_elements] - result[:page][:total_pages] = 1 - result[:page][:number] = 0 - end - - # FIXME: find another way - def fetch_page(url, page, params = {}) - params.merge!(page:, size: BeyondApi.configuration.all_pagination_size) - BeyondApi::Request.new(@session).get(url, params) - end - - def fetch_pages(url, resource, params) - result = fetch_page(url, 0, params) - - (1..result[:page][:total_pages] - 1).each do |page| - result[:embedded][resource].concat( - fetch_page(url, page, params)[:embedded][resource] - ) - end - - result - end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 50cb0da..72b0cb4 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -1,7 +1,7 @@ module BeyondApi module ProductManagement class Image < BaseService - def all(id) + def all(id, params = {}) get("products/#{id}/images") end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 56f9c8d..1ad5c35 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,9 +2,7 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - # Request.new(@session).get("products", params) - # fetch_all_pages("/products", :products, params) - get("products", params) + fetch_all_pages("/products", params) end def find(id) diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 12d00a1..41ba8b2 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -1,7 +1,7 @@ module BeyondApi module ProductManagement class Variation < BaseService - def all(id) + def all(id, params = {}) get("products/#{id}/variations") end end diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb index 22194a9..4a3367b 100644 --- a/lib/beyond_api/services/product_management/variation_image.rb +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -1,7 +1,7 @@ module BeyondApi module ProductManagement class VariationImage < BaseService - def all(product_id, variation_id) + def all(product_id, variation_id, params = {}) get("products/#{product_id}/variations/#{variation_id}/images") end end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index 005042c..5cb1efc 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -2,8 +2,7 @@ module BeyondApi module ProductView class Category < BaseService def all(params = {}) - # fetch_all_pages("product-view/categories", :categories, params) - get("product-view/categories", params) + fetch_all_pages("product-view/categories", params) end def find(id) From e4de87e14b7c945579dcf8e63cae57cf44454024 Mon Sep 17 00:00:00 2001 From: citin Date: Thu, 8 Aug 2024 15:06:16 +0200 Subject: [PATCH 24/59] adds parsed parameters in request --- lib/beyond_api/concerns/connection.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 0217a80..3a6fc2f 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -7,19 +7,19 @@ module Connection LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") def get(path, params = {}) - parsed_response agent.get(path, params) + parsed_response agent.get(path, parsed_request(params)) end def post(path, body = {}, params = {}) response = agent.post(path, body) do |request| - request.params = params - request.body = parsed_body(body) + request.params = parsed_request(params) + request.body = parsed_request(body) end parsed_response(response) end def delete(path, params = {}) - parsed_response agent.delete(path, params) + parsed_response agent.delete(path, parsed_request(params)) end private @@ -28,8 +28,8 @@ def parsed_response(response) Response.new(response).handle end - def parsed_body(body) - Utils.camelize_keys(body) + def parsed_request(hash) + Utils.camelize_keys(hash) end def agent From 0e62e250fc6e8e3960b53073275796177ca242ca Mon Sep 17 00:00:00 2001 From: citin Date: Thu, 8 Aug 2024 15:45:54 +0200 Subject: [PATCH 25/59] add @camelize_keys to connection --- lib/beyond_api/concerns/connection.rb | 7 +++++-- lib/beyond_api/services/base_service.rb | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 3a6fc2f..11dfb62 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -13,9 +13,10 @@ def get(path, params = {}) def post(path, body = {}, params = {}) response = agent.post(path, body) do |request| request.params = parsed_request(params) - request.body = parsed_request(body) + request.body = parsed_request(body) end - parsed_response(response) + + parsed_response response end def delete(path, params = {}) @@ -29,6 +30,8 @@ def parsed_response(response) end def parsed_request(hash) + return hash unless @camelize_keys + Utils.camelize_keys(hash) end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index f6ad19d..1bb0089 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -8,6 +8,7 @@ class BaseService def initialize(**params) @session = initialize_session(params) @authorization = :bearer + @camelize_keys = true end private From 544df57602700ed6b8128a676cfb3f71d1e7f09a Mon Sep 17 00:00:00 2001 From: citin Date: Thu, 8 Aug 2024 15:54:50 +0200 Subject: [PATCH 26/59] removes old /resources files --- lib/beyond_api/resources/base.rb | 16 - lib/beyond_api/resources/carts.rb | 585 -------- lib/beyond_api/resources/categories.rb | 167 --- lib/beyond_api/resources/categories_view.rb | 218 --- lib/beyond_api/resources/checkout_settings.rb | 63 - lib/beyond_api/resources/customers.rb | 332 ----- lib/beyond_api/resources/newsletter_target.rb | 103 -- lib/beyond_api/resources/order_settings.rb | 97 -- lib/beyond_api/resources/orders.rb | 1174 ----------------- .../resources/payment_method_definitions.rb | 182 --- lib/beyond_api/resources/payment_methods.rb | 194 --- lib/beyond_api/resources/pickup_options.rb | 216 --- .../product_attribute_definitions.rb | 118 -- lib/beyond_api/resources/products.rb | 302 ----- .../resources/products/attachments.rb | 116 -- .../resources/products/availability.rb | 188 --- .../resources/products/cross_sells.rb | 158 --- .../resources/products/custom_attributes.rb | 140 -- lib/beyond_api/resources/products/images.rb | 229 ---- lib/beyond_api/resources/products/searches.rb | 113 -- .../products/variation_properties.rb | 86 -- lib/beyond_api/resources/products/videos.rb | 147 --- lib/beyond_api/resources/products_view.rb | 128 -- lib/beyond_api/resources/script_tags.rb | 140 -- lib/beyond_api/resources/shipping_zones.rb | 420 ------ lib/beyond_api/resources/shop.rb | 96 -- lib/beyond_api/resources/shops/address.rb | 53 - lib/beyond_api/resources/shops/attributes.rb | 136 -- lib/beyond_api/resources/shops/images.rb | 158 --- lib/beyond_api/resources/shops/legals.rb | 131 -- lib/beyond_api/resources/shops/locations.rb | 251 ---- lib/beyond_api/resources/signers.rb | 72 - lib/beyond_api/resources/users.rb | 436 ------ lib/beyond_api/resources/variations.rb | 162 --- .../resources/variations/availability.rb | 117 -- lib/beyond_api/resources/variations/images.rb | 234 ---- .../resources/webhook_subscriptions.rb | 197 --- 37 files changed, 7675 deletions(-) delete mode 100644 lib/beyond_api/resources/base.rb delete mode 100644 lib/beyond_api/resources/carts.rb delete mode 100644 lib/beyond_api/resources/categories.rb delete mode 100644 lib/beyond_api/resources/categories_view.rb delete mode 100644 lib/beyond_api/resources/checkout_settings.rb delete mode 100644 lib/beyond_api/resources/customers.rb delete mode 100644 lib/beyond_api/resources/newsletter_target.rb delete mode 100644 lib/beyond_api/resources/order_settings.rb delete mode 100644 lib/beyond_api/resources/orders.rb delete mode 100644 lib/beyond_api/resources/payment_method_definitions.rb delete mode 100644 lib/beyond_api/resources/payment_methods.rb delete mode 100644 lib/beyond_api/resources/pickup_options.rb delete mode 100644 lib/beyond_api/resources/product_attribute_definitions.rb delete mode 100644 lib/beyond_api/resources/products.rb delete mode 100644 lib/beyond_api/resources/products/attachments.rb delete mode 100644 lib/beyond_api/resources/products/availability.rb delete mode 100644 lib/beyond_api/resources/products/cross_sells.rb delete mode 100644 lib/beyond_api/resources/products/custom_attributes.rb delete mode 100644 lib/beyond_api/resources/products/images.rb delete mode 100644 lib/beyond_api/resources/products/searches.rb delete mode 100644 lib/beyond_api/resources/products/variation_properties.rb delete mode 100644 lib/beyond_api/resources/products/videos.rb delete mode 100644 lib/beyond_api/resources/products_view.rb delete mode 100644 lib/beyond_api/resources/script_tags.rb delete mode 100644 lib/beyond_api/resources/shipping_zones.rb delete mode 100644 lib/beyond_api/resources/shop.rb delete mode 100644 lib/beyond_api/resources/shops/address.rb delete mode 100644 lib/beyond_api/resources/shops/attributes.rb delete mode 100644 lib/beyond_api/resources/shops/images.rb delete mode 100644 lib/beyond_api/resources/shops/legals.rb delete mode 100644 lib/beyond_api/resources/shops/locations.rb delete mode 100644 lib/beyond_api/resources/signers.rb delete mode 100644 lib/beyond_api/resources/users.rb delete mode 100644 lib/beyond_api/resources/variations.rb delete mode 100644 lib/beyond_api/resources/variations/availability.rb delete mode 100644 lib/beyond_api/resources/variations/images.rb delete mode 100644 lib/beyond_api/resources/webhook_subscriptions.rb diff --git a/lib/beyond_api/resources/base.rb b/lib/beyond_api/resources/base.rb deleted file mode 100644 index 116b698..0000000 --- a/lib/beyond_api/resources/base.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module BeyondApi - class Base - class InvalidSessionError < StandardError; end - - attr_reader :session - - def initialize(session) - @session = session - - raise InvalidSessionError, "Invalid session" unless session.is_a? BeyondApi::Session - raise InvalidSessionError, "Session api_url cannot be nil" if session.api_url.nil? - end - end -end diff --git a/lib/beyond_api/resources/carts.rb b/lib/beyond_api/resources/carts.rb deleted file mode 100644 index 16f2ad4..0000000 --- a/lib/beyond_api/resources/carts.rb +++ /dev/null @@ -1,585 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class Carts < Base - include BeyondApi::Utils - - # - # A +POST+ request is used to add a line item to the cart. Currently only product line items are supported. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/6d529573-b39e-4cd4-99fe-856432ea97f3/line-items' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -d '{"_type":"PRODUCT","_ref":"c3a52c19-2b43-4ceb-a7ca-00c558aec072","quantity":1}' - # - # @param cart_id [String] the cart UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "_type" => "PRODUCT", - # "_ref" => "c3a52c19-2b43-4ceb-a7ca-00c558aec072", - # "quantity" => 1 - # } - # @cart = session.carts.add_line_item("6d529573-b39e-4cd4-99fe-856432ea97f3", body) - # - def add_line_item(cart_id, body) - response, status = BeyondApi::Request.post(@session, - "/carts/#{cart_id}/line-items", - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts' -i -X POST \ - # -H 'Accept: application/hal+json' - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.create - # - def create - response, status = BeyondApi::Request.post(@session, - "/carts") - - handle_response(response, status) - end - - # - # A +POST+ request is used to initiate the creation of a payment. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/158bdcee-178a-4b5f-88ff-1953f5ea8e09/create-payment' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -d '{ - # "returnUri" : "http://some.com/return", - # "cancelUri" : "http://some.com/cancel" - # }' - # - # @param cart_id [String] the cart UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "returnUri" => "http://some.com/return", - # "cancelUri" => "http://some.com/cancel" - # } - # @payment = session.carts.create_payment("158bdcee-178a-4b5f-88ff-1953f5ea8e09/", body) - # - def create_payment(cart_id, body) - response, status = BeyondApi::Request.post(@session, - "/carts/#{cart_id}/create-payment", - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create an order from a cart and initiate the payment. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/f6c6615b-a9f6-420e-be1d-46339ddc5fda/create-payment-and-order' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -d '{ - # "returnUri" : "http://some.com/return", - # "cancelUri" : "http://some.com/cancel", - # "customerComment" : "Send it fast please!", - # "salesChannel" : "Storefront", - # "marketingChannel" : "Google", - # "marketingSubchannel" : "Search page 2", - # "testOrder" : false, - # "termsAndConditionsExplicitlyAccepted" : false - # }' - # - # @param cart_id [String] the cart UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "returnUri" => "http://some.com/return", - # "cancelUri" => "http://some.com/cancel", - # "customerComment" => "Send it fast please!", - # "salesChannel" => "Storefront", - # "marketingChannel" => "Google", - # "marketingSubchannel" => "Search page 2", - # "testOrder" => false, - # "termsAndConditionsExplicitlyAccepted" => false - # } - # @payment = session.carts.create_payment_and_order("f6c6615b-a9f6-420e-be1d-46339ddc5fda", body) - # - def create_payment_and_order(cart_id, body) - response, status = BeyondApi::Request.post(@session, - "/carts/#{cart_id}/create-payment-and-order", - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create an order from the cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/986247da-b78f-422c-a273-917804896974/order' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -d '{"customerComment": "send it fast please", - # "salesChannel": "DifferentChannel", - # "marketingChannel": "Google", - # "marketingSubchannel": "Search page 2", - # "testOrder": false, - # "termsAndConditionsExplicitlyAccepted": true - # }' - # - # @param cart_id [String] the cart UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "customerComment" => "send it fast please", - # "salesChannel" => "DifferentChannel", - # "marketingChannel" => "Google", - # "marketingSubchannel" => "Search page 2", - # "testOrder" => false, - # "termsAndConditionsExplicitlyAccepted" => true - # } - # @order = session.carts.create_order("986247da-b78f-422c-a273-917804896974", body) - # - def create_order(cart_id, body) - response, status = BeyondApi::Request.post(@session, - "/carts/#{cart_id}/order", - body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/1a58f22f-481a-4993-9947-62c1c2857f87' -i -X DELETE - # - # @param cart_id [String] the cart UUID - # - # @return true - # - # @example - # session.carts.delete("1a58f22f-481a-4993-9947-62c1c2857f87") - # - def delete(cart_id) - response, status = BeyondApi::Request.delete(@session, - "/carts/#{cart_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +DELETE+ request is used to delete a line item from the cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/3fb55475-f6d2-471a-90ac-ccee7896b9f7/line-items/51c86195-d2b9-4073-9a14-7ddd5a76b6a7' -i -X DELETE - # - # @param cart_id [String] the cart UUID - # @param line_item_id [String] the line item UUID - # - # @return true - # - # @example - # @cart = session.carts.delete_line_item("3fb55475-f6d2-471a-90ac-ccee7896b9f7", "51c86195-d2b9-4073-9a14-7ddd5a76b6a7") - # - def delete_line_item(cart_id, line_item_id) - response, status = BeyondApi::Request.delete(@session, - "/carts/#{cart_id}/line-items/#{line_item_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +DELETE+ request is used to remove the shipping address of the cart. After deletion, the shipping address will default to the billing address. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/2fa7dc36-8305-4628-b961-f2c3f7dda47d/shipping-address' -i -X DELETE \ - # -H 'Accept: application/hal+json' - # - # @param cart_id [String] the cart UUID - # - # @return true - # - # @example - # session.carts.delete_shipping_address("2fa7dc36-8305-4628-b961-f2c3f7dda47d") - # - def delete_shipping_address(cart_id) - response, status = BeyondApi::Request.delete(@session, - "/carts/#{cart_id}/shipping-address") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/26857145-aeab-4210-9191-3906573a14ae' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.find("26857145-aeab-4210-9191-3906573a14ae") - # - def find(cart_id) - response, status = BeyondApi::Request.get(@session, - "/carts/#{cart_id}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the current payment method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/6d9de289-d6a7-44d6-afb3-c31bb0a792ff/payment-methods/current' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @payment_method = session.carts.payment_method("26857145-aeab-4210-9191-3906573a14ae") - # - def payment_method(cart_id) - response, status = BeyondApi::Request.get(@session, - "/carts/#{cart_id}/payment-methods/current") - - handle_response(response, status) - end - - # - # A +GET+ request is used to get the applicable payment methods of a cart. - # The selectable field indicates if a payment method is currently selectable. Non-selectable payment methods are currently restricted because of rules that apply to a cart. - # Trying to set such a payment method as the current one of the cart will fail. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/45f9009d-4d2f-43b1-9cd2-ea29ff0d46d6/payment-methods' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @payment_methods = session.carts.payment_methods("45f9009d-4d2f-43b1-9cd2-ea29ff0d46d6") - # - def payment_methods(cart_id) - response, status = BeyondApi::Request.get(@session, - "/carts/#{cart_id}/payment-methods") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to replace only one line item in the cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/f73629e5-fecf-4474-9b04-6b2fcd4663c4/line-items/2c9c0f38-0b9e-4fa7-bcbe-960098ff63aa' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -d '{"_type":"PRODUCT","_ref":"f084553c-ea77-4745-b1bd-71c64c8419fd","quantity":2}' - # - # @param cart_id [String] the cart UUID - # @param line_item_id [String] the line item UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "_type" => "PRODUCT", - # "_ref" => "f084553c-ea77-4745-b1bd-71c64c8419fd", - # "quantity" => 2 - # } - # - # @cart = session.carts.replace_line_item("f73629e5-fecf-4474-9b04-6b2fcd4663c4", "2c9c0f38-0b9e-4fa7-bcbe-960098ff63aa", body) - # - def replace_line_item(cart_id, line_item_id, body) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/line-items/#{line_item_id}", - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to replace the current line items in the cart with the given list. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/c1436110-e283-49b3-a748-0321efec6d35/line-items' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -d '[{"_type":"PRODUCT","_ref":"0612362d-9856-4b40-94c6-a36abec0cf8c","quantity":1}]' - # - # @param cart_id [String] the cart UUID - # @param body [String] the array of line items - # - # @return [OpenStruct] - # - # @example - # body = [ { - # "_type" => "PRODUCT", - # "_ref" => "0612362d-9856-4b40-94c6-a36abec0cf8c", - # "quantity" => 1 - # } ] - # - # @cart = session.carts.replace_line_items("c1436110-e283-49b3-a748-0321efec6d35", body) - # - def replace_line_items(cart_id, body) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/line-items", - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to set the billing address of the cart. The billing address is mandatory for a cart being ready to order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/01da6aa7-8aa2-4383-a496-6611a14afbc9/billing-address' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -d '{"salutation":"Mrs","gender":"FEMALE","title":"","firstName":"Astrid","middleName":"Agnes","lastName":"Alster","street":"Alsterwasserweg", - # "houseNumber":"2","street2":"Erdgeschoss","doorCode":"0185","addressExtension":"Hinterhof","postalCode":"20999","dependentLocality":"Seevetal", - # "city":"Alsterwasser","country":"DE","state":"Hamburg","email":"a.alsterh@example.com","phone":"(800) 555-0102","mobile":"(800) 555-0103", - # "vatId":"123456789","taxNumber":"123-34-6789","birthDate":"1985-03-20"}' - # - # @param cart_id [String] the cart UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "salutation" => "Mrs", - # "gender" => "FEMALE", - # "title" => "", - # "firstName" => "Astrid", - # "middleName" => "Agnes", - # "lastName" => "Alster", - # "street" => "Alsterwasserweg", - # "houseNumber" => "2", - # "street2" => "Erdgeschoss", - # "doorCode" => "0185", - # "addressExtension" => "Hinterhof", - # "postalCode" => "20999", - # "dependentLocality" => "Seevetal", - # "city" => "Alsterwasser", - # "country" => "DE", - # "state" => "Hamburg", - # "email" => "a.alsterh@example.com", - # "phone" => "(800) 555-0102", - # "mobile" => "(800) 555-0103", - # "vatId" => "123456789", - # "taxNumber" => "123-34-6789", - # "birthDate" => "1985-03-20" - # } - # - # @cart = session.carts.set_billing_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body) - # - def set_billing_address(cart_id, body) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/billing-address", - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to set the current payment method of the cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/750c8a68-ef58-4955-b05f-29e35fa19687/payment-methods/current' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Accept: application/json' \ - # -d 'https://api-shop.beyondshop.cloud/api/payment-methods/6498f339-7fe6-43d4-8e2a-6da68d7cdfe3' - # - # @param cart_id [String] the cart UUID - # @param payment_method_id [String] the payment method UUID - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.set_payment_method("750c8a68-ef58-4955-b05f-29e35fa19687", "6498f339-7fe6-43d4-8e2a-6da68d7cdfe3") - # - def set_payment_method(cart_id, payment_method_id) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/payment-methods/current", - "#{@session.api_url}/payment-methods/#{payment_method_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to set the payment method to the current default payment method. The default payment method is the one with the highest priority of the applicable payment methods. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/d1efcb74-ab96-43c5-b404-9c1f927dc3d2/payment-methods/default' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.set_payment_method_to_default("d1efcb74-ab96-43c5-b404-9c1f927dc3d2") - # - def set_payment_method_to_default(cart_id) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/payment-methods/default") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to set the shipping address of the cart. If a shipping address is not set, it will default to the billing address. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/01da6aa7-8aa2-4383-a496-6611a14afbc9/shipping-address' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -d '{"salutation":"Mrs","gender":"FEMALE","title":"","firstName":"Astrid","middleName":"Agnes","lastName":"Alster","street":"Alsterwasserweg", - # "houseNumber":"2","street2":"Erdgeschoss","doorCode":"0185","addressExtension":"Hinterhof","postalCode":"20999","dependentLocality":"Seevetal", - # "city":"Alsterwasser","country":"DE","state":"Hamburg","email":"a.alsterh@example.com","phone":"(800) 555-0102","mobile":"(800) 555-0103", - # "vatId":"123456789","taxNumber":"123-34-6789","birthDate":"1985-03-20"}' - # - # @param cart_id [String] the cart UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "salutation" => "Mrs", - # "gender" => "FEMALE", - # "title" => "", - # "firstName" => "Astrid", - # "middleName" => "Agnes", - # "lastName" => "Alster", - # "street" => "Alsterwasserweg", - # "houseNumber" => "2", - # "street2" => "Erdgeschoss", - # "doorCode" => "0185", - # "addressExtension" => "Hinterhof", - # "postalCode" => "20999", - # "dependentLocality" => "Seevetal", - # "city" => "Alsterwasser", - # "country" => "DE", - # "state" => "Hamburg", - # "email" => "a.alsterh@example.com", - # "phone" => "(800) 555-0102", - # "mobile" => "(800) 555-0103", - # "vatId" => "123456789", - # "taxNumber" => "123-34-6789", - # "birthDate" => "1985-03-20" - # } - # - # @cart = session.carts.set_shipping_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body) - # - def set_shipping_address(cart_id, body) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/shipping-address", - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to set the current shipping method of the cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/a4e7922a-f895-4a7d-8cb1-6ecf74d7ceba/shipping-methods/current' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Accept: application/json' \ - # -d 'https://api-shop.beyondshop.cloud/api/shipping-zones/59e26c99-ef1d-4ee8-a79f-d078cd6dfe24/shipping-methods/f3d3ce8d-eeab-44b6-81bb-67a4f1d7a57f' - # - # @param cart_id [String] the cart UUID - # @param shipping_zone_id [String] the shipping zone UUID - # @param shipping_method_id [String] the shipping method UUID - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.set_shipping_method("a4e7922a-f895-4a7d-8cb1-6ecf74d7ceba", "59e26c99-ef1d-4ee8-a79f-d078cd6dfe24", "f3d3ce8d-eeab-44b6-81bb-67a4f1d7a57f") - # - def set_shipping_method(cart_id, shipping_zone_id, shipping_method_id) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/shipping-methods/current", - "#{session.api_url}/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to set the shipping method to the current default shipping method. - # The default shipping method is the one with the highest priority of the applicable shipping methods. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/c31c5d06-4460-4f89-9e09-47f9956dea98/shipping-methods/default' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.set_shipping_method_to_default("c31c5d06-4460-4f89-9e09-47f9956dea98") - # - def set_shipping_method_to_default(cart_id) - response, status = BeyondApi::Request.put(@session, - "/carts/#{cart_id}/shipping-methods/default") - - handle_response(response, status) - end - - # - # A +GET+ request is used to get the current shipping method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/9093a339-66fd-4cc1-9dcf-d23003c38b41/shipping-methods/current' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @shipping_method = session.carts.shipping_method("9093a339-66fd-4cc1-9dcf-d23003c38b41") - # - def shipping_method(cart_id) - response, status = BeyondApi::Request.get(@session, - "/carts/#{cart_id}") - - handle_response(response, status) - end - - # A +GET+ request is used to get the applicable shipping method of a cart. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/carts/05a547a0-80dc-4a8c-b9b6-aa028b6ef7d8/shipping-methods' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @cart = session.carts.shipping_methods("05a547a0-80dc-4a8c-b9b6-aa028b6ef7d8") - # - def shipping_methods(cart_id) - response, status = BeyondApi::Request.get(@session, - "/carts/#{cart_id}") - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/categories.rb b/lib/beyond_api/resources/categories.rb deleted file mode 100644 index 5ed7e4d..0000000 --- a/lib/beyond_api/resources/categories.rb +++ /dev/null @@ -1,167 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class Categories < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all available categories in a paged manner. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/categories' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +catg:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @categories = session.categories.all(size: 100, page: 0) - # - def all(params = {}) - handle_all_request("/categories", :categories, params) - end - - # - # A +POST+ request is used to create a category. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/categories' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{"name":"Power Bars","label":"power-bar","type":"SMART","query":{"bool":{"filter":{"term":{"tags":"power-bar"}}}}}' - # - # @beyond_api.scopes +catg:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "Power Bars", - # "label" => "power-bar", - # "type" => "SMART", - # "query" => { "bool" => { "filter" => { "term" : { "tags" => "power-bar" } } } } - # } - # @category = session.categories.create(body) - # - def create(body) - response, status = BeyondApi::Request.post(@session, "/categories", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a category. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/categories/f461fb56-1984-4ade-bd4e-007c273cc923' -i -X DELETE \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +catg:d+ - # - # @param category_id [String] the category UUID - # - # @return true - # - # @example - # session.categories.delete("f461fb56-1984-4ade-bd4e-007c273cc923") - # - def delete(category_id) - response, status = BeyondApi::Request.delete(@session, "/categories/#{category_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a category. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/categories/27a94b71-9b17-4f06-9596-fbbf4d18021f' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +catg:r+ - # - # @param category_id [String] the category UUID - # - # @return [OpenStruct] - # - # @example - # @category = session.categories.find("27a94b71-9b17-4f06-9596-fbbf4d18021f") - # - def find(category_id) - response, status = BeyondApi::Request.get(@session, "/categories/#{category_id}") - - handle_response(response, status) - end - - # - # A +PATCH+ request is used to update a category partially with json patch content type. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/categories/49250b7a-79a8-48d0-a71c-fc417965928d' -i -X PATCH \ - # -H 'Content-Type: application/json-patch+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{"name":"patched name","type":"MANUAL","query":{"bool":{"filter":[{"terms":{"id":["6c449297-65fc-41aa-a49c-68a3561b33e5","6c449297-65fc-41aa-a49c-68a3561b33e6"]}}]}}}' - # - # @beyond_api.scopes +catg:u+ - # - # @param category_id [String] the category UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "patched name", - # "type" => "MANUAL", - # "query" => {"bool" => { "filter" => [ { "terms" => { "id" => [ "6c449297-65fc-41aa-a49c-68a3561b33e5", "6c449297-65fc-41aa-a49c-68a3561b33e6" ] } } ] } } - # } - # @category = session.categories.update("49250b7a-79a8-48d0-a71c-fc417965928d", body) - # - def patch(category_id, body) - response, status = BeyondApi::Request.patch(@session, "/categories/#{category_id}", body) - - handle_response(response, status) - end - - # - # A +PUT+ request is issued to update all category properties with application/json content type. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/categories/cb2058dc-871a-4e64-83ac-39a0be9e6f82' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{"name":"updated name","label":"updated-name","type":"MANUAL","query":{"bool":{"filter":[{"terms":{"id":["6c449297-65fc-41aa-a49c-68a3561b33e5","6c449297-65fc-41aa-a49c-68a3561b33e6"]}}]}}}' - # - # @beyond_api.scopes +catg:u+ - # - # @param category_id [String] the category UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "updated name", - # "label" => "updated-name", - # "type" => "MANUAL", - # "query" => { "bool" => { "filter" => [ { "terms" => { "id" => [ "6c449297-65fc-41aa-a49c-68a3561b33e5", "6c449297-65fc-41aa-a49c-68a3561b33e6" ] } } ] } } - # } - # @category = session.categories.update(category_id, body) - # - def update(category_id, body) - response, status = BeyondApi::Request.put(@session, "/categories/#{category_id}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/categories_view.rb b/lib/beyond_api/resources/categories_view.rb deleted file mode 100644 index d466d77..0000000 --- a/lib/beyond_api/resources/categories_view.rb +++ /dev/null @@ -1,218 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class CategoriesView < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all product categories. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @categories = session.categories_view.all(size: 100, page: 0) - # - def all(params = {}) - handle_all_request("/product-view/categories", :categories, params) - end - - # - # A +GET+ request is used to retrieve the details of a product category. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/23bb1430-6e82-40e4-9a92-4cb404da74a8' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param category_id [String] the category UUID - # - # @return [OpenStruct] - # - # @example - # @category = session.categories_view.find("23bb1430-6e82-40e4-9a92-4cb404da74a8") - # - def find(category_id) - response, status = BeyondApi::Request.get(@session, - "/product-view/categories/#{category_id}") - - handle_response(response, status) - end - - # - # A +POST+ request is read-only and cannot create data. It is used to find products that match the filter criteria. - # Thus, it can be used to preview all products that are included in a category that shares the respective filter criteria. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/preview?page=0&size=10&sortBy=NEWEST_FIRST' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Content-Type: application/json' \ - # -d '{ - # "filters" : [ { - # "key" : "manufacturer", - # "values" : [ "Grape Vineyard" ] - # }, { - # "key" : "all_tags", - # "values" : [ "Power Bar", "Bestseller", "High Protein" ] - # }, { - # "key" : "price_range", - # "min" : 3.7, - # "max" : 13.7 - # } ] - # }' - # - # @param body [Hash] the request body - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # @option params [String] :sort_by the sorting applied to the list of products - # - # @return [OpenStruct] - # - # @example - # body = { - # filters => [ - # { - # key => "manufacturer", - # values => [ "Grape Vineyard" ] - # }, - # { - # key => "all_tags", - # values => [ "Power Bar", "Bestseller", "High Protein" ] - # }, - # { - # key => "price_range", - # min => 3.7, - # max => 13.7 - # } - # ] - # } - # - # @products = session.categories_view.preview(body, { size: 100, page: 0, sort_by: "NEWEST_FIRST" }) - # - def preview(body, params = {}) - response, status = BeyondApi::Request.post(@session, - "/product-view/categories/preview", - body, - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all products of a category. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/681beef2-cd3e-4ce3-8034-4d07c1184447/products' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param category_id [String] the category UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @products = session.categories_view.products("681beef2-cd3e-4ce3-8034-4d07c1184447", { size: 100, page: 0 }) - # - def products(category_id, params = {}) - path = "/product-view/categories/#{category_id}/products" - - handle_all_request(path, :products, params) - end - - # - # A +GET+ request is used to find a product category by its unique label. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/search/find-by-label?label=power-bar' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param label [String] the label of the category - # - # @return [OpenStruct] - # - # @example - # @category = session.categories_view.search_by_label("power-bar") - # - def search_by_label(label) - response, status = BeyondApi::Request.get(@session, - "/product-view/categories/search/find-by-label", - { label: label }) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all product categories a product is part of using the request parameter productId. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/search/find-by-product?productId=ba68427f-603c-4741-9185-3b379f7769b5' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param product_id [String] the product UUID of the category - # - # @return [OpenStruct] - # - # @example - # @category = session.categories_view.search_by_product_id("ba68427f-603c-4741-9185-3b379f7769b5") - # - def search_by_product_id(product_id, params = {}) - response, status = BeyondApi::Request.get(@session, - "/product-view/categories/search/find-by-product", - params.merge(product_id: product_id)) - - handle_response(response, status) - end - - # - # A +POST+ request is used to search for categories a new product will be part of using the request body. An existing product can also be part of the call. This endpoint can handle all properties a product can have. - # This request is read-only and cannot create data. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/search/find-by-product' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # -d '{ - # "tags" : [ "books" ], - # "manufacturer" : "The Standard Manufacturer", - # "salesPrice" : { - # "amount" : 10.0, - # "currency" : "EUR" - # } - # }' - # - # @param body [Hash] the request body - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # body = { - # "tags" => [ "books" ], - # "manufacturer" => "The Standard Manufacturer", - # "sales_price" => { - # "amount" => 10.0, - # "currency" => "EUR" - # } - # } - # - # @categories = session.categories_view.search_by_product(body, { size: 100, page: 0 }) - # - def search_by_product(body, params = {}) - response, status = BeyondApi::Request.post(@session, - "/product-view/categories/search/find-by-product", - body, - params) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/checkout_settings.rb b/lib/beyond_api/resources/checkout_settings.rb deleted file mode 100644 index 1cec015..0000000 --- a/lib/beyond_api/resources/checkout_settings.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class CheckoutSettings < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to retrieve the checkout settings. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/checkout-settings' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +cset:r+ - # - # @return [OpenStruct] - # - # @example - # @checkout_settiongs = session.checkout_settings.all - # - def all - response, status = BeyondApi::Request.get(@session, "/checkout-settings") - - handle_response(response, status) - end - - # A +PUT+ request is used to update the checkout settings. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/checkout-settings' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "minimumOrderValue" : { - # "currency" : "EUR", - # "amount" : 50 - # }, - # "mustAcceptTermsAndConditions" : true - # }' - # - # @beyond_api.scopes +cset:u+ - # - # @return [OpenStruct] - # - # @example - # body = { - # "minimum_order_value" => { - # "currency" => "EUR", - # "amount" => 50 - # }, - # "must_accept_terms_and_conditions" => true - # } - # @checkout_settiongs = session.checkout_settings.update(body) - # - def update(body) - response, status = BeyondApi::Request.put(@session, "/checkout-settings", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/customers.rb b/lib/beyond_api/resources/customers.rb deleted file mode 100644 index c378b80..0000000 --- a/lib/beyond_api/resources/customers.rb +++ /dev/null @@ -1,332 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class Customers < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all customers of the shop in a paged way. Each item in the response represents a summary of the customer data. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/customers' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +cust:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @customers = session.customers.all(size: 20, page: 0) - # - def all(params = {}) - handle_all_request("/customers", :customers, params) - end - - # - # A +POST+ request is used to create a customer. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/customers' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "defaultPaymentMethodId" : "69923864-74a7-4ea9-92c7-0d17181b39f4", - # "defaultShippingMethodId" : "a5976ec2-d99a-4d16-bd2b-1fa5c48d68aa", - # "shippingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "doorCode" : "456", - # "_id" : null - # }, - # "email" : "a.alsterh@example.com", - # "initialPassword" : "MyVeryStrongPassword", - # "billingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "vatId" : "DE123456789", - # "taxNumber" : "HRE 987654/32123/864516", - # "birthDate" : "1985-05-11", - # "_id" : "b61ca0e0-411f-485e-83f3-035d717095da" - # } - # }' - # - # @beyond_api.scopes +cust:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "defaultPaymentMethodId" : "69923864-74a7-4ea9-92c7-0d17181b39f4", - # "defaultShippingMethodId" : "a5976ec2-d99a-4d16-bd2b-1fa5c48d68aa", - # "shippingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "doorCode" : "456", - # "_id" : null - # }, - # "email" : "a.alsterh@example.com", - # "initialPassword" : "MyVeryStrongPassword", - # "billingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "vatId" : "DE123456789", - # "taxNumber" : "HRE 987654/32123/864516", - # "birthDate" : "1985-05-11", - # "_id" : "b61ca0e0-411f-485e-83f3-035d717095da" - # } - # } - # - # @customer = session.customers.create(body) - # - def create(body) - response, status = BeyondApi::Request.post(@session, "/customers", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a customer. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/customers/9e2a61d9-a1ac-4771-bd02-32bf50386392' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +cust:d+ - # - # @param customer_id [String] the customer UUID - # - # @return true - # - # @example - # session.customers.delete("9e2a61d9-a1ac-4771-bd02-32bf50386392") - # - def delete(customer_id) - response, status = BeyondApi::Request.delete(@session, "/customers/#{customer_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a customer. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/customers/d6a8132e-29b3-4258-b8c0-aee34df42aa1' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +cust:r+ - # - # @param customer_id [String] the customer UUID - # - # @return [OpenStruct] - # - # @example - # @customer = session.customers.find("d6a8132e-29b3-4258-b8c0-aee34df42aa1") - # - def find(customer_id) - response, status = BeyondApi::Request.get(@session, "/customers/#{customer_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update a customer. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/customers/34c5566b-e82a-486d-9a7d-3c3aafef6901' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "defaultPaymentMethodId" : "d94790cd-ec27-4461-85a9-457fffcc0271", - # "defaultShippingMethodId" : "976e7d66-0eb2-4ca3-8b44-5e6d0aeb9e63", - # "shippingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "doorCode" : "456", - # "_id" : "112d46ff-fc72-4be8-9e48-588b4f5c7829" - # }, - # "billingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "vatId" : "DE123456789", - # "taxNumber" : "HRE 987654/32123/864516", - # "birthDate" : "1985-05-11", - # "_id" : "85de80fc-8467-46ca-b20c-55f5d4d1eaec" - # } - # }' - # - # @beyond_api.scopes +cust:u+ - # - # @param customer_id [String] the customer UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "defaultPaymentMethodId" : "d94790cd-ec27-4461-85a9-457fffcc0271", - # "defaultShippingMethodId" : "976e7d66-0eb2-4ca3-8b44-5e6d0aeb9e63", - # "shippingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "doorCode" : "456", - # "_id" : "112d46ff-fc72-4be8-9e48-588b4f5c7829" - # }, - # "billingAddress" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : "", - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserweg", - # "houseNumber" : "2", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "vatId" : "DE123456789", - # "taxNumber" : "HRE 987654/32123/864516", - # "birthDate" : "1985-05-11", - # "_id" : "85de80fc-8467-46ca-b20c-55f5d4d1eaec" - # } - # } - # @customer = session.customers.update("34c5566b-e82a-486d-9a7d-3c3aafef6901", body) - # - def update(customer_id, body) - response, status = BeyondApi::Request.put(@session, "/customers/#{customer_id}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/newsletter_target.rb b/lib/beyond_api/resources/newsletter_target.rb deleted file mode 100644 index befe51b..0000000 --- a/lib/beyond_api/resources/newsletter_target.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class NewsletterTarget < Base - include BeyondApi::Utils - - # - # A +POST+ request is used to create the newsletter target. Each shop can only have one newsletter target. - # You can update this target at any time, or delete the existing one and create a new target. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/newsletter-target' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "submitUrl": "https://example.org/cgi-bin/subscribe.php" - # }' - # - # @beyond_api.scopes +nltg:m+ - # - # @param submit_url [String] the URL stating where to submit the newsletter - # - # @return [OpenStruct] - # - # @example - # session.newsletter_target.create({ submit_url: "https://example.org/cgi-bin/subscribe.php" }) - # - def create(submit_url) - response, status = BeyondApi::Request.post(@session, - "/newsletter-target", - { submit_url: submit_url }) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete the existing newsletter target. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/newsletter-target' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +nltg:m+ - # - # @return true - # - # @example - # session.newsletter_target.delete - # - def delete - response, status = BeyondApi::Request.delete(@session, - "/newsletter-target") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the newsletter target. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/newsletter-target' -i -X GET - # - # @return [OpenStruct] - # - # @example - # @newsletter_target = session.newsletter_target.find - # - def find - response, status = BeyondApi::Request.get(@session, - "/newsletter-target") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update the existing newsletter target - # - # $ curl 'https://api-shop.beyondshop.cloud/api/newsletter-target' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "submitUrl": "https://example.org/api/newsletter/subscription" - # }' - # - # @beyond_api.scopes +nltg:m+ - # - # @param submit_url [String] the URL stating where to submit the newsletter - # - # @return [OpenStruct] - # - # @example - # session.newsletter_target.update({ submit_url: "https://example.org/cgi-bin/subscribe.php" }) - # - def update(submit_url) - response, status = BeyondApi::Request.put(@session, - "/newsletter-target", - { submit_url: submit_url }) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/order_settings.rb b/lib/beyond_api/resources/order_settings.rb deleted file mode 100644 index fecf98d..0000000 --- a/lib/beyond_api/resources/order_settings.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class OrderSettings < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to retrieve the order settings. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/order-settings' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +oset:r+ - # - # @return [OpenStruct] - # - # @example - # @order_settings = session.payment_methods.all - # - def all - response, status = BeyondApi::Request.get(@session, "/order-settings") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update the order settings. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/order-settings' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "invoiceCancelationNote" : "This is an invoice cancelation note", - # "defaultDeliveryDateNote" : "This is the default delivery date note", - # "defaultInvoiceNote" : "This is the default invoice note", - # "orderNumberConfiguration" : { - # "stringPrefix" : "2017-shop-", - # "nextNumericSuffix" : 1000, - # "numericSuffixLength" : 4 - # }, - # "invoiceNumberConfiguration" : { - # "stringPrefix" : "2017-invoice-", - # "nextNumericSuffix" : 1000, - # "numericSuffixLength" : 4 - # }, - # "customOrderOpenMailText" : " Your
1", - # "customOrderCanceledMailText" : " Your
2", - # "customInvoiceCustomerMailText" : " Your
3", - # "customInvoiceCanceledMailText" : " Your
4", - # "customOrderShippedMailText" : " Your
5", - # "customOrderPendingMailText" : " Your
6", - # "customOrderReturnedMailText" : " Your
7" - # }' - # - # @beyond_api.scopes +oset:u+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "invoiceCancelationNote" : "This is an invoice cancelation note", - # "defaultDeliveryDateNote" : "This is the default delivery date note", - # "defaultInvoiceNote" : "This is the default invoice note", - # "orderNumberConfiguration" : { - # "stringPrefix" : "2017-shop-", - # "nextNumericSuffix" : 1000, - # "numericSuffixLength" : 4 - # }, - # "invoiceNumberConfiguration" : { - # "stringPrefix" : "2017-invoice-", - # "nextNumericSuffix" : 1000, - # "numericSuffixLength" : 4 - # }, - # "customOrderOpenMailText" : " Your
1", - # "customOrderCanceledMailText" : " Your
2", - # "customInvoiceCustomerMailText" : " Your
3", - # "customInvoiceCanceledMailText" : " Your
4", - # "customOrderShippedMailText" : " Your
5", - # "customOrderPendingMailText" : " Your
6", - # "customOrderReturnedMailText" : " Your
7" - # } - # - # @order_settings = session.order_settings.update(body) - # - def update(body) - response, status = BeyondApi::Request.put(@session, "/order-settings", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/orders.rb b/lib/beyond_api/resources/orders.rb deleted file mode 100644 index 229bd4f..0000000 --- a/lib/beyond_api/resources/orders.rb +++ /dev/null @@ -1,1174 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class Orders < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to retrieve the active payment processes. There is only one active payment process. See {Show payment process details}[http://docs.beyondshop.cloud/#resources-payment-process-get] for more information about the request and response structure. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/208e2c1d-6610-43c7-b2f1-20aad6f029b9/processes/payments/active' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pypr:r+ - # - # @param order_id [String] the order UUID - # - # @return [OpenStruct] - # - # @example - # @payment_process = session.orders.active_payment_process("208e2c1d-6610-43c7-b2f1-20aad6f029b9") - # - def active_payment_process(order_id) - path = "/orders/#{order_id}/processes/payments/active" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the active refund processes. There is only one active refund process. See {Show refund process details}[http://docs.beyondshop.cloud/#resources-refund-process-get] for more information about the request and response structure. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/8613295f-4d44-4143-bfd0-6b81fc178618/processes/refunds/active' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +rfpr:r+ - # - # @param order_id [String] the order UUID - # - # @return [OpenStruct] - # - # @example - # @refund_process = session.orders.active_refund_process("8613295f-4d44-4143-bfd0-6b81fc178618") - # - def active_refund_process(order_id) - path = "/orders/#{order_id}/processes/refunds/active" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all orders of the shop in a paged way. Each item in the response represents a summary of the order data. - # - # @beyond_api.scopes +ordr:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @orders = session.orders.all(size: 100, page: 0) - # - def all(params = {}) - path = "/orders" - - handle_all_request(path, :orders, params) - end - - # - # A +POST+ request is used to cancel an order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/e3f9264a-395b-407d-9036-00f38f609be6/cancel' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "This needs to be done fast!" - # }' - # - # @beyond_api.scopes +clpr:c+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment"=> "This needs to be done fast!" - # } - # @order = session.orders.cancel("e3f9264a-395b-407d-9036-00f38f609be6", body) - # - def cancel(order_id, body) - path = "/orders/#{order_id}/cancel" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the cancelation process details of an order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/f16cf0db-7449-4029-a886-76f38b4aa464/processes/cancelations/365b4b63-45a8-49f6-94c5-a65e0dee83b5' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +clpr:r+ - # - # @param order_id [String] the order UUID - # @param cancelation_id [String] the cancelation UUID - # - # @return [OpenStruct] - # - # @example - # @pcancelation_process = session.orders.cancelation_process("f16cf0db-7449-4029-a886-76f38b4aa464", "365b4b63-45a8-49f6-94c5-a65e0dee83b5") - # - def cancelation_process(order_id, cancelation_id) - path = "/orders/#{order_id}/processes/payments/cancelations/#{cancelation_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all cancelation processes of an order in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/b8cb904d-4c82-4c39-a3a4-de7cb181a5d3/processes/cancelations?page=0&size=20' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +clpr:r+ - # - # @param order_id [String] the order UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @pcancelation_processes = session.orders.cancelation_processes("b8cb904d-4c82-4c39-a3a4-de7cb181a5d3", {page: 0, size: 20}) - # - def cancelation_processes(order_id, params = {}) - path = "/orders/#{order_id}/processes/payments/cancelations" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +POST+ request is used to capture the payment. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/ebfd99d6-f025-4c97-96d2-d5adbb45d6c2/processes/payments/2936deca-fd56-4c0d-88e2-8030c897bf90/capture' -i -X POST \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pypr:u+ - # - # @param order_id [String] the order UUID - # @param payment_id [String] the payment UUID - # - # @return [OpenStruct] - # - # @example - # @payment_process = session.orders.capture_payment_process("ebfd99d6-f025-4c97-96d2-d5adbb45d6c2", "2936deca-fd56-4c0d-88e2-8030c897bf90") - # - def capture_payment_process(order_id, payment_id) - path = "/orders/#{order_id}/processes/payments/#{payment_id}/capture" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a new cancelation process for an order. Cancelation processes trigger a refund process. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/9072c00d-1bc7-4fd8-8836-94ada5084e7a/processes/cancelations' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "This needs to be done fast!", - # "lineItems" : [ { - # "quantity" : 3, - # "productLineItemId" : "0e1f8ab4-ec78-42a6-9a46-a3384cd17d52" - # } ] - # }' - # - # @beyond_api.scopes +clpr:c+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment"=> "This needs to be done fast!", - # "lineItems"=> [{ - # "quantity"=> 3, - # "productLineItemId"=> "0e1f8ab4-ec78-42a6-9a46-a3384cd17d52" - # }] - # } - # @cancelation_process = session.orders.create_cancelation_process("9072c00d-1bc7-4fd8-8836-94ada5084e7a", body) - # - def create_cancelation_process(order_id, body) - path = "/orders/#{order_id}/processes/payments/cancelations" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create an invoice for the order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/a5d4d6c6-e77d-4180-8dbf-729f38a698b2/create-invoice' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{"deliveryDateNote": "Test DeliveryDateNote", "invoiceNote": "Test invoiceNote"}' - # - # @beyond_api.scopes +ordr:u+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "deliveryDateNote" => "Test DeliveryDateNote", - # "invoiceNote" => "Test invoiceNote" - # } - # @order = session.orders.create_invoice("a5d4d6c6-e77d-4180-8dbf-729f38a698b2", body) - # - def create_invoice(order_id, body) - path = "/orders/#{order_id}/create-invoice" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a new return process for an order. Return processes trigger a refund process. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/29007bb7-739a-46f5-8c70-4e1029b52fa5/processes/returns' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "This needs to be done fast!", - # "sendMail" : true, - # "lineItems" : [ { - # "quantity" : 3, - # "productLineItemId" : "bb9ad011-6417-4f04-8bc2-39651edebd2f", - # "status" : "RETURNED" - # } ], - # "shippingPriceRefund" : { - # "currency" : "EUR", - # "amount" : 19.99 - # } - # }' - # - # @beyond_api.scopes +rtpr:c+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment": "This needs to be done fast!", - # "sendMail": true, - # "lineItems": [{ - # "quantity": 3, - # "productLineItemId": "bb9ad011-6417-4f04-8bc2-39651edebd2f", - # "status": "RETURNED" - # }], - # "shippingPriceRefund": { - # "currency": "EUR", - # "amount": 19.99 - # } - # } - # @return_process = session.orders.create_return_process("29007bb7-739a-46f5-8c70-4e1029b52fa5", body) - # - def create_return_process(order_id, body) - path = "/orders/#{order_id}/processes/returns" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is ussed to create a new shipping processes for an order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/8df2fe3b-5149-492f-932a-073f012305eb/processes/shippings' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "This needs to be done fast!", - # "sendMail" : true, - # "createPackingSlip" : true, - # "trackingCode" : "lookAtMyTrackingCodeWow", - # "trackingLink" : "http://tracking.is/fun?code=lookAtMyTrackingCodeWow", - # "lineItems" : [ { - # "quantity" : 3, - # "productLineItemId" : "e96e1b33-d9e9-4508-862a-816235b541f7" - # } ] - # }' - # - # @beyond_api.scopes +shpr:c+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment" => "This needs to be done fast!", - # "send_mail" => true, - # "create_packing_slip" => true, - # "tracking_code" => "lookAtMyTrackingCodeWow", - # "tracking_link" => "http=>//tracking.is/fun?code=lookAtMyTrackingCodeWow", - # "line_items" => [ { - # "quantity" => 3, - # "product_line_item_id" => "e96e1b33-d9e9-4508-862a-816235b541f7" - # } ] - # } - # @shipping_process = session.orders.create_shipping_process("8df2fe3b-5149-492f-932a-073f012305eb", body) - # - def create_shipping_process(order_id, body) - path = "/orders/#{order_id}/processes/shippings" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all events of an order in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/66b6aab5-2ed4-4f36-855e-3adb2ea873ee/events' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +ordr:r+ - # - # @param order_id [String] the order UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @events = session.orders.find("66b6aab5-2ed4-4f36-855e-3adb2ea873ee", { size: 100, page: 0 }) - # - def events(order_id, params = {}) - path = "/orders/#{order_id}/events" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the details of an order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/a27f1019-3690-40d1-bd9d-d60dff4c4cf8' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +ordr:r+ - # - # @param order_id [String] the order UUID - # - # @return [OpenStruct] - # - # @example - # @order = session.orders.find("a27f1019-3690-40d1-bd9d-d60dff4c4cf8") - # - def find(order_id) - path = "/orders/#{order_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to mark the payment process as paid. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/9a1a1aaa-e37d-4c71-bc95-cbc228463fec/processes/payments/cb8c9a16-2d81-4ec1-9a4a-84a4c36124ae/mark-paid' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "comment", - # "details" : { - # "amount" : { - # "currency" : "EUR", - # "amount" : 77.44 - # } - # } - # }' - # - # @beyond_api.scopes +pypr:u+ - # - # @param order_id [String] the order UUID - # @param payment_id [String] the payment UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment" => "comment", - # "details" => { - # "amount" => { - # "currency" => "EUR", - # "amount" => 77.44 - # } - # } - # } - # - # @payment_process = session.orders.mark_payment_process_as_paid("9a1a1aaa-e37d-4c71-bc95-cbc228463fec", "cb8c9a16-2d81-4ec1-9a4a-84a4c36124ae", body) - # - def mark_payment_process_as_paid(order_id, payment_id, body) - path = "/orders/#{order_id}/processes/payments/#{payment_id}/mark-paid" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to mark the payment process as voided. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/a5558b7f-55f4-47d4-b603-9bf7eb59c05b/processes/payments/5bcc48e7-2641-42a8-a042-189ae92e9901/mark-voided' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "comment" - # }' - # - # @beyond_api.scopes +pypr:u+ - # - # @param order_id [String] the order UUID - # @param payment_id [String] the payment UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment" => "comment" - # } - # - # @payment_process = session.orders.mark_payment_process_as_voided("a5558b7f-55f4-47d4-b603-9bf7eb59c05b", "5bcc48e7-2641-42a8-a042-189ae92e9901", body) - # - def mark_payment_process_as_voided(order_id, payment_id, body) - path = "/orders/#{order_id}/processes/payments/#{payment_id}/mark-voided" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to mark the refund process as paid. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/60baa84c-9e11-4d55-97a9-1a7b00a0691c/processes/refunds/active/mark-paid' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "comment", - # "details" : { - # "amount" : { - # "currency" : "EUR", - # "amount" : 19.98 - # } - # } - # }' - # - # @beyond_api.scopes +rfpr:r+ - # - # @param order_id [String] the order UUID - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment" => "comment", - # "details" => { - # "amount" => { - # "currency" => "EUR", - # "amount" => 19.98 - # } - # } - # } - # @refund_process = session.orders.mark_refund_process_as_paid("60baa84c-9e11-4d55-97a9-1a7b00a0691c", body) - # - def mark_refund_process_as_paid(order_id) - path = "/orders/#{order_id}/processes/refunds/active/mark-paid" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to mark the shipment as delivered. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/b5642d1f-0f7f-444e-96d5-1c1d1642ea5e/processes/shippings/619d06d8-0077-4efd-b341-5103f71bfb2d/mark-delivered' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "comment" - # }' - # - # @beyond_api.scopes +shpr:u+ - # - # @param order_id [String] the order UUID - # @param shipping_id [String] the shipping UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment" => "comment", - # } - # - # @shipping_process = session.orders.mark_shipping_process_as_delivered("b5642d1f-0f7f-444e-96d5-1c1d1642ea5e", "619d06d8-0077-4efd-b341-5103f71bfb2d", body) - # - def mark_shipping_process_as_delivered(order_id, shipping_process_id, body) - path = "/orders/#{order_id}/processes/shippings/#{shipping_process_id}/mark-delivered" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to mark the shipment as shipped. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/dd6a7e20-16be-4509-bf83-fb8ee072ddad/processes/shippings/a0b0c4a5-0c80-47f4-98c3-0f55f4161176/mark-shipped' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "comment" : "This needs to be done fast!", - # "sendMail" : true, - # "details" : { - # "trackingCode" : "lookAtMyTrackingCodeWow", - # "trackingLink" : "http://tracking.is/fun?code=lookAtMyTrackingCodeWow" - # } - # }' - # - # @beyond_api.scopes +shpr:u+ - # - # @param order_id [String] the order UUID - # @param shipping_id [String] the shipping UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "comment" => "This needs to be done fast!", - # "sendMail" => true, - # "details" => { - # "trackingCode" => "lookAtMyTrackingCodeWow", - # "trackingLink" => "http://tracking.is/fun?code=lookAtMyTrackingCodeWow" - # } - # } - # - # @shipping_process = session.orders.mark_shipping_process_as_shipped("dd6a7e20-16be-4509-bf83-fb8ee072ddad", "a0b0c4a5-0c80-47f4-98c3-0f55f4161176", body) - # - def mark_shipping_process_as_shipped(order_id, shipping_id, body) - path = "/orders/#{order_id}/processes/shippings/#{shipping_id}/mark-shipped" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the payment processes. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/d44ed295-6a08-47ba-a288-90d4f3ba9fff/processes/payments/be56bfbd-af95-45b9-8b0e-cb0c184aaf60' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pypr:r+ - # - # @param order_id [String] the order UUID - # @param payment_id [String] the payment UUID - # - # @return [OpenStruct] - # - # @example - # @payment_process = session.orders.payment_process("d44ed295-6a08-47ba-a288-90d4f3ba9fff", "be56bfbd-af95-45b9-8b0e-cb0c184aaf60") - # - def payment_process(order_id, payment_id) - path = "/orders/#{order_id}/processes/payments/#{payment_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all payment processes of an order in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/2012b775-a706-41e0-b0f9-5142864ca4a0/processes/payments?page=0&size=20' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pypr:r+ - # - # @param order_id [String] the order UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @payment_processes = session.orders.payment_processes("2012b775-a706-41e0-b0f9-5142864ca4a0", {page: 0, size: 20}) - # - def payment_processes(order_id, params = {}) - path = "/orders/#{order_id}/processes/payments" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all order processes. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/934ece52-055c-4896-8d16-560f1461ea56/processes' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +ordr:r+ - # - # @param order_id [String] the order UUID - # - # @return [OpenStruct] - # - # @example - # @processes = session.orders.processes("934ece52-055c-4896-8d16-560f1461ea56") - # - def processes(order_id) - path = "/orders/#{order_id}/processes" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the refund processes. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/801885c8-0b25-44a2-a1a4-60cbf3f9ecca/processes/refunds/4c02883f-be31-4fb2-ad0d-ccbc3678a9f5' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +rfpr:r+ - # - # @param order_id [String] the order UUID - # @param refund_id [String] the refund UUID - # - # @return [OpenStruct] - # - # @example - # @refund_process = session.orders.refund_process("801885c8-0b25-44a2-a1a4-60cbf3f9ecca", "4c02883f-be31-4fb2-ad0d-ccbc3678a9f5") - # - def refund_process(order_id, refund_id) - path = "/orders/#{order_id}/processes/refunds/#{refund_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all refund processes of an order in a paged way. Refunds are triggered if either a cancelation or return process is created. See {Create cancelation processes}[http://docs.beyondshop.cloud/#resources-cancel-processes-create] and {Create return processes}[http://docs.beyondshop.cloud/#resources-return-processes-create] for more information. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/6f86e42f-763e-4514-a37d-fb8f88cdc14c/processes/refunds?page=0&size=20' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +rfpr:r+ - # - # @param order_id [String] the order UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @refund_processes = session.orders.refund_processes("6f86e42f-763e-4514-a37d-fb8f88cdc14c", {page: 0, size: 20}) - # - def refund_processes(order_id, params = {}) - path = "/orders/#{order_id}/processes/refunds" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all return processes of an order in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/cb9927e4-60d1-4a90-b40c-f5a8e2b25301/processes/returns/910a3fde-cb23-418f-876a-694ce42245ef' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +rtpr:r+ - # - # @param order_id [String] the order UUID - # @param return_process_id [String] the return process UUID - # - # @return [OpenStruct] - # - # @example - # @return_process = session.orders.return_process("cb9927e4-60d1-4a90-b40c-f5a8e2b25301", "910a3fde-cb23-418f-876a-694ce42245ef") - # - def return_process(order_id, return_process_id) - path = "/orders/#{order_id}/processes/returns/#{return_process_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all return processes of an order in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/9e26232f-aa7a-408b-8041-9439999268c5/processes/returns?page=0&size=20' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +rtpr:r+ - # - # @param order_id [String] the order UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @return_processes = session.orders.return_processes("9e26232f-aa7a-408b-8041-9439999268c5", {page: 0, size: 20}) - # - def return_processes(order_id, params = {}) - path = "/orders/#{order_id}/processes/returns" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the details of an order by cart ID. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/search/find-by-cart-id?cartId=82e859a8-7f70-4c19-83c1-ed03457b2ceb' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +ordr:r+ - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @order = session.orders.search_by_cart_id("82e859a8-7f70-4c19-83c1-ed03457b2ceb") - # - def search_by_cart_id(cart_id) - path = "/orders/search/find-by-cart-id" - - response, status = BeyondApi::Request.get(@session, - path, - { cart_id: cart_id }) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the +orderNumber+ and +orderId+ of an order by cart Id. If there is no order for the given cart Id, a HTTP 404 - NOT FOUND response is returned. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/search/find-order-number-by-cart-id?cartId=7f1cf6c8-7780-430f-9de0-91cbe31c4bf6' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +ordr:r+ - # - # @param cart_id [String] the cart UUID - # - # @return [OpenStruct] - # - # @example - # @order = session.orders.search_order_number_by_cart_id("7f1cf6c8-7780-430f-9de0-91cbe31c4bf6") - # - def search_order_number_by_cart_id(cart_id) - path = "/orders/search/find-order-number-by-cart-id" - - response, status = BeyondApi::Request.get(@session, - path, - { cart_id: cart_id }) - - handle_response(response, status) - end - - # - # A +GET+ request is used to send an invoice for the order. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/acc1f22f-a992-4534-be92-b378a0319fcd/send-order-document' -i -X POST \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "orderDocumentUri" : "https://myshop.com/api/pdf-storage/attachments/invoice_10003.pdf?hash=9e5e2631c6f5877d64cb3d40db46ec6eb48a3a92" - # }' - # - # @beyond_api.scopes +ordr:u+ - # - # @param order_id [String] the order UUID - # @param order_document_uri [String] the document url - # - # @return [OpenStruct] - # - # @example - # @order = session.orders.send_order_document("acc1f22f-a992-4534-be92-b378a0319fcd", - # "https://myshop.com/api/pdf-storage/attachments/invoice_10003.pdf?hash=9e5e2631c6f5877d64cb3d40db46ec6eb48a3a92") - # - def send_order_document(order_id, order_document_uri) - path = "/orders/#{order_id}/send-order-document" - - response, status = BeyondApi::Request.post(@session, - path, - { order_document_uri: order_document_uri }) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the shipping process details. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/af42860f-2813-4130-85d9-2d315a4f802e/processes/shippings/80ebe96b-bcd5-4a34-a428-8a67ed114ce6' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpr:r+ - # - # @param order_id [String] the order UUID - # @param shipping_process_id [String] the shipping process UUID - # - # @return [OpenStruct] - # - # @example - # @shipping_process = session.orders.refund_process("af42860f-2813-4130-85d9-2d315a4f802e", "80ebe96b-bcd5-4a34-a428-8a67ed114ce6") - # - def shipping_process(order_id, shipping_process_id) - path = "/orders/#{order_id}/processes/shippings/#{shipping_process_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all shipping processes of an order in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/d6387876-5e93-48dc-a6f3-f85893149819/processes/shippings?page=0&size=20' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpr:r+ - # - # @param order_id [String] the order UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @shipping_processes = session.orders.shipping_processes("268a8629-55cd-4890-9013-936b9b5ea14c", {page: 0, size: 20}) - # - def shipping_processes(order_id, params = {}) - path = "/orders/#{order_id}/processes/shippings" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to change the customer’s billing address. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/6c36e5e3-dc4c-4d00-b4e8-3fbf9a4bed14/billing-address' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "address" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : null, - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserstraße", - # "houseNumber" : "3", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "vatId" : "DE123456789", - # "taxNumber" : "HRE 987654/32123/864516", - # "birthDate" : "1985-05-11", - # "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ], - # "_id" : null - # }, - # "comment" : "Updated billing address" - # }' - # - # @beyond_api.scopes +ordr:u+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "address" => { - # "salutation" => "Mrs", - # "gender" => "FEMALE", - # "company" => "Astrid Alster GmbH", - # "title" => nil, - # "firstName" => "Astrid", - # "middleName" => "Agnes", - # "lastName" => "Alster", - # "street" => "Alsterwasserstraße", - # "houseNumber" => "3", - # "street2" => "Erdgeschoss", - # "addressExtension" => "Hinterhof", - # "postalCode" => "20999", - # "dependentLocality" => "Seevetal", - # "city" => "Alsterwasser", - # "country" => "DE", - # "state" => "Hamburg", - # "email" => "a.alsterh@example.com", - # "phone" => "(800) 555-0102", - # "mobile" => "(800) 555-0103", - # "vatId" => "DE123456789", - # "taxNumber" => "HRE 987654/32123/864516", - # "birthDate" => "1985-05-11", - # "displayAddressLines" => [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ], - # "_id" => null - # }, - # "comment" => "Updated billing address" - # } - # @order = session.orders.update_billing_address("6c36e5e3-dc4c-4d00-b4e8-3fbf9a4bed14", body) - # - def update_billing_address(order_id, body) - path = "/orders/#{order_id}/billing-address" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to change the order note. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/58545e43-f4ba-48e2-b0bf-e340fd64f7b8/order-note' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "orderNote" : "not paid yet" - # }' - # - # @beyond_api.scopes +ordr:u+ - # - # @param order_id [String] the order UUID - # @param order_note [String] the order note - # - # @return [OpenStruct] - # - # @example - # @order = session.orders.update_order_note("58545e43-f4ba-48e2-b0bf-e340fd64f7b8", "not paid yet" ) - # - def update_order_note(order_id, order_note) - path = "/orders/#{order_id}/order-note" - - response, status = BeyondApi::Request.put(@session, - path, - { order_note: order_note }) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to change the customer's shipping address. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/orders/30327fed-812f-4b70-8931-43e34d8c8181/shipping-address' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "address" : { - # "salutation" : "Mrs", - # "gender" : "FEMALE", - # "company" : "Astrid Alster GmbH", - # "title" : null, - # "firstName" : "Astrid", - # "middleName" : "Agnes", - # "lastName" : "Alster", - # "street" : "Alsterwasserstraße", - # "houseNumber" : "3", - # "street2" : "Erdgeschoss", - # "addressExtension" : "Hinterhof", - # "postalCode" : "20999", - # "dependentLocality" : "Seevetal", - # "city" : "Alsterwasser", - # "country" : "DE", - # "state" : "Hamburg", - # "email" : "a.alsterh@example.com", - # "phone" : "(800) 555-0102", - # "mobile" : "(800) 555-0103", - # "doorCode" : "456", - # "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ], - # "_id" : null - # }, - # "comment" : "Updated shipping address" - # }' - # @beyond_api.scopes +ordr:u+ - # - # @param order_id [String] the order UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "address" => { - # "salutation" => "Mrs", - # "gender" => "FEMALE", - # "company" => "Astrid Alster GmbH", - # "title" => nil, - # "firstName" => "Astrid", - # "middleName" => "Agnes", - # "lastName" => "Alster", - # "street" => "Alsterwasserstraße", - # "houseNumber" => "3", - # "street2" => "Erdgeschoss", - # "addressExtension" => "Hinterhof", - # "postalCode" => "20999", - # "dependentLocality" => "Seevetal", - # "city" => "Alsterwasser", - # "country" => "DE", - # "state" => "Hamburg", - # "email" => "a.alsterh@example.com", - # "phone" => "(800) 555-0102", - # "mobile" => "(800) 555-0103", - # "vatId" => "DE123456789", - # "taxNumber" => "HRE 987654/32123/864516", - # "birthDate" => "1985-05-11", - # "displayAddressLines" => [ "Astrid Alster GmbH", "Astrid Agnes Alster", "Alsterwasserweg 2", "Erdgeschoss", "Seevetal", "20999 Alsterwasser", "Germany" ], - # "_id" => null - # }, - # "comment" => "Updated shipping address" - # } - # @order = session.orders.update_shipping_address("30327fed-812f-4b70-8931-43e34d8c8181", body) - # - def update_shipping_address(order_id, body) - path = "/orders/#{order_id}/shipping-address" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/payment_method_definitions.rb b/lib/beyond_api/resources/payment_method_definitions.rb deleted file mode 100644 index 3d50c34..0000000 --- a/lib/beyond_api/resources/payment_method_definitions.rb +++ /dev/null @@ -1,182 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class PaymentMethodDefinitions < Base - include BeyondApi::Utils - - # - # A +POST+ request is used to create a payment method definition on system level. - # - # $ curl 'https://system.beyondshop.cloud/api/payment-method-definitions' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name": "credit-card", - # "referralUriTemplate": "https://example.com/merchants", - # "statusUriTemplate": "https://example.com/merchants/{shopId}/status", - # "disconnectUriTemplate": "https://example.com/merchants/{shopId}/disconnect", - # "createPaymentUriTemplate": "https://example.com/payments", - # "capturePaymentUriTemplate": "https://example.com/payments/{paymentId}/capture", - # "refundPaymentUriTemplate": "https://example.com/payments/{paymentId}/refund", - # "sandbox": "true", - # "workflow": "PAYMENT_ON_BUY", - # "captureWorkflow": "CAPTURE_ON_ORDER", - # "refund": "NO_REFUND", - # "logos": [{ - # "setName" : "official", - # "variant" : "STOREFRONT", - # "uri" : "https://example.com/static/storefront.png" - # }], - # "officialName": {"de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.", - # "en-US" : "Allow your customers to pay by credit card." - # }, - # "officialDescription": { - # "de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.", - # "en-US" : "Allow your customers to pay by credit card." - # }, - # "defaultName": { - # "de-DE" : "Kreditkarte", - # "en-US" : "Credit card" - # }, - # "defaultDescription": {"de-DE" : "Bezahlen Sie mit Kreditkarte.","en-US" : "Pay by credit card."}}' - # - # @beyond_api.scopes +paym:m+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # @payment_method_definitions = session.payment_method_definitions.create(body) - # - def create(body) - response, status = BeyondApi::Request.post(@session, - "/payment-method-definitions", - body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all payment method definitions on system level. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-method-definitions' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +paym:m+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @payment_method_definitions = session.payment_method_definitions.all(size: 100, page: 0) - # - def all(params = {}) - handle_all_request("/payment-method-definitions", :payment_method_definitions, params) - end - - # - # A +GET+ request is used to deactivate a payment method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-method-definitions/credit-card' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pymt:u+ - # - # @param payment_method_definition_id [String] the payment method definition UUID - # - # @return [OpenStruct] - # - # @example - # @payment_method_definition = session.payment_methods.find("credit-card") - # - def find(payment_method_definition_id) - response, status = BeyondApi::Request.get(@session, - "/payment-method-definitions/#{payment_method_definition_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update a payment method definition on system level. - # - # $ curl 'https://system.beyondshop.cloud/api/payment-method-definitions/credit-card' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name": "credit-card-updated", - # "referralUriTemplate": "https://example.com/merchants", - # "statusUriTemplate": "https://example.com/merchants/{shopId}/status", - # "disconnectUriTemplate": "https://example.com/merchants/{shopId}/disconnect", - # "createPaymentUriTemplate": "https://example.com/payments", - # "capturePaymentUriTemplate": "https://example.com/payments/{paymentId}/capture", - # "refundPaymentUriTemplate": "https://example.com/payments/{paymentId}/refund", - # "workflow": "PAYMENT_ON_SELECTION", - # "captureWorkflow": "CAPTURE_ON_DEMAND", - # "refund": "NO_REFUND", - # "logos": [{ - # "setName" : "official", - # "variant" : "STOREFRONT", - # "uri" : "https://example.com/static/storefront.png" - # }], - # "officialName": {"de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.", - # "en-US" : "Allow your customers to pay by credit card." - # }, - # "officialDescription": { - # "de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.", - # "en-US" : "Allow your customers to pay by credit card." - # }, - # "defaultName": { - # "de-DE" : "Kreditkarte", - # "en-US" : "Credit card" - # }, - # "defaultDescription": {"de-DE" : "Bezahlen Sie mit Kreditkarte.","en-US" : "Pay by credit card."}}' - # - # @beyond_api.scopes +paym:m+ - # - # @param payment_method_definition_id [String] the payment method definition UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # @payment_method_definition = session.payment_method_definitions.update("credit_card", body) - # - def update(payment_method_definition_id, body) - response, status = BeyondApi::Request.put(@session, - "/payment-method-definitions/#{payment_method_definition_id}", - body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a payment method definition on system level. - # - # $ curl 'https://system.beyondshop.cloud/api/payment-method-definitions/credit-card' -i -X DELETE \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @return true - # - # @example - # session.payment_method_definitions.delete("credit-card") - # - def delete(payment_method_definition_id) - response, status = BeyondApi::Request.delete(@session, - "/payment-method-definitions/#{payment_method_definition_id}", - body) - - handle_response(response, status, respond_with_true: true) - end - end -end diff --git a/lib/beyond_api/resources/payment_methods.rb b/lib/beyond_api/resources/payment_methods.rb deleted file mode 100644 index e10dbb2..0000000 --- a/lib/beyond_api/resources/payment_methods.rb +++ /dev/null @@ -1,194 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class PaymentMethods < Base - include BeyondApi::Utils - - # - # A +POST+ request is used to activate a payment method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/da313b73-ea6b-49c7-8a3d-d707934098b8/activate' -i -X POST \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pymt:u+ - # - # @param payment_method_id [String] the payment method UUID - # - # @return true - # - # @example - # session.payment_methods.activate("da313b73-ea6b-49c7-8a3d-d707934098b8") - # - def activate(payment_method_id) - response, status = BeyondApi::Request.post(@session, "/payment-methods/#{payment_method_id}/activate") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to list all payment methods in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pymt:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @payment_methods = session.payment_methods.all(size: 100, page: 0) - # - def all(params = {}) - handle_all_request("/payment-methods", :payment_methods, params) - end - - # - # A +POST+ request is used to deactivate a payment method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/157f930f-328a-4d7a-974d-66bc3b4dd28e/deactivate' -i -X POST \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pymt:u+ - # - # @param payment_method_id [String] the payment method UUID - # - # @return true - # - # @example - # session.payment_methods.deactivate("157f930f-328a-4d7a-974d-66bc3b4dd28e") - # - def deactivate(payment_method_id) - response, status = BeyondApi::Request.post(@session, "/payment-methods/#{payment_method_id}/deactivate") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a payment method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/7d964402-8f67-48f3-af86-6c35abe4fa08' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +pymt:r+ - # - # @param payment_method_id [String] the payment method UUID - # - # @return [OpenStruct] - # - # @example - # @payment_method = session.payment_methods.find("7d964402-8f67-48f3-af86-6c35abe4fa08") - # - def find(payment_method_id) - response, status = BeyondApi::Request.get(@session, "/payment-methods/#{payment_method_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to sort payment methods. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Authorization: Bearer ' \ - # -d 'https://api-shop.beyondshop.cloud/api/payment-methods/dd59a52b-0661-49f9-82c3-e063ff80328f - # https://api-shop.beyondshop.cloud/api/payment-methods/66b22fb2-2184-4ea1-9143-44ae1d230d49 - # https://api-shop.beyondshop.cloud/api/payment-methods/a9462eae-ed72-4e29-b853-f04537c8ab11 - # https://api-shop.beyondshop.cloud/api/payment-methods/84172da4-5baa-4a99-b779-33d673bed6d1' - # - # @beyond_api.scopes +pymt:u+ - # - # @param payment_method_ids [Array] the payment method UUIDs - # - # @return [OpenStruct] - # - # @example - # payment_method_ids = [ - # "dd59a52b-0661-49f9-82c3-e063ff80328f", - # "66b22fb2-2184-4ea1-9143-44ae1d230d49", - # "a9462eae-ed72-4e29-b853-f04537c8ab11", - # "84172da4-5baa-4a99-b779-33d673bed6d1" - # ] - # - # session.payment_methods.sort(payment_method_ids) - # - def sort(payment_method_ids) - body = payment_method_ids.map { |id| "#{@session.api_url}/payment-methods/#{id}" } - response, status = BeyondApi::Request.put(@session, "/payment-methods", body) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update a payment method. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/dc00a5af-d21e-49f0-99f2-ef67ca6fa782' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "Another name", - # "description" : "Pay by ACME.", - # "taxClass" : "REGULAR", - # "discountOrFee" : { - # "type" : "ABSOLUTE", - # "absoluteValue" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : 2.0 - # } - # }, - # "serviceableCountries" : [ "DE" ], - # "minimumOrderValue" : { - # "currency" : "EUR", - # "amount" : 10.0 - # } - # }' - # - # @beyond_api.scopes +pymt:u+ - # - # @param payment_method_id [String] the payment method UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "Another name", - # "description" => "Pay by ACME.", - # "tax_class" => "REGULAR", - # "discount_or_fee" => { - # "type" => "ABSOLUTE", - # "absolute_value" => { - # "tax_model" => "GROSS", - # "currency" => "EUR", - # "amount" => 2.0 - # } - # }, - # "serviceable_countries" => [ "DE" ], - # "minimum_order_value" => { - # "currency" => "EUR", - # "amount" => 10.0 - # } - # } - # - # @payment_method = session.payment_methods.update("dc00a5af-d21e-49f0-99f2-ef67ca6fa782", body) - # - def update(payment_method_id, body) - response, status = BeyondApi::Request.put(@session, "/payment-methods/#{payment_method_id}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/pickup_options.rb b/lib/beyond_api/resources/pickup_options.rb deleted file mode 100644 index f1bb6f2..0000000 --- a/lib/beyond_api/resources/pickup_options.rb +++ /dev/null @@ -1,216 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class PickupOptions < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all pickup options of the shop in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @pickup_options = session.pickup_options.all(size: 100, page: 0) - # - def all(params = {}) - handle_all_request("/pickup-options", :pickup_options, params) - end - - # - # A +POST+ request is used to create a pickup option. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "My little Cornershop - St.Ives", - # "description" : "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.", - # "taxClass" : "REGULAR", - # "freePickupValue" : { - # "currency" : "EUR", - # "amount" : 50 - # }, - # "fixedPrice" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : 1 - # }, - # "phoneNumberRequired" : true, - # "locationId" : "cb554eb6-2768-4491-afd2-6bcd0aec0937" - # }' - # - # @beyond_api.scopes +shpz:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # name: "My little Cornershop - St.Ives", - # description: "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.", - # tax_class: "REGULAR", - # free_pickup_value: { - # currency: "EUR", - # amount: 50 - # }, - # fixed_price: { - # tax_model: "GROSS", - # currency: "EUR", - # amount: 1 - # }, - # phone_number_required: true, - # location_id: "cb554eb6-2768-4491-afd2-6bcd0aec0937" - # } - # - # @pickup_option = session.pickup_options.create(body) - # - def create(body) - response, status = BeyondApi::Request.post(@session, "/pickup-options", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a pickup option. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/d253a31b-3892-4196-ae16-c5d8d6b05791' -i -X DELETE - # - # @beyond_api.scopes +shpz:d+ - # - # @param pickup_option_id [String] the pickup option UUID - # - # @return true - # - # @example - # session.pickup_options.delete("d253a31b-3892-4196-ae16-c5d8d6b05791") - # - def delete(pickup_option_id) - response, status = BeyondApi::Request.delete(@session, "/pickup-options/#{pickup_option_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a pickup option. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/76302c10-761f-43c1-9d18-52ad16bd52e8' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpz:r+ - # - # @param pickup_option_id [String] the pickup option UUID - # - # @return [OpenStruct] - # - # @example - # @pickup_option = session.pickup_options.find("76302c10-761f-43c1-9d18-52ad16bd52e8") - # - def find(pickup_option_id) - response, status = BeyondApi::Request.get(@session, "/pickup-options/#{pickup_option_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to sort the pickup options. This is done by passing the self-links of the pickup options in the desired order. The request must contain URIs for all pickup options of the given page. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Authorization: Bearer ' \ - # -d 'https://api-shop.beyondshop.cloud/api/pickup-options/bff3673f-91c1-4e09-a8ab-562a3a553fac - # https://api-shop.beyondshop.cloud/api/pickup-options/7b4d36fc-ac0f-44a3-8655-f2bd05c2a42d - # https://api-shop.beyondshop.cloud/api/pickup-options/630b63ee-c7d8-4953-9b7c-c874fd795154' - # - # @beyond_api.scopes +shpz:u+ - # - # @param pickup_option_ids [Array] the pickup option UUIDs - # - # @return [OpenStruct] - # - # @example - # pickup_option_ids = [ - # "bff3673f-91c1-4e09-a8ab-562a3a553fac", - # "7b4d36fc-ac0f-44a3-8655-f2bd05c2a42d", - # "630b63ee-c7d8-4953-9b7c-c874fd795154" - # ] - # - # session.pickup_options.sort(pickup_option_ids) - # - def sort(pickup_option_ids) - body = pickup_option_ids.map { |id| "#{@session.api_url}/pickup-options/#{id}" } - response, status = BeyondApi::Request.put(@session, "/pickup-options", body) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update a pickup option. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/pickup-options/5765b837-db5b-49a9-a659-68d00376e42a' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "New name", - # "description" : "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.", - # "taxClass" : "REGULAR", - # "freePickupValue" : { - # "currency" : "EUR", - # "amount" : 50 - # }, - # "fixedPrice" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : 1 - # }, - # "phoneNumberRequired" : true, - # "locationId" : "c9179393-abcc-450a-8cf4-875b39647ab6" - # }' - # - # @beyond_api.scopes +shpz:u+ - # - # @param pickup_option_id [String] the pickup option UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # name: "New name", - # description: "We will send you an email when your items are ready for pickup. Please bring a copy of your order confirmation.", - # tax_class: "REGULAR", - # free_pickup_value: { - # currency: "EUR", - # amount: 50 - # }, - # fixed_price: { - # tax_model: "GROSS", - # currency: "EUR", - # amount: 1 - # }, - # phone_number_required: true, - # location_id: "c9179393-abcc-450a-8cf4-875b39647ab6" - # } - # - # @pickup_option = session.pickup_options.update("5765b837-db5b-49a9-a659-68d00376e42a", body) - # - def update(pickup_option_id, body) - response, status = BeyondApi::Request.put(@session, "/pickup-options/#{pickup_option_id}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/product_attribute_definitions.rb b/lib/beyond_api/resources/product_attribute_definitions.rb deleted file mode 100644 index 4296bdb..0000000 --- a/lib/beyond_api/resources/product_attribute_definitions.rb +++ /dev/null @@ -1,118 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class ProductAttributeDefinitions < Base - include BeyondApi::Utils - - # - # A +GET+ request will list the available product attribute definitions. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prad:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @product_attribute_definitions = session.product_attribute_definitions.all(size: 100, page: 0) - # - def all(params = {}) - path = "/product-attribute-definitions" - - handle_all_request(path, :product_attribute_definitions, params) - end - - # - # A +POST+ request is used to create a product attribute definition. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "key" : "filling_capacity", - # "type" : "NUMBER", - # "displayName" : "Filling Capacity", - # "format" : "#,###.## ml" - # }' - # - # @beyond_api.scopes +prad:c+ - # - # @param product_attribute_name [String] the product attribute key - # - # @return [OpenStruct] - # - # @example - # body = { - # "key": "filling_capacity", - # "type": "NUMBER", - # "displayName": "Filling Capacity", - # "format": "#,###.## ml" - # } - # @product_attribute_definition = session.product_attribute_definitions.create(body) - # - def create(body) - path = "/product-attribute-definitions" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product attribute definition. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions/color' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prad:d+ - # - # @param product_attribute_name [String] the product attribute key - # - # @return [true] - # - # @example - # session.product_attribute_definitions.delete("color") - # - def delete(product_attribute_name) - path = "/product-attribute-definitions/#{product_attribute_name}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve a single product attribute definition by name. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions/filling_capacity' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prad:r+ - # - # @param product_attribute_name [String] the product attribute key - # - # @return [OpenStruct] - # - # @example - # @product_attribute_definition = session.product_attribute_definitions.find("filling_capacity") - # - def find(product_attribute_name) - path = "/product-attribute-definitions/#{product_attribute_name}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products.rb b/lib/beyond_api/resources/products.rb deleted file mode 100644 index 6da3a50..0000000 --- a/lib/beyond_api/resources/products.rb +++ /dev/null @@ -1,302 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - autoload :ProductAttachments, "beyond_api/resources/products/attachments" - autoload :ProductAvailability, "beyond_api/resources/products/availability" - autoload :ProductCrossSells, "beyond_api/resources/products/cross_sells" - autoload :ProductCustomAttributes, "beyond_api/resources/products/custom_attributes" - autoload :ProductImages, "beyond_api/resources/products/images" - autoload :ProductSearches, "beyond_api/resources/products/searches" - autoload :ProductVariationProperties, "beyond_api/resources/products/variation_properties" - autoload :ProductVideos, "beyond_api/resources/products/videos" - - class Products < Base - include BeyondApi::ProductAttachments - include BeyondApi::ProductAvailability - include BeyondApi::ProductCrossSells - include BeyondApi::ProductCustomAttributes - include BeyondApi::ProductImages - include BeyondApi::ProductSearches - include BeyondApi::ProductVariationProperties - include BeyondApi::ProductVideos - include BeyondApi::Utils - - # - # A +GET+ request will list all of the products in a paged manner. The returned data is an excerpt projection, which includes a small subset of product properties. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @products = session.products.all(size: 100, page: 0) - # - def all(params = {}) - path = "/products" - - handle_all_request(path, :products, params) - end - - # - # A +POST+ request is used to create a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "sku" : "123456789-001", - # "name" : "Rioja Castillo de Puerto (2013)", - # "description" : "Spain\nRioja Tempranillo", - # "manufacturer" : "Grape Vineyard", - # "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - # "tags" : [ "Bestseller", "Red Wine", "Sale" ], - # "productIdentifiers" : [ { - # "type" : "EAN", - # "value" : "9780134308135" - # } ], - # "salesPrice" : { - # "taxModel" : "NET", - # "amount" : 8.7, - # "currency" : "EUR" - # }, - # "listPrice" : { - # "taxModel" : "NET", - # "amount" : 10.95, - # "currency" : "EUR" - # }, - # "manufacturerPrice" : { - # "taxModel" : "NET", - # "amount" : 99.95, - # "currency" : "EUR" - # }, - # "visible" : true, - # "taxClass" : "REGULAR", - # "shippingWeight" : 100, - # "maxOrderQuantity" : 6, - # "shippingDimension" : { - # "length" : 1500, - # "width" : 1000, - # "height" : 2000 - # }, - # "refPrice" : { - # "refQuantity" : 1, - # "unit" : "LITER", - # "quantity" : 0.75, - # "price" : { - # "taxModel" : "NET", - # "amount" : 11.6, - # "currency" : "EUR" - # } - # }, - # "shippingPeriod" : { - # "min" : 2, - # "max" : 4, - # "displayUnit" : "WEEKS" - # } - # }' - # - # @beyond_api.scopes +prod:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "sku": "123456789-001", - # "name": "Rioja Castillo de Puerto (2013)", - # "description": "Spain\nRioja Tempranillo", - # "manufacturer": "Grape Vineyard", - # "essentialFeatures": "Dry. 12% alcohol. Best vine variety.", - # "tags": ["Bestseller", "Red Wine", "Sale"], - # "productIdentifiers": [{ - # "type": "EAN", - # "value": "9780134308135" - # }], - # "salesPrice": { - # "taxModel": "NET", - # "amount": 8.7, - # "currency": "EUR" - # }, - # "listPrice": { - # "taxModel": "NET", - # "amount": 10.95, - # "currency": "EUR" - # }, - # "manufacturerPrice": { - # "taxModel": "NET", - # "amount": 99.95, - # "currency": "EUR" - # }, - # "visible": true, - # "taxClass": "REGULAR", - # "shippingWeight": 100, - # "maxOrderQuantity": 6, - # "shippingDimension": { - # "length": 1500, - # "width": 1000, - # "height": 2000 - # }, - # "refPrice": { - # "refQuantity": 1, - # "unit": "LITER", - # "quantity": 0.75, - # "price": { - # "taxModel": "NET", - # "amount": 11.6, - # "currency": "EUR" - # } - # }, - # "shippingPeriod": { - # "min": 2, - # "max": 4, - # "displayUnit": "WEEKS" - # } - # } - # - # @product = session.products.create(body) - # - def create(body) - path = "/products" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product or variation product. When a variation product is deleted, all its variations are deleted as well. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/c06c61af-f99a-4698-90fa-8c3199ca732f' -i -X DELETE \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:d+ - # - # @param product_id [String] the product UUID - # - # @return true - # - # @example - # session.products.delete("c06c61af-f99a-4698-90fa-8c3199ca732f") - # - def delete(product_id) - path = "/products/#{product_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/75ebcb57-aefb-4963-8225-060c528e070d' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # - # @return [OpenStruct] - # - # @example - # @product = session.products.find("75ebcb57-aefb-4963-8225-060c528e070d") - # - def find(product_id) - path = "/products/#{product_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +PATCH+ request is used to update a product partially with json content type. - # - # @beyond_api.scopes +prod:u+ - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/b69e3f47-03b8-40d2-843c-ae89a3d9bcdd' -i -X PATCH \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "patched name", - # "description" : "patched description.


  1. \n

    this is my test html\n
", - # "productIdentifiers" : null, - # "manufacturer" : "patched manufacturer" - # }' - # - # @param product_id [String] the product UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name": "patched name", - # "description": "patched description.


  1. \n

    this is my test html\n
", - # "productIdentifiers": null, - # "manufacturer": "patched manufacturer" - # } - # @product = session.products.update("b69e3f47-03b8-40d2-843c-ae89a3d9bcdd", body) - # - def update(product_id, body) - path = "/products/#{product_id}" - - response, status = BeyondApi::Request.patch(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to assign a variation attribute as the variation images differentiator for a variation product. - # - # @beyond_api.scopes +prod:u+ - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/f205294b-17dc-4f75-8b5e-5df72abb96df/variation-attributes/491fedf4-37a9-4bcf-98b8-cff2f82879b7/make-differentiator' -i -X POST \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @param product_id [String] the product UUID - # @param variation_attribute_id [String] the variation attribute UUID - # - # @return [true] - # - # @example - # session.products.assign_variation_images_differentiator("f205294b-17dc-4f75-8b5e-5df72abb96df", "491fedf4-37a9-4bcf-98b8-cff2f82879b7") - # - def assign_variation_attribute_as_differentiator(product_id, variation_attribute_id) - path = "/products/#{product_id}/variation-attributes/#{variation_attribute_id}/make-differentiator" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - alias create_variation create - alias find_variation find - alias update_variation update - end -end diff --git a/lib/beyond_api/resources/products/attachments.rb b/lib/beyond_api/resources/products/attachments.rb deleted file mode 100644 index c02a79f..0000000 --- a/lib/beyond_api/resources/products/attachments.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductAttachments - # - # A +POST+ request is used to create an attachment and add it to a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/ecb997ce-79c3-4367-9373-058089a313e3/attachments' -i -X POST \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "mimeType" : "application/pdf", - # "length" : 1, - # "label" : "Handbuch", - # "dataUri" : "my_document_1.pdf?hash=8a627f655c68f56dfbbf217ab7d5563281225666" - # }' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "mime_type" => "application/pdf", - # "length" => 1, - # "label" => "Handbuch", - # "data_uri" => "my_document_1.pdf?hash=8a627f655c68f56dfbbf217ab7d5563281225666" - # } - # @attachment = session.products.add_attachment("ecb997ce-79c3-4367-9373-058089a313e3", body) - # - def add_attachment(product_id, body) - response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/attachments", body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve a single attachment of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/eb11b53a-5017-4ae7-9ba1-c02c12c80b61/attachments/36933722-f13f-4ee2-858c-0835ae0a884e' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param attachment_id [String] the attachment UUID - # - # @return [OpenStruct] - # - # @example - # @attachment = session.products.attachment("eb11b53a-5017-4ae7-9ba1-c02c12c80b61", "36933722-f13f-4ee2-858c-0835ae0a884e") - # - def attachment(product_id, attachment_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/attachments/#{attachment_id}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all the attachments of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/fd60a63e-c4c0-496d-af49-c4ed224cca2a/attachments' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @attachments = session.products.attachments("fd60a63e-c4c0-496d-af49-c4ed224cca2a", {size: 100, page: 0}) - # - def attachments(product_id, params = {}) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/attachments", params) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product attachment - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/00add006-beaa-46fe-bb73-f8ebae15082d/attachments/9a44e585-571a-4253-9248-54a4c418c7e2' -i -X DELETE \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param attachment_id [String] the attachment UUID - # - # @return [true] - # - # @example - # session.products.delete_attachment("00add006-beaa-46fe-bb73-f8ebae15082d", "9a44e585-571a-4253-9248-54a4c418c7e2") - # - def delete_attachment(product_id, attachment_id) - response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}/attachments/#{attachment_id}") - - handle_response(response, status, respond_with_true: true) - end - end -end diff --git a/lib/beyond_api/resources/products/availability.rb b/lib/beyond_api/resources/products/availability.rb deleted file mode 100644 index a17d0a2..0000000 --- a/lib/beyond_api/resources/products/availability.rb +++ /dev/null @@ -1,188 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductAvailability - # - # A +POST+ request is used to adjust the available stock of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/685f483e-cdda-40af-8091-d5bc31249409/availability/adjust-available-stock' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ "relativeAmount" : -1 }' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # @param relative_amount [Integer] the relative amount - # - # @return [OpenStruct] - # - # @example - # @availability = session.products.adjust_stock_level("685f483e-cdda-40af-8091-d5bc31249409", -1) - # - def adjust_stock_level(product_id, relative_amount) - response, status = BeyondApi::Request.post(@session, - "/products/#{product_id}/availability/adjust-available-stock", - { relative_amount: relative_amount }) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the availability of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/fb22d408-00dc-47e3-ae58-e35769bdb428/availability' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:r+ - # - # @param product_id [String] the product UUID - # - # @return [OpenStruct] - # - # @example - # @availability = session.products.availability("fb22d408-00dc-47e3-ae58-e35769bdb428") - # - def availability(product_id) - response, status = BeyondApi::Request.get(@session, - "/products/#{product_id}/availability") - - handle_response(response, status) - end - - # - # A +POST+ request is used to disable purchasability for a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/6b30255e-650f-475c-b345-e7247f957689/availability/disable-purchasability' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # - # @return true - # - # @example - # session.products.disable_purchasability("6b30255e-650f-475c-b345-e7247f957689") - # - def disable_purchasability(product_id) - response, status = BeyondApi::Request.post(@session, - "/products/#{product_id}/availability/disable-purchasability") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to disable stock management for a product or variation product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/e966cb17-4047-4b82-ade4-33e7f0978c89/availability/disable-stock-management' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # - # @return true - # - # @example - # session.products.disable_stock_management("e966cb17-4047-4b82-ade4-33e7f0978c89") - # - def disable_stock_management(product_id) - response, status = BeyondApi::Request.post(@session, - "/products/#{product_id}/availability/disable-stock-management") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to enable purchasability for a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/17e3a92b-6f3b-4415-bd8f-c9c8921a5a73/availability/enable-purchasability' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # - # @return true - # - # @example - # session.products.enable_purchasability("17e3a92b-6f3b-4415-bd8f-c9c8921a5a73") - # - def enable_purchasability(product_id) - response, status = BeyondApi::Request.post(@session, - "/products/#{product_id}/availability/enable-purchasability") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to enable stock management for a product or variation product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/101fa968-9bb8-4dbe-b166-3add1fc1b35e/availability/enable-stock-management' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ "initialAvailableStock" : 100, "stockThreshold" : 2 }' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "initial_available_stock" => 100, - # "stock_threshold" => 2 - # } - # @availability = session.products.enable_stock_management("101fa968-9bb8-4dbe-b166-3add1fc1b35e", body) - # - def enable_stock_management(product_id, body) - response, status = BeyondApi::Request.post(@session, - "/products/#{product_id}/availability/enable-stock-management", - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update the reserve stock by changing the +stockThreshold+ value of a product or variation product (incl. all of its variations). Reserve stock refers to an inventory level that indicates that a product needs to be reordered. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/f74b5f57-43cc-4176-97aa-c6eb9fdeb37c/availability/update-stock-threshold' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ "stockThreshold" : 5 }' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # @param stock_threshold [Integer] the stock threshold - # - # @return [OpenStruct] - # - # @example - # session.products.update_reserve_stock("f74b5f57-43cc-4176-97aa-c6eb9fdeb37c", 5) - # - def update_reserve_stock(product_id, stock_threshold) - response, status = BeyondApi::Request.put(@session, - "/products/#{product_id}/availability/update-stock-threshold", - { stock_threshold: stock_threshold }) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products/cross_sells.rb b/lib/beyond_api/resources/products/cross_sells.rb deleted file mode 100644 index 3ae9a64..0000000 --- a/lib/beyond_api/resources/products/cross_sells.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductCrossSells - # - # A +POST+ request is used to create a cross-sell for a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/43df85ec-e123-4a56-bcc3-c3c52eb23ca9/cross-sells' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "Red wines from Spain cross-sell", - # "type" : "MANUAL", - # "queries" : [ { - # "ids" : [ "22e8b6a6-7d8e-4b08-be63-dde9bced2604", "b18e9e3c-685c-4e37-837c-9047b88fc91e" ], - # "strategy" : "all-ids-match" - # } ] - # }' - # - # @beyond_api.scopes +prcs:c+ - # - # @param product_id [String] the product UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # name => "Red wines from Spain cross-sell", - # type => "MANUAL", - # queries => [ { - # "ids" : [ "22e8b6a6-7d8e-4b08-be63-dde9bced2604", "b18e9e3c-685c-4e37-837c-9047b88fc91e" ], - # "strategy" : "all-ids-match" - # } ] - # } - # - # @cross_sell = session.products.create_cross_sell("43df85ec-e123-4a56-bcc3-c3c52eb23ca9", body) - # - def create_cross_sell(product_id, body) - response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/cross-sells", body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the cross-sell of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/20174c3f-1a3f-4401-91f6-c7498e897c82/cross-sells/6176b350-06ff-4c52-b3cf-ba032ea79468' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prcs:r+ - # - # @param product_id [String] the product UUID - # @param cross_sell_id [String] the cross-sell UUID - # - # @return [OpenStruct] - # - # @example - # - # @cross_sell = session.products.cross_sell("20174c3f-1a3f-4401-91f6-c7498e897c82", "6176b350-06ff-4c52-b3cf-ba032ea79468") - # - def cross_sell(product_id, cross_sell_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/cross-sells/#{cross_sell_id}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the cross-sells of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/a21188a2-7109-4cd1-8253-2f366d86ff5d/cross-sells' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prcs:r+ - # - # @param product_id [String] the product UUID - # - # @return [OpenStruct] - # - # @example - # - # @cross_sells = session.products.cross_sells("a21188a2-7109-4cd1-8253-2f366d86ff5d") - # - def cross_sells(product_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/cross-sells") - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product attribute. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/b80cdb11-0e97-41e3-8559-4d426bd28ba1/cross-sells/67ecb3ef-8472-4509-9e5a-c76945e8d963' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prcs:d+ - # - # @param product_id [String] the product UUID - # @param cross_sell_id [String] the cross-sell UUID - # - # @return [OpenStruct] - # - # @example - # - # session.products.cross_sell("b80cdb11-0e97-41e3-8559-4d426bd28ba1", "67ecb3ef-8472-4509-9e5a-c76945e8d963") - # - def delete_cross_sell(product_id, cross_sell_id) - response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}/cross-sells/#{cross_sell_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update a cross-sell for a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/4ed7a15a-9ef8-415f-8161-87498b1ecd4f/cross-sells/b18d96f4-dfdf-47f3-b2dc-ce1653829674' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "sale rose wine cross-selling", - # "type" : "SMART", - # "queries" : [ { - # "tags" : [ "Rosé Wine", "Sale" ], - # "strategy" : "any-tags-match" - # } ] - # }' - # - # @beyond_api.scopes +prcs:u+ - # - # @param product_id [String] the product UUID - # @param cross_sell_id [String] the cross-sell UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # name => "sale rose wine cross-selling", - # type => "SMART", - # queries => [ { - # tags => [ "Rosé Wine", "Sale" ], - # strategy => "any-tags-match" - # } ] - # } - # - # @cross_sell = session.products.update_cross_sell("4ed7a15a-9ef8-415f-8161-87498b1ecd4f", "b18d96f4-dfdf-47f3-b2dc-ce1653829674", body) - # - def update_cross_sell(product_id, attribute_name, body) - response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/cross-sells/#{cross_sell_id}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products/custom_attributes.rb b/lib/beyond_api/resources/products/custom_attributes.rb deleted file mode 100644 index 694bd70..0000000 --- a/lib/beyond_api/resources/products/custom_attributes.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductCustomAttributes - # - # A +POST+ request is used to create a product attribute, which defines the value of a certain {product attribute definition}[http://docs.beyondshop.cloud/#resources-product-attribute-definitions] for a specific {product}[http://docs.beyondshop.cloud/#resources-products]. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/0c0e1699-d2a4-44d0-bed9-64b2fa1a7713/attributes' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "key" : "colour", - # "value" : "Yellow" - # }' - # - # @beyond_api.scopes +prat:c+ - # - # @param product_id [String] the product UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "key" => "colour", - # "value" => "Yellow" - # } - # - # @custom_attribute = session.products.create_custom_attribute("0c0e1699-d2a4-44d0-bed9-64b2fa1a7713", body) - # - def create_custom_attribute(product_id, body) - response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/attributes", body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve detailed information about a specific product attribute. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/d389347c-568e-4785-8216-91e4f8850c66/attributes/key' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prat:r+ - # - # @param product_id [String] the product UUID - # @param attribute_name [String] the key of custom attribute - # - # @return [OpenStruct] - # - # @example - # - # @custom_attribute = session.products.custom_attribute("d389347c-568e-4785-8216-91e4f8850c66", "key") - # - def custom_attribute(product_id, attribute_name) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/attributes/#{attribute_name}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve all product attributes for a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/57f0ef04-9dac-462f-9dd4-606f7551cc7b/attributes' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prat:r+ - # - # @param product_id [String] the product UUID - # - # @return [OpenStruct] - # - # @example - # - # @custom_attributes = session.products.custom_attributes("57f0ef04-9dac-462f-9dd4-606f7551cc7b") - # - def custom_attributes(product_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/attributes") - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product attribute. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/fec3b6f3-83d0-467a-abc5-d51019e57b51/attributes/farbe' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prat:d+ - # - # @param product_id [String] the product UUID - # @param attribute_name [String] the key of custom attribute - # - # @return [OpenStruct] - # - # @example - # - # session.products.delete_custom_attribute("fec3b6f3-83d0-467a-abc5-d51019e57b51", "farbe") - # - def delete_custom_attribute(product_id, attribute_name) - response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}/attributes/#{attribute_name}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update the value of a product attribute. If the specified product attribute doesn’t exist, it will be created with the response as described in {Create product attribute}[http://docs.beyondshop.cloud/#resources-product-attribute-create]. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/82ed44e9-664d-47c0-8b07-09adecfdbf20/attributes/key' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "value" : "green" - # }' - # - # @beyond_api.scopes +prat:u+ - # - # @param product_id [String] the product UUID - # @param attribute_name [String] the key of custom attribute - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "value" : "green" - # } - # - # @custom_attribute = session.products.update_custom_attribute("82ed44e9-664d-47c0-8b07-09adecfdbf20", "key", body) - # - def update_custom_attribute(product_id, attribute_name, body) - response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/attributes/#{attribute_name}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products/images.rb b/lib/beyond_api/resources/products/images.rb deleted file mode 100644 index 329fad2..0000000 --- a/lib/beyond_api/resources/products/images.rb +++ /dev/null @@ -1,229 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductImages - # - # A +POST+ request is used to create an image and add it to a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/7a7d1f18-f760-46a9-b794-dbe5a88c6b44/images' -i -X POST \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "dataUri" : "photostore-2.JPG?hash=8a627f655c68f56dfbbf217ab7d5563281225998", - # "width" : 600, - # "height" : 300 - # }' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param image_uri [String] the image url - # - # @return [OpenStruct] - # - # @example - # body = { - # "data_uri" => "photostore-2.JPG?hash=8a627f655c68f56dfbbf217ab7d5563281225998", - # "width" => 600, - # "height" => 300 - # } - # @image = session.products.add_image("7a7d1f18-f760-46a9-b794-dbe5a88c6b44", body) - # - def add_image(product_id, body) - response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/images", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product image. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/8f5e979e-4a47-47ca-84ce-7c026d623974/images/ac318d53-df29-4f43-9356-d91aed8bdb39' -i -X DELETE \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param image_id [String] the image UUID - # - # @return true - # - # @example - # session.products.delete_image("8f5e979e-4a47-47ca-84ce-7c026d623974", "ac318d53-df29-4f43-9356-d91aed8bdb39") - # - def delete_image(product_id, image_id) - response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}/images/#{image_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the images of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/7f32696a-df56-4380-a91b-fffb97f025b4/images' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @images = session.products.images("7f32696a-df56-4380-a91b-fffb97f025b4", { size: 20, page: 0 }) - # - def images(product_id, params = {}) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/images", params) - - handle_response(response, status) - end - - # A +GET+ request is used to retrieve a single image of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/124c5c94-4e62-410a-8599-e5b29dae3491/images/715f5154-9fde-4213-bcab-41ceaaf8b70e' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param image_id [String] the image UUID - # - # @return [OpenStruct] - # - # @example - # @image = session.products.image("124c5c94-4e62-410a-8599-e5b29dae3491", "715f5154-9fde-4213-bcab-41ceaaf8b70e") - # - def image(product_id, image_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/images/#{image_id}") - - handle_response(response, status) - end - - # A +PUT+ request is used to assign a product image as the default image. The request contains a single URI of the image to assign. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/150015b9-0b9b-45a2-bcfb-f9006b16a8b8/default-image' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d 'http://localhost/products/images/8ef3591c-d05f-4aa1-acf6-950ba51ec4f7' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param image_id [String] the image UUID - # - # @return true - # - # @example - # session.products.set_image_as_default("150015b9-0b9b-45a2-bcfb-f9006b16a8b8", "8ef3591c-d05f-4aa1-acf6-950ba51ec4f7") - # - def set_image_as_default(product_id, image_id) - response, status = BeyondApi::Request.put(@session, "/products/#{product_id}", - "#{@session.api_url}/images/#{image_id}") - - handle_response(response, status, respond_with_true: true) - end - - # A +PUT+ request is used to sort the product images. This is done by passing the self-links of the images to the desired product. The request must contain URIs for all images of the given page. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/3f4b2b56-c22d-4d80-b4ed-d5b33ed161eb/images' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d 'http://localhost/products/3f4b2b56-c22d-4d80-b4ed-d5b33ed161eb/images/c9082802-a0d0-416e-9039-02fa465a027e - # http://localhost/products/3f4b2b56-c22d-4d80-b4ed-d5b33ed161eb/images/78e9993d-8db3-45d8-8f76-6b8f2aea9c45 - # http://localhost/products/3f4b2b56-c22d-4d80-b4ed-d5b33ed161eb/images/9233ee97-5dbb-4c00-a7b2-e1512c69a938' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param images [Array] the image UUIDS - # - # @return true - # - # @example - # body = [ - # "c9082802-a0d0-416e-9039-02fa465a027e", - # "78e9993d-8db3-45d8-8f76-6b8f2aea9c45", - # "9233ee97-5dbb-4c00-a7b2-e1512c69a938" - # ] - # session.products.sort_images("3f4b2b56-c22d-4d80-b4ed-d5b33ed161eb", body) - # - def sort_images(product_id, image_ids) - body = image_ids.map { |image_id| "#{@session.api_url}/products/#{product_id}/images/#{image_id}" } - response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/images", body.join("\n"), {}, 'text/uri-list') - - handle_response(response, status, respond_with_true: true) - end - - # A +POST+ request is used to upload an image and add it to a product. The body of the request must contain the content of the image. - # - # $ curl --data-binary '@/home/epages/file.png' 'https://api-shop.beyondshop.cloud/api/products/4125b993-49fc-47c8-b9b3-76d8871e4e06/images?fileName=file.png' -X POST \ - # -H 'Content-Type: image/png' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param image_path [String] the image path - # @param image_name [String] the image name - # - # @return true - # - # @example - # session.products.upload_image("4125b993-49fc-47c8-b9b3-76d8871e4e06", "/home/epages/file.png", "file.png") - # - def upload_image(product_id, image_path, image_name) - content_type = file_content_type(image_path) - image_binary = File.binread(image_path) - - response, status = BeyondApi::Request.upload(@session, - "/products/#{product_id}/images", - image_binary, - content_type, - { file_name: image_name }) - - handle_response(response, status, respond_with_true: true) - end - - # A +POST+ request is used to upload up to 10 images and add them to a product. The body of the request must contain the content of the images. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/4125b993-49fc-47c8-b9b3-76d8871e4e06/images?fileName=file.png&fileName=file2.png' -i -X POST \ - # -H 'Content-Type: multipart/form-data' \ - # -H 'Authorization: Bearer ' \ - # -F 'image=@/home/epages/file.png' \ - # -F 'image=@/home/epages/file2.png' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param images_path [Array] the images path - # @param images_name [Array] the images name - # - # @return true - # - # @example - # session.products.upload_multiple_images("4125b993-49fc-47c8-b9b3-76d8871e4e06", - # ["/home/epages/file.png", "/home/epages/file2.png"], ["file.png", "file2.png"]) - # - def upload_multiple_images(product_id, images_path, images_name) - response, status = BeyondApi::Request.upload_by_form(@session, - "/products/#{product_id}/images", - images_path, - file_name: images_name.map { |e| URI.encode_www_form([e]) }) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products/searches.rb b/lib/beyond_api/resources/products/searches.rb deleted file mode 100644 index 22d8419..0000000 --- a/lib/beyond_api/resources/products/searches.rb +++ /dev/null @@ -1,113 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductSearches - # - # A +POST+ request is used to search for products by a search term. Optionally, you can also filter the search results. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/search' -i -X POST \ - # -H 'Content-Type: application/hal+json;charset=UTF-8' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # -d '{ - # "search" : { - # "term" : "Tony Highfinger, Poloshirt, Men", - # "category" : "NAME" - # }, - # "filters" : [ { - # "key" : "status", - # "values" : [ "PUBLISHED" ] - # } ], - # "paging" : { - # "page" : 0, - # "pageSize" : 20, - # "sort" : { - # "property" : "name", - # "direction" : "ASC" - # } - # } - # }' - # - # @beyond_api.scopes +prod:r+ - # - # @param body [String] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # search: { - # term: "Tony Highfinger, Poloshirt, Men", - # category: "NAME" - # }, - # filters: [ { - # key: "status", - # values: [ "PUBLISHED" ] - # } ], - # paging: { - # page: 0, - # page_size: 20, - # sort: { - # property: "name", - # direction: "ASC" - # } - # } - # } - # @products = session.product.search(body) - # - def search(body) - response, status = BeyondApi::Request.post(@session, - "/products/search", - body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to search for a product by SKU. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/search/find-by-sku?sku=vino020' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param sku [String] the product sku to search - # - # @return [OpenStruct] - # - # @example - # @product = session.product.search_by_sku("vino020") - # - def search_by_sku(sku) - response, status = BeyondApi::Request.get(@session, "/products/search/find-by-sku", sku: sku) - - handle_response(response, status) - end - - # - # A +GET+ request is used to search used tags by a starting string. All strings are sorted by usage, starting with the biggest. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/search/tags?startsWith=aw' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param starts_with [String] the tag start to search - # @option param [Integer] :size the page size - # @option param [Integer] :page the page numbe - # - # @return [OpenStruct] - # - # @example - # @tags = session.product.search_tags_starting_by("aw") - # - def search_tags_starting_by(starts_with, params = {}) - response, status = BeyondApi::Request.get(@session, "/products/search/tags", - params.merge(starts_with: starts_with)) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products/variation_properties.rb b/lib/beyond_api/resources/products/variation_properties.rb deleted file mode 100644 index b4d4664..0000000 --- a/lib/beyond_api/resources/products/variation_properties.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductVariationProperties - # - # A +PATCH+ request is used to update the variation properties of a variation product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/51953b86-7ccc-4e80-acbd-1a2fc921fc2e/variation-properties' -i -X PATCH \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '[ { - # "property" : "salesPrice", - # "enabled" : true - # }, { - # "property" : "listPrice", - # "enabled" : true - # }, { - # "property" : "refPrice", - # "enabled" : true - # }, { - # "property" : "manufacturerPrice", - # "enabled" : true - # }, { - # "property" : "productIdentifiers", - # "enabled" : true - # } ]' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param body [Array] the request body - # - # @return [OpenStruct] - # - # @example - # body = [{ - # "property": "salesPrice", - # "enabled": true - # }, { - # "property": "listPrice", - # "enabled": true - # }, { - # "property": "refPrice", - # "enabled": true - # }, { - # "property": "manufacturerPrice", - # "enabled": true - # }, { - # "property": "productIdentifiers", - # "enabled": true - # }] - # - # @variation_properties = session.products.update_variation_properties("7f32696a-df56-4380-a91b-fffb97f025b4", body) - # - def update_variation_properties(product_id, body) - response, status = BeyondApi::Request.patch(@session, "/products/#{product_id}/variation-properties", body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the variation properties of a variation product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/ea81446c-8fec-418c-8b3c-6e43fdee713a/variation-properties' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # - # @return [OpenStruct] - # - # @example - # @variation_properties = session.products.variation_properties("7f32696a-df56-4380-a91b-fffb97f025b4") - # - def variation_properties(product_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/variation-properties") - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products/videos.rb b/lib/beyond_api/resources/products/videos.rb deleted file mode 100644 index 11977bd..0000000 --- a/lib/beyond_api/resources/products/videos.rb +++ /dev/null @@ -1,147 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ProductVideos - # - # A +POST+ request is used to create a video and add it to a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/f7716244-568c-4536-bc25-317030f83395/videos' -i -X POST \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "type" : "VIMEO", - # "source" : "https://vimeo.com/7265982" - # }' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "type" => "VIMEO", - # "source" => "https://vimeo.com/7265982" - # } - # @video = session.products.add_video("f7716244-568c-4536-bc25-317030f83395", body) - # - def add_video(product_id, body) - response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/videos", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a product video - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/1cc9ef5e-62b1-43c7-8745-f4aa8be79934/videos/60869f60-1a4b-4013-b86c-00a2ab9ddc2c' -i -X DELETE \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param video_id [String] the video UUID - # - # @return [true] - # - # @example - # session.products.delete_video("1cc9ef5e-62b1-43c7-8745-f4aa8be79934", "60869f60-1a4b-4013-b86c-00a2ab9ddc2c") - # - def delete_video(product_id, video_id) - response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}/videos/#{video_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update a video. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/9d33da61-1f60-4ad3-9de0-2f1dc0910ebb/videos/ef51af21-5381-4ccb-a107-8bfa574d3556' -i -X PUT \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "type" : "VIMEO", - # "source" : "https://vimeo.com/7265982" - # }' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param video_id [String] the video UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "type" => "VIMEO", - # "source" => "https://vimeo.com/7265982" - # } - # @video = session.products.update_video("9d33da61-1f60-4ad3-9de0-2f1dc0910ebb", "ef51af21-5381-4ccb-a107-8bfa574d3556", body) - # - def update_video(product_id, video_id, body) - response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/videos/#{video_id}", body) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve a single video of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/94c3baf9-1390-4bf8-a6c1-fb234533fa14/videos/ada27b8c-ddf0-489a-9143-5bec938c1e17' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param video_id [String] the video UUID - # - # @return [OpenStruct] - # - # @example - # @video = session.products.video("94c3baf9-1390-4bf8-a6c1-fb234533fa14", "ada27b8c-ddf0-489a-9143-5bec938c1e17") - # - def video(product_id, video_id) - response, status = BeyondApi::Request.get(@session, "/products/#{product_id}/videos/#{video_id}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the videos of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/04c6ad65-465d-405e-a428-f73349104b65/videos' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @videos = session.products.videos("04c6ad65-465d-405e-a428-f73349104b65", size: 100, page: 0) - # - def videos(product_id, params = {}) - response, status = BeyondApi::Request.get(@session, - "/products/#{product_id}/videos", - params) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/products_view.rb b/lib/beyond_api/resources/products_view.rb deleted file mode 100644 index b341e2a..0000000 --- a/lib/beyond_api/resources/products_view.rb +++ /dev/null @@ -1,128 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class ProductsView < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all products. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/products' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @products = session.products_view.all(page: 0, size: 100) - # - def all(params = {}) - path = "/product-view/products" - - handle_all_request(path, :products, params) - end - - # - # A +GET+ request is used to list all available tags. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/search/find-available-tags' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @return [OpenStruct] - # - # @example - # @tags = session.products_view.available_tags - # - def available_tags - path = "/product-view/products/search/find-available-tags" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # TODO: To be documented. - # NOTE: 10.4 10.5 and 10.6 are the same call with different response. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/f75f8fb2-5a48-4d94-aad6-3d3692c06472' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param product_id [String] the product UUID - # - # @return [OpenStruct] - # - # @example - # @product = session.products_view.find("f75f8fb2-5a48-4d94-aad6-3d3692c06472") - # - def find(product_id) - path = "/product-view/products/#{product_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to search for products matching any tag of the list given by a client. The intention is to offer product search capabilities for a shop’s storefront. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/search/find-by-tags?tag=number0' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param tag [String] the tag to search - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @products = session.products_view.search_by_tag("number0", {page: 0, size: 100}) - # - def search_by_tag(tag, params = {}) - path = "/product-view/products/search/find-by-tags" - - response, status = BeyondApi::Request.get(@session, - path, - params.merge(tag: tag)) - - handle_response(response, status) - end - - # - # A +GET+ request is used to search for products matching any tag of the list given by a client. The intention is to offer product search capabilities for a shop’s storefront. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/products/search/find-by-term?query=search+snippet' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' - # - # @param term [String] the term to search - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @products = session.products_view.search_by_term("search snippet", {page: 0, size: 100}) - # - def search_by_term(term, params = {}) - path = "/product-view/products/search/find-by-term" - - response, status = BeyondApi::Request.get(@session, - path, - params.merge(query: term)) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/script_tags.rb b/lib/beyond_api/resources/script_tags.rb deleted file mode 100644 index bab9aaa..0000000 --- a/lib/beyond_api/resources/script_tags.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class ScriptTags < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to retrieve a list of all script tags for a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/script-tags' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @option params [Boolean] :paginated - # @option params [Boolean] :only_own - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @script_tags = session.script_tags.all(size: 20, page: 0) - # - def all(params = {}) - path = "/script-tags" - - params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] - - handle_all_request(path, :script_tags, params) - end - - # - # A +GET+ request is used to retrieve a single script tag. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/script-tags/df170ab1-13ae-4955-8b51-2478246acf59' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @param script_tag_id [String] the script tag UUID - # - # @return [OpenStruct] - # - # @example - # @script_tag = session.script_tags.find("df170ab1-13ae-4955-8b51-2478246acf59") - # - def find(script_tag_id) - path = "/script-tags/#{script_tag_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a script tag. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/script-tags' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "scriptUrl": "https://example.org/js/fancy-script.js" - # }' - # - # @beyond_api.scopes +sctg:m+ - # - # @param script_tag_url [String] the url of the script - # - # @return [OpenStruct] - # - # @example - # @script_tag = session.script_tags.create("https://example.org/js/fancy-script.js") - # - def create(script_tag_url) - path = "/script-tags" - - response, status = BeyondApi::Request.post(@session, - path, - { script_url: script_tag_url }) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a script tag. You can only delete a script tag created by your app. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/script-tags/4a9f7776-d74d-4311-8ddb-121bd5407520' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +sctg:m+ - # - # @param script_tag_id [String] the script tag UUID - # - # @return true - # - # @example - # session.script_tags.delete("4a9f7776-d74d-4311-8ddb-121bd5407520") - # - def delete(script_tag_id) - path = "/script-tags/#{script_tag_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update an existing script tag. You can only update a script tag created by your app. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/script-tags/d6c7b3d2-4984-4fa6-b5f2-b0f5cfc63bd3' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "scriptUrl": "https://example.org/scripts/someOtherScript.js" - # }' - # - # @beyond_api.scopes +sctg:m+ - # - # @param script_tag_id [String] the script tag UUID - # @param script_tag_url [String] the url of the script - # - # @return [OpenStruct] - # - # @example - # @script_tag = session.script_tags.create("https://example.org/scripts/someOtherScript.js") - # - def update(script_tag_id, script_tag_url) - path = "/script-tags/#{script_tag_id}" - - response, status = BeyondApi::Request.put(@session, - path, - { script_url: script_tag_url }) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/shipping_zones.rb b/lib/beyond_api/resources/shipping_zones.rb deleted file mode 100644 index 87b996f..0000000 --- a/lib/beyond_api/resources/shipping_zones.rb +++ /dev/null @@ -1,420 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class ShippingZones < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all shipping zones in a paged way. - # - # @beyond_api.scopes +shpz:r+ - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @shipping_zones = session.shipping_zones.all(size: 20, page: 0) - # - def all(params = {}) - path = "/shipping-zones" - - handle_all_request(path, :shipping_zones, params) - end - - # - # A +POST+ request is used to create a shipping zone. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "BE-NL-LU", - # "serviceableCountries" : [ "BE", "NL", "LU" ] - # }' - # - # @beyond_api.scopes +shpz:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "BE-NL-LU", - # "serviceableCountries" => [ "BE", "NL", "LU" ] - # } - # @shipping_zone = session.shipping_zones.create(body) - # - def create(body) - path = "/shipping-zones" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a shipping method in a shipping zone. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/905e981c-1489-45af-9138-0a7dc1f0b085/shipping-methods' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "Standard Shipping 2", - # "description" : "Standard Shipping", - # "taxClass" : "REGULAR", - # "freeShippingValue" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : 400 - # }, - # "fixedPrice" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : "19.99" - # } - # }' - # - # @beyond_api.scopes +shpz:u+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "Standard Shipping 2", - # "description" => "Standard Shipping", - # "taxClass" => "REGULAR", - # "freeShippingValue" => { - # "taxModel" => "GROSS", - # "currency" => "EUR", - # "amount" => 400 - # }, - # "fixedPrice" => { - # "taxModel" => "GROSS", - # "currency" => "EUR", - # "amount" => "19.99" - # } - # } - # @shipping_method = session.shipping_zones.create_shipping_method("905e981c-1489-45af-9138-0a7dc1f0b085", body) - # - def create_shipping_method(shipping_zone_id, body) - path = "/shipping-zones/#{shipping_zone_id}/shipping-methods" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a shipping zone. You cannot delete the shipping zone if it contains the last shipping method of a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/c871b402-b6d9-4c6d-b76c-440f61175805' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpz:d+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # - # @return true - # - # @example - # session.shipping_zones.delete("c871b402-b6d9-4c6d-b76c-440f61175805") - # - def delete(shipping_zone_id) - path = "/shipping-zones/#{shipping_zone_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +DELETE+ request is used to delete a shipping method in a shipping zone. You cannot delete the last shipping method of a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/61c14c3c-ce26-4524-9713-f2ede7ff22fa/shipping-methods/d2eee203-a1c6-4035-8e7a-74bb77cfde47' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpz:u+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # @param shipping_method_id [String] the shipping method UUID - # - # @return true - # - # @example - # session.shipping_zones.delete_shipping_method("61c14c3c-ce26-4524-9713-f2ede7ff22fa", "d2eee203-a1c6-4035-8e7a-74bb77cfde47") - # - def delete_shipping_method(shipping_zone_id, shipping_method_id) - path = "/shipping-zones/#{shipping_zone_id}/shipping_methods/#{shipping_method_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a shipping zone. - # - # @beyond_api.scopes +shpz:r+ - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/27914098-c1f6-46aa-9e78-c7ac873e25b3' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @param shipping_zone_id [String] the shipping zone UUID - # - # @return [OpenStruct] - # - # @example - # @shipping_zone = session.shipping_zones.find("27914098-c1f6-46aa-9e78-c7ac873e25b3") - # - def find(shipping_zone_id) - path = "/shipping-zones/#{shipping_zone_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to find the serviceable countries. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/search/find-all-serviceable-countries' -i -X GET \ - # -H 'Accept: application/hal+json' - # - # @return [OpenStruct] - # - # @example - # @serviceable_countries = session.shipping_zones.find_serviceable_countries - # - def find_serviceable_countries - path = "/shipping-zones/search/find-all-serviceable-countries" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # A +GET+ request is used to retrieve the details of a shipping method in a shipping zone. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/61780dd6-0150-4fcf-953c-d10c52bab4ab/shipping-methods/13bd1fc9-706c-4774-923a-484a41aaab89' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpz:r+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # @param shipping_method_id [String] the shipping method UUID - # - # @return [OpenStruct] - # - # @example - # @shipping_method = session.shipping_zones.shipping_method("61780dd6-0150-4fcf-953c-d10c52bab4ab", "13bd1fc9-706c-4774-923a-484a41aaab89") - # - def shipping_method(shipping_zone_id, shipping_method_id) - path = "/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all shipping-methods of a shipping zone in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/8cc24465-3573-4eca-8323-b076bb724080/shipping-methods' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpz:r+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @shipping_methods = session.shipping_zones.shipping_methods("8cc24465-3573-4eca-8323-b076bb724080", { size: 20, page: 0 }) - # - def shipping_methods(shipping_zone_id, params = {}) - path = "/shipping-zones/#{shipping_zone_id}/shipping-methods" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to sort the shipping zones. This is done by passing the self-links of the shipping zones in the desired order.all - # The request must contain URIs for all shipping zones of the given page. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Authorization: Bearer ' \ - # -d 'https://api-shop.beyondshop.cloud/api/shipping-zones/9fa80513-be11-494f-ac01-61832e0d7808 - # https://api-shop.beyondshop.cloud/api/shipping-zones/f0911d4c-1ab0-4bbd-88e3-cb675cbb7da7 - # https://api-shop.beyondshop.cloud/api/shipping-zones/ef2e7cb7-820e-4d62-b361-12240f635164' - # - # @beyond_api.scopes +shpz:u+ - # - # @param shipping_zone_ids [Array] the list of shipping zone UUIDs - # - # @return [OpenStruct] - # - # @example - # shipping_zone_ids = ["9fa80513-be11-494f-ac01-61832e0d7808", "f0911d4c-1ab0-4bbd-88e3-cb675cbb7da7", "ef2e7cb7-820e-4d62-b361-12240f635164"] - # session.shipping_zones.sort(shipping_zone_ids) - # - def sort(shipping_zone_ids) - path = "/shipping-zones" - - body = shipping_zone_ids.map { |id| "#{session.api_url}/shipping-zones/#{id}" } - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to sort the shipping methods inside a shipping zone. - # This is done by passing the self-links of the shipping methods in the desired order. The request must contain URIs for all shipping methods of this shipping zone. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/e54af33b-fadc-4524-8eec-7e0b3e20f625/shipping-methods' -i -X PUT \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shpz:r+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # - # @return [OpenStruct] - # - # @example - # session.shipping_zones.sort_shipping_methods(shipping_zone_id) - # - def sort_shipping_methods(shipping_zone_id) - path = "/shipping-zones/#{shipping_zone_id}/shipping-methods" - - response, status = BeyondApi::Request.put(@session, - path) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update a shipping zone. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/727b3cbf-01b1-442a-bd5c-94c51901f090' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "BENELUX region", - # "serviceableCountries" : [ "BE", "NL", "LU", "DE" ] - # }' - # - # @beyond_api.scopes +shpz:u+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # @param body [String] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "BENELUX region", - # "serviceableCountries" => [ "BE", "NL", "LU", "DE" ] - # } - # @shipping_zone = session.shipping_zones.update("727b3cbf-01b1-442a-bd5c-94c51901f090", body) - # - def update(shipping_zone_id, body) - path = "/shipping-zones/#{shipping_zone_id}" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update a shipping method in a shipping zone. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/c4137d8b-3dd1-4b73-91f0-32f1433c8195/shipping-methods/25df7018-a7a2-4903-85fa-6a3a73ae40b2' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "Express", - # "description" : "Shipping overnight. Delivery on the next day.", - # "taxClass" : "REGULAR", - # "freeShippingValue" : { - # "currency" : "EUR", - # "amount" : 200 - # }, - # "fixedPrice" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : 25 - # } - # }' - # - # @beyond_api.scopes +shpz:u+ - # - # @param shipping_zone_id [String] the shipping zone UUID - # @param shipping_method_id [String] the shipping method UUID - # @param body [String] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" : "Express", - # "description" : "Shipping overnight. Delivery on the next day.", - # "taxClass" : "REGULAR", - # "freeShippingValue" : { - # "currency" : "EUR", - # "amount" : 200 - # }, - # "fixedPrice" : { - # "taxModel" : "GROSS", - # "currency" : "EUR", - # "amount" : 25 - # } - # } - # @shipping_method = session.shipping_zones.update_shipping_method("c4137d8b-3dd1-4b73-91f0-32f1433c8195", "25df7018-a7a2-4903-85fa-6a3a73ae40b2", body) - # - def update_shipping_method(shipping_zone_id, shipping_method_id, body) - path = "/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/shop.rb b/lib/beyond_api/resources/shop.rb deleted file mode 100644 index 2bc9b02..0000000 --- a/lib/beyond_api/resources/shop.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - autoload :ShopAddress, "beyond_api/resources/shops/address" - autoload :ShopAttributes, "beyond_api/resources/shops/attributes" - autoload :ShopImages, "beyond_api/resources/shops/images" - autoload :ShopLegals, "beyond_api/resources/shops/legals" - autoload :ShopLocations, "beyond_api/resources/shops/locations" - - class Shop < Base - include BeyondApi::ShopAddress - include BeyondApi::ShopAttributes - include BeyondApi::ShopImages - include BeyondApi::ShopLegals - include BeyondApi::ShopLocations - include BeyondApi::Utils - - # - # A +GET+ request is used to retrieve the details of a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop' -i -X GET \ - # -H 'Accept: application/hal+json' - # - # @return [OpenStruct] - # - # @example - # session.shop.current - # - def current - path = "/shop" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +PATCH+ request is used to change attributes of a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop' -i -X PATCH \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "anotherName", - # "primaryHostname" : "cornershop.amazingdiscounts.xyz", - # "fallbackHostname" : "cornershop.beyondshop.cloud", - # "tax" : { - # "taxModel" : "GROSS", - # "vatExempted" : false - # }, - # "currencies" : [ "EUR", "USD", "GBP" ], - # "defaultCurrency" : "USD", - # "locales" : [ "en-GB", "de-DE" ], - # "defaultLocale" : "en-GB", - # "closedByMerchant" : false - # }' - # - # @beyond_api.scopes +shop:u+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "anotherName", - # "primary_hostname" => "cornershop.amazingdiscounts.xyz", - # "fallback_hostname" => "cornershop.beyondshop.cloud", - # "tax" => { - # "taxModel" => "GROSS", - # "vatExempted" => false - # }, - # "currencies" => [ "EUR", "USD", "GBP" ], - # "default_currency" => "USD", - # "locales" => [ "en-GB", "de-DE" ], - # "default_locale" => "en-GB", - # "closed_by_merchant" => false - # } - # - # session.shop.update(body) - # - def update(body) - path = "/shop" - - response, status = BeyondApi::Request.patch(@session, - path, - body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/shops/address.rb b/lib/beyond_api/resources/shops/address.rb deleted file mode 100644 index e477b0a..0000000 --- a/lib/beyond_api/resources/shops/address.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ShopAddress - # - # A +GET+ request is used to retrieve the details of a shop’s address. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/address' -i -X GET - # - # @return [OpenStruct] - # - # @example - # session.shop.address - # - def address - response, status = BeyondApi::Request.get(@session, "/shop/address") - - handle_response(response, status) - end - - # - # A +PATCH+ request is used to patch a shop’s address partially with json content type. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/address' -i -X PATCH \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "city" : "Barcelona" - # }' - # - # @beyond_api.scopes +shad:u+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "city" => "Barcelona" - # } - # - # session.shop.update_address(body) - # - def update_address(body) - response, status = BeyondApi::Request.patch(@session, "/shop/address", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/shops/attributes.rb b/lib/beyond_api/resources/shops/attributes.rb deleted file mode 100644 index 6986a11..0000000 --- a/lib/beyond_api/resources/shops/attributes.rb +++ /dev/null @@ -1,136 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ShopAttributes - # - # A +GET+ request is used to retrieve a particular shop attribute by its name. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/attributes/second-unknown-attribute-name' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shat:r+ - # - # @param attribute_name [String] the attribute name - # - # @return [OpenStruct] - # - # @example - # @shop_attribute = session.shop.attribute("second-unknown-attribute-name") - # - def attribute(attribute_name) - response, status = BeyondApi::Request.get(@session, "/shop/attributes/#{attribute_name}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve a list of all shop attributes. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/attributes' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shat:r+ - # - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @shop_attributes = session.shop.attributes(size: 5, page: 1) - # - def attributes(params = {}) - response, status = BeyondApi::Request.get(@session, "/shop/attributes", params) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a shop attribute. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/attributes' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "name" : "second-unknown-attribute-name", - # "value" : "correct-value", - # "public" : false - # }' - # - # @beyond_api.scopes +shat:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "name" => "second-unknown-attribute-name", - # "value" => "correct-value", - # "public" => false - # } - # - # session.shop.create_attribute(body) - # - def create_attribute(body) - response, status = BeyondApi::Request.post(@session, "/shop/attributes", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete an shop attribute. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/attributes/second-unknown-attribute-name' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shat:d+ - # - # @param attribute_name [String] the attribute name - # - # @return true - # - # @example - # session.shop.delete_attribute("second-unknown-attribute-name") - # - def delete_attribute(attribute_name) - response, status = BeyondApi::Request.delete(@session, "/shop/attributes/#{attribute_name}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used to update a shop attribute. This operation is idempotent and will create a new shop attribute if required. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/attributes/second-unknown-attribute-name' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "value" : "new-value", - # "public" : false - # }' - # - # @beyond_api.scopes +shat:u+ - # - # @param attribute_name [String] the attribute name - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "value" => "new-value", - # "public" => false - # } - # - # session.shop.update_attribute("second-unknown-attribute-name", body) - # - def update_attribute(attribute_name, body) - response, status = BeyondApi::Request.put(@session, "/shop/attributes/#{attribute_name}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/shops/images.rb b/lib/beyond_api/resources/shops/images.rb deleted file mode 100644 index 2bf289e..0000000 --- a/lib/beyond_api/resources/shops/images.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ShopImages - # - # A +POST+ request is used to create a shop image. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/images' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "dataUri" : "file.png?hash=212-2323-4343", - # "label" : "logo" - # }' - # - # @beyond_api.scopes +shim:c+ - # - # @param body [Hash] the request body - # - # @return true - # - # @example - # body = { - # "data_uri" => "file.png?hash=212-2323-4343", - # "label" => "logo" - # } - # - # session.shop.create_image(body) - # - def create_image(body) - response, status = BeyondApi::Request.post(@session, "/shop/images", body) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +DELETE+ request is used to delete a shop image. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/images/6a7646dc-7f26-4730-a98f-52f9b63978fb' -i -X DELETE \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shim:d+ - # - # @param image_id [String] the image UUID - # - # @return true - # - # @example - # session.shop.delete_image("6a7646dc-7f26-4730-a98f-52f9b63978fb") - # - def delete_image(image_id) - response, status = BeyondApi::Request.delete(@session, "/shop/images/#{image_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve a single shop image. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/images/2feee7ac-f1cb-4faf-9488-f3ce07394141' -i -X GET \ - # -H 'Accept: application/hal+json' - # - # @param image_id [String] the image UUID - # - # @return [OpenStruct] - # - # @example - # @image = session.shop.image("2feee7ac-f1cb-4faf-9488-f3ce07394141") - # - def image(image_id) - response, status = BeyondApi::Request.get(@session, "/shop/images/#{image_id}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the images of a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/images' -i -X GET \ - # -H 'Accept: application/hal+json' - # - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @images = session.shop.images(size: 5, page: 1) - # - def images(params = {}) - response, status = BeyondApi::Request.get(@session, "/shop/images", params) - - handle_response(response, status) - end - - # - # A +GET+ request is issued to search for shop images by label. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/images/search/find-by-label?label=logo' -i -X GET \ - # -H 'Accept: application/hal+json' - # - # @param label [String] the image label - # - # @return [OpenStruct] - # - # @example - # session.shop.search_images_by_label("logo") - # - def search_images_by_label(label) - response, status = BeyondApi::Request.get(@session, "/shop/images/search/find-by-label", { label: label }) - - handle_response(response, status) - end - - # - # A +POST+ request is used to upload a shop image. The body of the request must contain the content of the image. - # - # $ curl --data-binary '@/home/epages/sample.png' 'https://api-shop.beyondshop.cloud/api/shop/images?fileName=sample.png&label=invoice logo' -X POST \ - # -H 'Content-Type: image/png' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +shim:c+ - # - # @param image_path [String] the image path - # @param image_name [String] the image name - # @param label [String] the image label - # - # @return true - # - # @example - # session.shop.upload_image("/home/epages/sample.png", "sample.png", "invoice logo") - # - def upload_image(image_path, image_name, label) - content_type = case File.extname(image_path) - when ".png" - "image/png" - when ".jpg", ".jpeg" - "image/jpeg" - when ".gif" - "image/gif" - end - image_binary = File.binread(image_path) - - response, status = BeyondApi::Request.upload(@session, - "/shop/images", - image_binary, - content_type, - { file_name: image_name, label: label }) - - handle_response(response, status, respond_with_true: true) - end - end -end diff --git a/lib/beyond_api/resources/shops/legals.rb b/lib/beyond_api/resources/shops/legals.rb deleted file mode 100644 index e324d87..0000000 --- a/lib/beyond_api/resources/shops/legals.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ShopLegals - # - # A +GET+ request is used to retrieve a specific part of the legal content information. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/legal-content/right-of-withdrawal' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' - # - # @param legal_content_type [String] the legal content type - # - # @return [OpenStruct] - # - # @example - # @legal_content = session.shop.legal_content("right-of-withdrawal") - # - def legal_content(legal_content_type) - response, status = BeyondApi::Request.get(@session, - "/legal-content/#{legal_content_type}") - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the legal content of a shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/legal-content' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' - # - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @legal_content = session.shop.legal_contents(size: 5, page: 1) - # - def legal_contents(params = {}) - response, status = BeyondApi::Request.get(@session, - "/legal-content", - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the details of the legal resource. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/legal' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +legl:r+ - # - # @return [OpenStruct] - # - # @example - # @legal_details = session.shop.legal_details - # - def legal_details - response, status = BeyondApi::Request.get(@session, - "/shop/legal") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update the content of a specific part of the legal content information. Changes on the properties type and mandatory will be ignored. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/legal-content/legal-notice' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "content" : "new legal content" - # }' - # - # @beyond_api.scopes +lcnt:u+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # session.shop.update_legal_content(body) - # - def update_legal_content(body) - response, status = BeyondApi::Request.put(@session, - "/legal-content/legal-notice", - body) - - handle_response(response, status) - end - - # - # A +PATCH+ request is used to update a legal resource partially with json content type. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/shop/legal' -i -X PATCH \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "vatId" : "GB 111111111" - # }' - # - # @beyond_api.scopes +legl:u+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "vat_id" => "GB 111111111" - # } - # - # session.shop.update_legal_details(body) - # - def update_legal_details(body) - response, status = BeyondApi::Request.patch(@session, - "/shop/legal", - body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/shops/locations.rb b/lib/beyond_api/resources/shops/locations.rb deleted file mode 100644 index 92e4217..0000000 --- a/lib/beyond_api/resources/shops/locations.rb +++ /dev/null @@ -1,251 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module ShopLocations - # - # A +GET+ request is used to retrieve a list of all locations for the current shop. - # - # $ curl 'https://yourshop.api.urn/shop/locations' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +loca:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @locations = session.shop.locations(size: 100, page: 0) - # - def locations(params = {}) - handle_all_request("/shop/locations", :locations, params) - end - - # - # A +POST+ request is used to create a location. - # - # $ curl 'https://yourshop.api.urn/shop/locations' -i -X POST \ - # -H 'Content-Type: application/json;charset=UTF-8' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "languageCode" : "de", - # "storeCode" : "", - # "locationName" : "HealthyThings", - # "primaryPhone" : "01522 3097093", - # "address" : { - # "locality" : "Hamburg", - # "postalCode" : "20253", - # "regionCode" : "DE", - # "addressLines" : [ "Pilatuspool 2", "ePages GmbH" ] - # }, - # "primaryCategory" : { - # "categoryId" : "gcid:store", - # "displayName" : "Geschaeft" - # }, - # "websiteUrl" : "", - # "regularHours" : { - # "periods" : [ { - # "openDay" : "MONDAY", - # "openTime" : "18:00", - # "closeDay" : "TUESDAY", - # "closeTime" : "03:00" - # }, { - # "openDay" : "WEDNESDAY", - # "openTime" : "17:00", - # "closeDay" : "WEDNESDAY", - # "closeTime" : "23:00" - # } ] - # }, - # "latLng" : { - # "latitude" : 53.5847424, - # "longitude" : 9.968901 - # } - # }' - # - # @beyond_api.scopes +loca:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "languageCode" => "de", - # "storeCode" => "", - # "locationName" => "HealthyThings", - # "primaryPhone" => "01522 3097093", - # "address" => { - # "locality" => "Hamburg", - # "postalCode" => "20253", - # "regionCode" => "DE", - # "addressLines" => [ "Pilatuspool 2", "ePages GmbH" ] - # }, - # "primaryCategory" => { - # "categoryId" => "gcid:store", - # "displayName" => "Geschaeft" - # }, - # "websiteUrl" => "", - # "regularHours" => { - # "periods" => [ { - # "openDay" => "MONDAY", - # "openTime" => "18:00", - # "closeDay" => "TUESDAY", - # "closeTime" => "03:00" - # }, { - # "openDay" => "WEDNESDAY", - # "openTime" => "17:00", - # "closeDay" => "WEDNESDAY", - # "closeTime" => "23:00" - # } ] - # }, - # "latLng" : { - # "latitude" => 53.5847424, - # "longitude" => 9.968901 - # } - # } - # @location = session.shop.create_location(body) - # - def create_location(body) - response, status = BeyondApi::Request.post(@session, "/shop/locations", body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a location. - # - # $ curl 'https://yourshop.api.urn/shop/locations/5bcf7c0a-d130-4cf8-af0c-5e57d4605be0' -i -X DELETE \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +loca:d+ - # - # @param location_id [String] the location UUID - # - # @return true - # - # @example - # session.shop.delete_location("f461fb56-1984-4ade-bd4e-007c273cc923") - # - def delete_location(location_id) - response, status = BeyondApi::Request.delete(@session, "/shop/locations/#{location_id}") - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve a particular location by its id. - # - # $ curl 'https://yourshop.api.urn/shop/locations/09ca2715-cdf7-4af3-8b22-9ecf39d1e202' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +loca:r+ - # - # @param location_id [String] the location UUID - # - # @return [OpenStruct] - # - # @example - # @location = session.shop.location("27a94b71-9b17-4f06-9596-fbbf4d18021f") - # - def location(location_id) - response, status = BeyondApi::Request.get(@session, "/shop/locations/#{location_id}") - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update a location. - # - # $ curl 'https://yourshop.api.urn/shop/locations/a7a2acfa-0243-4e52-8b56-81cb781ce61d' -i -X PUT \ - # -H 'Content-Type: application/json;charset=UTF-8' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "languageCode" : "en", - # "storeCode" : "", - # "locationName" : "UnhealthyThings", - # "primaryPhone" : "01234 691997", - # "address" : { - # "locality" : "London", - # "postalCode" : "1", - # "regionCode" : "GB", - # "addressLines" : [ "St. James Square", "ePages Ltd" ] - # }, - # "primaryCategory" : { - # "categoryId" : "gcid:store", - # "displayName" : "Shop" - # }, - # "websiteUrl" : "", - # "regularHours" : { - # "periods" : [ { - # "openDay" : "SATURDAY", - # "openTime" : "06:00", - # "closeDay" : "SATURDAY", - # "closeTime" : "22:00" - # } ] - # }, - # "latLng" : { - # "latitude" : 51.5072, - # "longitude" : -0.1353 - # } - # }' - # - # @beyond_api.scopes +loca:u+ - # - # @param location_id [String] the location UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "languageCode" => "de", - # "storeCode" => "", - # "locationName" => "HealthyThings", - # "primaryPhone" => "01522 3097093", - # "address" => { - # "locality" => "Hamburg", - # "postalCode" => "20253", - # "regionCode" => "DE", - # "addressLines" => [ "Pilatuspool 2", "ePages GmbH" ] - # }, - # "primaryCategory" => { - # "categoryId" => "gcid:store", - # "displayName" => "Geschaeft" - # }, - # "websiteUrl" => "", - # "regularHours" => { - # "periods" => [ { - # "openDay" => "MONDAY", - # "openTime" => "18:00", - # "closeDay" => "TUESDAY", - # "closeTime" => "03:00" - # }, { - # "openDay" => "WEDNESDAY", - # "openTime" => "17:00", - # "closeDay" => "WEDNESDAY", - # "closeTime" => "23:00" - # } ] - # }, - # "latLng" : { - # "latitude" => 53.5847424, - # "longitude" => 9.968901 - # } - # } - # @location = session.shop.update_location("27a94b71-9b17-4f06-9596-fbbf4d18021f", body) - # - def update_location(location_id, body) - response, status = BeyondApi::Request.put(@session, "/shop/locations/#{location_id}", body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/signers.rb b/lib/beyond_api/resources/signers.rb deleted file mode 100644 index 02a92c3..0000000 --- a/lib/beyond_api/resources/signers.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class Signers < Base - include BeyondApi::Utils - - # - # A +GET+ request is used to list all signers. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/signers' -i -X GET \ - # H 'Accept: application/hal+json' \ - # H 'Authorization: Bearer ' - # - # @return [OpenStruct] - # - # @example - # @signers = session.signers.all - # - def all - path = "/signers" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a signer. You cannot create more than five signers. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/signers' -i -X POST \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @return [OpenStruct] - # - # @example - # @signer = session.signers.create - # - def create - path = "/signers" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a signer. If at least one signer has been created, you cannot delete the last signer. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/signers/6bb72afd-340e-439a-9990-eef2e0883e1e' -i -X DELETE \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @return [OpenStruct] - # - # @example - # session.signers.delete("6bb72afd-340e-439a-9990-eef2e0883e1e") - # - def delete(signer_id) - path = "/signers/#{signer_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - end -end diff --git a/lib/beyond_api/resources/users.rb b/lib/beyond_api/resources/users.rb deleted file mode 100644 index dd270d9..0000000 --- a/lib/beyond_api/resources/users.rb +++ /dev/null @@ -1,436 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class Users < Base - include BeyondApi::Utils - - # - # A +POST+ request is used to add the roles of a user. - # - # @beyond_api.scopes +user:r+, +user:u+ - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/ac186856-59c4-4d78-a444-8c47ff623525/roles' -i -X POST \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Authorization: Bearer ' \ - # -d 'https://api-shop.beyondshop.cloud/api/roles/4553f87f-d232-4bf6-8e15-34c373661e82' - # - # @param user_id [String] the user UUID - # @param body [Hash] the request body - # - # @return true - # - # @example - # session.users.add_roles(user_id, body) - # - def add_roles(user_id, body) - path = "/users/#{user_id}/roles" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to list all users visible to the current user. This request will not list the support user. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:r+ - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @users = session.users.all(size: 100, page: 0) - # - def all(params = {}) - path = "/users" - - handle_all_request(path, :users, params) - end - - # - # A +POST+ request is used to change the password of a user. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/e112b1fe-5f67-4e22-a3c7-a1f6d1891b22/change-password' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "currentPassword" : "GoodPassword01!;)", - # "newPassword" : "ValidPassword123" - # }' - # - # @beyond_api.scopes ++ - # - # @param user_id [String] the user UUID - # @param current_password [String] the current password - # @param new_password [String] the new password - # - # @return [OpenStruct] - # - # @example - # session.users.change_password(user_id, current_password, new_password) - # - def change_password(user_id, current_password, new_password) - path = "/users/#{user_id}/change-password" - - response, status = BeyondApi::Request.post(@session, - path, - current_password: current_password, - new_password: new_password) - - handle_response(response, status) - end - - # - # A +POST+ request is used to change the username of a user. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/ea0ddc0b-e3fb-47c7-9133-e9f5fc0ec442/change-username' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "currentPassword" : "GoodPassword01!;)", - # "newUsername" : "new username" - # }' - # - # @param user_id [String] the user UUID - # @param new_username [String] the new username - # @param current_password [String] the current password - # - # @return [OpenStruct] - # - # @example - # session.users.change_username(user_id, new_username, current_password) - # - def change_username(user_id, new_username, current_password) - path = "/users/#{user_id}/change-username" - - response, status = BeyondApi::Request.post(@session, - path, - new_username: new_username, - current_password: current_password) - - handle_response(response, status) - end - - # - # A +POST+ request is used to create a user. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "username" : "user", - # "password" : "GoodPassword01!;)", - # "email" : "baxter@example.org" - # }' - # - # @beyond_api.scopes +user:c+ - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "username" => "user", - # "password" => "GoodPassword01!;)", - # "email" => "baxter@example.org" - # } - # @user = session.users.create(body) - # - def create(body) - path = "/users" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to enable support access for a shop. If enabled, the customer support will receive specific rights for direct support in the merchant’s cockpit. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/support' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:c+ - # - # @return true - # - # @example - # session.users.enable_support_access - # - def enable_support_access - path = "/users/support" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to disable support access. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/support' -i -X DELETE \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:c+ - # - # @return true - # - # @example - # session.users.disable_support_access - # - def disable_support_access - path = "/users/support" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a user. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/e4b528ce-bb9e-4cc5-95e1-7dadfa4cf0f3' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:r+ - # - # @param user_id [String] the user UUID - # - # @return [OpenStruct] - # - # @example - # @user = session.users.find("e4b528ce-bb9e-4cc5-95e1-7dadfa4cf0f3") - # - def find(user_id) - path = "/users/#{user_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to list all roles of a user. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/0d4bd0a5-94dc-498e-b6a6-305c619bb20d/roles' -i -X GET \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:r+ - # - # @param user_id [String] the user UUID - # - # @return [OpenStruct] - # - # @example - # @roles = session.users.roles("0d4bd0a5-94dc-498e-b6a6-305c619bb20d") - # - def roles(user_id) - path = "/users/#{user_id}/roles" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to find a user by username. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/search/find-by-username?username=username' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:r+ - # - # @param username [String] the user username - # - # @return [OpenStruct] - # - # @example - # @user = session.users.search_by_username(username) - # - def search_by_username(username) - path = "/users/search/find-by-username" - - response, status = BeyondApi::Request.get(@session, - path, - username: username) - - handle_response(response, status) - end - - # - # A +POST+ request is used to trigger an email address change. A confirmation email to change the email address will be sent to the user. The confirmation email will contain a link to the email address change page of the merchant’s cockpit. The link includes a JWT to authorize the email address change. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/8f5fd817-0ea1-4550-b4b9-fc437b1b6905/change-email-request?locale=en-US' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "currentPassword" : "GoodPassword01!;)", - # "newEmail" : "newEmail@Gmail.com" - # }' - # - # @beyond_api.scopes ++ - # - # @param user_id [String] the user UUID - # @param new_email [String] the new email address - # @param current_password [String] the current password - # @param locale [String] the email locale - # - # @return true - # - # @example - # session.users.send_email_address_change(user_id, new_email, current_password, locale) - # - def send_email_address_change(user_id, new_email, current_password, locale) - path = "/users/#{user_id}/change-email-request" - - response, status = BeyondApi::Request.post(@session, - path, - { new_email: new_email, current_password: current_password }, - { locale: locale }) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to trigger a password reset email to be sent to a user. The email will contain a link to the change password settings page of the merchant’s cockpit. The link includes a JWT to authorize the password reset. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/reset-password-request?locale=en-US' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -d '{ - # "email" : "customer@host.tld" - # }' - # - # @beyond_api.scopes ++ - # - # @param email [String] the user email - # @param locale [String] the email locale - # - # @return true - # - # @example - # session.users.send_reset_password_email(email, locale) - # - def send_reset_password_email(email, locale) - path = "/users/reset-password-request" - - response, status = BeyondApi::Request.post(@session, - path, - { email: email }, - { locale: locale }) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +PUT+ request is used set the roles of a user. - # - # @beyond_api.scopes +user:u+ - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/cfd08a92-dc96-4947-8142-1b6021177f60/roles' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Authorization: Bearer ' \ - # -d 'https://api-shop.beyondshop.cloud/api/roles/165fee2b-f87e-4f33-b036-14b8d96d927a' - # - # @param user_id [String] the user UUID - # @param body [Hash] the request body - # - # @return true - # - # @example - # session.users.set_roles(user_id, body) - # - def set_roles(user_id, body) - path = "/users/#{user_id}/roles" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the status of the support access for a shop, i.e. if the support user is enabled or disabled for the shop. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/support' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +user:r+ - # - # @return [OpenStruct] - # - # @example - # session.users.support_access - # - def support_access - path = "/users/support" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to verify a password against the password guidelines. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/verify-password?userRole=merchant' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/json' \ - # -d '{ - # "password" : "ValidPassword!" - # }' - # - # @beyond_api.scopes ++ - # - # @param password [String] the password to verify - # - # @return true - # - # @example - # session.users.verify_password(password) - # - def verify_password(password, user_role) - path = "/users/verify-password" - - response, status = BeyondApi::Request.post(@session, - path, - password: password, - user_role: user_role) - - handle_response(response, status, respond_with_true: true) - end - end -end diff --git a/lib/beyond_api/resources/variations.rb b/lib/beyond_api/resources/variations.rb deleted file mode 100644 index 4746f37..0000000 --- a/lib/beyond_api/resources/variations.rb +++ /dev/null @@ -1,162 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - autoload :VariationImages, "beyond_api/resources/variations/images" - autoload :VariationAvailability, "beyond_api/resources/variations/availability" - - class Variations < Base - include BeyondApi::VariationImages - include BeyondApi::VariationAvailability - include BeyondApi::Utils - - # - # A +GET+ request is used to retrieve the variations of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/dc1b5caf-51ea-4fcd-b1ba-0c5128e91d17/variations' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @variations = session.variations.all("dc1b5caf-51ea-4fcd-b1ba-0c5128e91d17", { size: 100, page: 0 }) - # - def all(product_id, params = {}) - path = "/products/#{product_id}/variations" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the variation of a product. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/5f6e426e-c8d9-48ba-9b37-9a8eb6381373/variations/f6e5bb16-af2e-440f-acd3-a883ad3c1922' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # - # @return [OpenStruct] - # - # @example - # @variation = session.variations.find("5f6e426e-c8d9-48ba-9b37-9a8eb6381373", "f6e5bb16-af2e-440f-acd3-a883ad3c1922") - # - def find(product_id, variation_id) - path = "/products/#{product_id}/variations/#{variation_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +PATCH+ request is used to update a variation partially with json content type. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/7cf4b5b1-b141-4869-96d1-4eaee8bf7563/variations/9f93fdd0-2d21-4ea9-b9d7-e9a53edb091b' -i -X PATCH \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "salesPrice" : { - # "taxModel" : "NET", - # "amount" : 8.7, - # "currency" : "EUR" - # }, - # "listPrice" : { - # "taxModel" : "NET", - # "amount" : 10.95, - # "currency" : "EUR" - # }, - # "manufacturerPrice" : { - # "taxModel" : "NET", - # "amount" : 99.95, - # "currency" : "EUR" - # }, - # "refPrice" : { - # "refQuantity" : 1, - # "unit" : "LITER", - # "quantity" : 0.75, - # "price" : { - # "taxModel" : "NET", - # "amount" : 11.6, - # "currency" : "EUR" - # } - # }, - # "sku" : "my-new-sku", - # "productIdentifiers" : [ { - # "type" : "EAN", - # "value" : "9780134308135" - # } ] - # }' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "sales_price" => { - # "taxModel": "NET", - # "amount": 8.7, - # "currency": "EUR" - # }, - # "list_price" => { - # "taxModel": "NET", - # "amount": 10.95, - # "currency": "EUR" - # }, - # "manufacturer_price" => { - # "taxModel": "NET", - # "amount": 99.95, - # "currency": "EUR" - # }, - # "ref_price" => { - # "refQuantity": 1, - # "unit": "LITER", - # "quantity": 0.75, - # "price": { - # "taxModel": "NET", - # "amount": 11.6, - # "currency": "EUR" - # } - # }, - # "sku" => "my-new-sku", - # "product_identifiers" => [{ - # "type": "EAN", - # "value": "9780134308135" - # }] - # } - # - # @variation = session.variations.update("7cf4b5b1-b141-4869-96d1-4eaee8bf7563", "9f93fdd0-2d21-4ea9-b9d7-e9a53edb091b", body) - # - def update(product_id, variation_id, body) - path = "/products/#{product_id}/variations/#{variation_id}" - - response, status = BeyondApi::Request.patch(@session, - path, - body) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/variations/availability.rb b/lib/beyond_api/resources/variations/availability.rb deleted file mode 100644 index fe7871d..0000000 --- a/lib/beyond_api/resources/variations/availability.rb +++ /dev/null @@ -1,117 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module VariationAvailability - # - # A +POST+ request is used to adjust the available stock of a variation. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/9171c3ed-0b53-43ef-8fed-c081f55560f4/variations/a6d8275f-66cd-4cd7-8623-2d005f1ab7fc/availability/adjust-available-stock' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ "relativeAmount" : -1 }' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the product variation UUID - # @param relative_amount [Integer] the relative amount - # - # @return [OpenStruct] - # - # @example - # @availability = session.variations.adjust_stock_level(product_id, variation_id, { relativeAmount => -1 }) - # - def adjust_stock_level(product_id, variation_id, relative_amount) - path = "/products/#{product_id}/variations/#{variation_id}/availability/adjust-available-stock" - - response, status = BeyondApi::Request.post(@session, - path, - relative_amount: relative_amount) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the availability of a variation. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/7fdc9424-1ddd-4fba-a59d-3d5de08d89d1/variations/13b28149-975a-4f47-ad54-bdc4ca4a07ec/availability' -i -X GET \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:r+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the product variation UUID - # - # @return [OpenStruct] - # - # @example - # @availability = session.variations.availability("fb22d408-00dc-47e3-ae58-e35769bdb428", "13b28149-975a-4f47-ad54-bdc4ca4a07ec") - # - def availability(product_id, variation_id) - path = "/products/#{product_id}/variations/#{variation_id}/availability" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to enable purchasability for a variation. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/131400c9-54f1-4510-a0c4-2c7e34c57336/variations/cec06f66-5a80-4638-a74c-c916e1173c21/availability/enable-purchasability' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the product variation UUID - # - # @return [OpenStruct] - # - # @example - # @availability = session.variations.enable_purchaability("1e3a92b-6f3b-4415-bd8f-c9c8921a5a73", "13b28149-975a-4f47-ad54-bdc4ca4a07ec") - # - def enable_purchasability(product_id, variation_id) - path = "/products/#{product_id}/variations/#{variation_id}/availability/enable-purchasability" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status) - end - - # - # A +POST+ request is used to disable purchasability for a variation. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/f3b9d880-b73e-45a4-b04c-e03acae4fcdd/variations/40337e9c-a187-4bb6-9a0d-c8d66386cb8d/availability/disable-purchasability' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prda:u+ - # - # @param product_id [String] the product UUID - # - # @return true - # - # @example - # @availability = session.variations.disable_purchasability("17e3a92b-6f3b-4415-bd8f-c9c8921a5a73", "13b28149-975a-4f47-ad54-bdc4ca4a07ec") - # - def disable_purchasability(product_id, variation_id) - path = "/products/#{product_id}/variations/#{variation_id}/availability/disable-purchasability" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/variations/images.rb b/lib/beyond_api/resources/variations/images.rb deleted file mode 100644 index 82a7801..0000000 --- a/lib/beyond_api/resources/variations/images.rb +++ /dev/null @@ -1,234 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - module VariationImages - # - # A +POST+ request is used to create an image and add it to a variation. The URL of the image will be assigned to the variation. The image URL has to be provided in body of the request. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/a08ca814-52e9-4e00-82a2-3e9b012e5f9d/variations/4b58cdb7-4d3d-419a-ae27-8469f8b04276/images' -i -X POST \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "dataUri" : "photostore-2.JPG?hash=8a627f655c68f56dfbbf217ab7d5563281225998", - # "width" : 100, - # "height" : 200 - # }' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "data_uri" => "photostore-2.JPG?hash=8a627f655c68f56dfbbf217ab7d5563281225998", - # "width" => 100, - # "height" => 200 - # } - # @image = session.variations.add_image("a08ca814-52e9-4e00-82a2-3e9b012e5f9d", "4b58cdb7-4d3d-419a-ae27-8469f8b04276", body) - # - def add_image(product_id, variation_id, body) - path = "/products/#{product_id}/variations/#{variation_id}/images" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +DELETE+ request is used to delete a variation image - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/8f5736f8-0a5f-4c08-bbac-3c524e2a6294/variations/86f3047c-ff29-4906-83c1-93e24ef88f3e/images/193d2ba4-3cf0-4326-a655-ef46e8a97c6a' -i -X DELETE \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param image_id [String] the image UUID - # - # @return [true] - # - # @example - # session.variations.delete_image("8f5736f8-0a5f-4c08-bbac-3c524e2a6294", "86f3047c-ff29-4906-83c1-93e24ef88f3e", "193d2ba4-3cf0-4326-a655-ef46e8a97c6a") - # - def delete_image(product_id, variation_id, image_id) - path = "/products/#{product_id}/variations/#{variation_id}/images/#{image_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve a single image of a variation. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/8665fc36-003e-4120-8a74-a9d6449644ae/variations/9163db42-92e7-418c-a3d8-651e7aaca569/images/86fc2691-5dfb-47e1-aae7-4bc2f658a80b' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param image_id [String] the image UUID - # - # @return [OpenStruct] - # - # @example - # @image = session.variations.image("8665fc36-003e-4120-8a74-a9d6449644ae", "a9163db42-92e7-418c-a3d8-651e7aaca569", "86fc2691-5dfb-47e1-aae7-4bc2f658a80b") - # - def image(product_id, image_id) - path = "/products/#{product_id}/variations/#{variation_id}/images/#{image_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +GET+ request is used to retrieve the images of a variation. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/b4948e53-05af-4e0b-8877-28bc8811f73e/variations/50c5bf45-5dd6-4bae-babf-813c7cdca488/images' -i -X GET \ - # -H 'Content-Type: application/hal+json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:r+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @images = session.variations.images("b4948e53-05af-4e0b-8877-28bc8811f73e", "50c5bf45-5dd6-4bae-babf-813c7cdca488", size: 100, page: 0) - # - def images(product_id, variation_id, params = {}) - path = "/products/#{product_id}/variations/#{variation_id}/images" - - response, status = BeyondApi::Request.get(@session, - path, - params) - - handle_response(response, status) - end - - # A +PUT+ request is used to sort the variation images. This is done by passing the self-links of the images to the desired variation. The request must contain URIs for all images of the given page. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/8a8a7002-f864-4011-9991-d6ffb1bd1085/variations/60c2c2a5-ece0-4d04-b90d-f38ee710961c/images' -i -X PUT \ - # -H 'Content-Type: text/uri-list' \ - # -H 'Authorization: Bearer ' \ - # -d 'https://api-shop.beyondshop.cloud/api/products/8a8a7002-f864-4011-9991-d6ffb1bd1085/variations/60c2c2a5-ece0-4d04-b90d-f38ee710961c/images/a12cae49-3efb-4874-989e-37df6981a4db - # https://api-shop.beyondshop.cloud/api/products/8a8a7002-f864-4011-9991-d6ffb1bd1085/variations/60c2c2a5-ece0-4d04-b90d-f38ee710961c/images/4f562165-968c-42fd-a245-1dcc045f8151 - # https://api-shop.beyondshop.cloud/api/products/8a8a7002-f864-4011-9991-d6ffb1bd1085/variations/60c2c2a5-ece0-4d04-b90d-f38ee710961c/images/93cd0802-15db-4772-b524-e1c4c6c27b77' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param images [Array] the image UUIDS - # - # @return true - # - # @example - # body = [ - # "c9082802-a0d0-416e-9039-02fa465a027e", - # "78e9993d-8db3-45d8-8f76-6b8f2aea9c45", - # "9233ee97-5dbb-4c00-a7b2-e1512c69a938" - # ] - # session.variations.sort_images("3f4b2b56-c22d-4d80-b4ed-d5b33ed161eb", body) - # - def sort_images(product_id, variation_id, image_ids) - body = image_ids.map { |image_id| "#{@session.api_url}/products/#{product_id}/variations/#{variation_id}/images/#{image_id}" } - response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/variations/#{variation_id}/images", body.join("\n"), {}, 'text/uri-list') - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to upload an image to the image storage and assign the URL of the image to the variation. The body of the request must contain the content of the image. - # - # $ curl --data-binary '@/home/epages/file.png' 'https://api-shop.beyondshop.cloud/api/products/4125b993-49fc-47c8-b9b3-76d8871e4e06/variations/d7fecf94-2e57-4122-8c94-a0acd840c111/images?fileName=file.png' -X POST \ - # -H 'Content-Type: image/png' \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param images_path [Array] the images path - # @param images_name [Array] the images name - # - # @return [OpenStruct] - # - # @example - # body = { - # "type" => "VIMEO", - # "source" => "https://vimeo.com/7265982" - # } - # - # session.variations.upload_image("4125b993-49fc-47c8-b9b3-76d8871e4e06", "d7fecf94-2e57-4122-8c94-a0acd840c111", "/home/epages/file.png", "file.png") - # - def upload_image(product_id, variation_id, image_path, image_name) - content_type = file_content_type(image_path) - path = "/products/#{product_id}/variations/#{variation_id}/images" - - image_binary = File.binread(image_path) - - response, status = BeyondApi::Request.upload(@session, - path, - image_binary, - content_type, - { file_name: image_name }) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +POST+ request is used to upload up to 10 images to the image storage and assign the URL of the images to up to 30 variations. The body of the request must contain the content of the images. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/products/4125b993-49fc-47c8-b9b3-76d8871e4e06/variations/images?fileName=file.png&fileName=file2.png&variation=ca53ae26-e7c6-44a4-8070-9fca08cc87ed&variation=ab63fa3a-c2ac-4074-aaa3-b547217b042d' -i -X POST \ - # -H 'Content-Type: multipart/form-data' \ - # -H 'Authorization: Bearer ' \ - # -F 'image=@/home/epages/file.png' \ - # -F 'image=@/home/epages/file2.png' - # - # @beyond_api.scopes +prod:u+ - # - # @param product_id [String] the product UUID - # @param variation_id [String] the variation UUID - # @param images_path [String] the image path - # @param images_name [String] the image name - # - # @return [OpenStruct] - # - # @example - # session.variations.upload_multiple_images("4125b993-49fc-47c8-b9b3-76d8871e4e06", "d7fecf94-2e57-4122-8c94-a0acd840c111", - # ["/home/epages/file.png", "/home/epages/file2.png"], ["file.png", "file2.png"]) - # - def upload_multiple_images(product_id, variation_id, images_path, images_name) - response, status = BeyondApi::Request.upload_by_form(@session, - "/products/#{product_id}/variations/#{variation_id}/images", - images_path, - file_name: images_name.map { |e| URI.encode_www_form([e]) }) - - handle_response(response, status) - end - end -end diff --git a/lib/beyond_api/resources/webhook_subscriptions.rb b/lib/beyond_api/resources/webhook_subscriptions.rb deleted file mode 100644 index eaea331..0000000 --- a/lib/beyond_api/resources/webhook_subscriptions.rb +++ /dev/null @@ -1,197 +0,0 @@ -# frozen_string_literal: true - -require "beyond_api/utils" - -module BeyondApi - class WebhookSubscriptions < Base - include BeyondApi::Utils - - # - # A +POST+ request is used to activate a webhook subscription. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/268a8629-55cd-4890-9013-936b9b5ea14c/activate' -i -X POST \ - # -H 'Authorization: Bearer ' - # - # @beyond_api.scopes +ordr:r+, +prod:r+ - # - # @param webhook_subscription_id [String] the webhook subscription UUID - # - # @return true - # - # @example Ruby example request - # session.webhook_subscriptions.activate("268a8629-55cd-4890-9013-936b9b5ea14c") - # - def activate(webhook_subscription_id) - path = "/webhook-subscriptions/#{webhook_subscription_id}/activate" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to list all of the webhook subscriptions in a paged way. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @option params [Boolean] :paginated - # @option params [Integer] :size the page size - # @option params [Integer] :page the page number - # - # @return [OpenStruct] - # - # @example - # @webhook_subscriptions = session.webhook_subscriptions.all(size: 100, page: 0) - # - def all(params = {}) - path = "/webhook-subscriptions" - - handle_all_request(path, :webhook_subscriptions, params) - end - - # - # A +POST+ request is used to create a webhook subscription. - # - # The scopes needed for the operation depend on the event types you register for. e.g. Order events require the scope +orde:r+. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions' -i -X POST \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "callbackUri":"http://example.com/test", - # "eventTypes": ["order.created", "product.created"] - # }' - # - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "callback_uri" => "http://example.com/test", - # "event_types" => ["order.created", "product.created"] - # } - # - # @webhook_subscription = session.webhook_subscriptions.create(body) - # - def create(body) - path = "/webhook-subscriptions" - - response, status = BeyondApi::Request.post(@session, - path, - body) - - handle_response(response, status) - end - - # - # A +POST+ request is used to deactivate a webhook subscription. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/a597cea4-b688-4164-8c56-b6568ea4d5aa/deactivate' -i -X POST \ - # -H 'Authorization: Bearer ' - # - # @param webhook_subscription_id [String] the webhook subscription UUID - # - # @return true - # - # @example - # session.webhook_subscriptions.deactivate("a597cea4-b688-4164-8c56-b6568ea4d5aa") - # - def deactivate(webhook_subscription_id) - path = "/webhook-subscriptions/#{webhook_subscription_id}/deactivate" - - response, status = BeyondApi::Request.post(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +DELETE+ request is used to delete a webhook subscription. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/c6076a5a-a8ad-443f-b20b-8a1b268b069e' -i -X DELETE \ - # -H 'Authorization: Bearer ' - # - # @param webhook_subscription_id [String] the webhook subscription UUID - # - # @return true - # - # @example - # session.webhook_subscriptions.delete("c6076a5a-a8ad-443f-b20b-8a1b268b069e") - # - def delete(webhook_subscription_id) - path = "/webhook-subscriptions/#{webhook_subscription_id}" - - response, status = BeyondApi::Request.delete(@session, - path) - - handle_response(response, status, respond_with_true: true) - end - - # - # A +GET+ request is used to retrieve the details of a webook subscription. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/3d44ec71-768c-4927-9069-a96a5153e87c' -i -X GET \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' - # - # @param webhook_subscription_id [String] the webhook subscription UUID - # - # @return [OpenStruct] - # - # @example - # @webhook_subscription = session.webhook_subscriptions.find("3d44ec71-768c-4927-9069-a96a5153e87c") - # - def find(webhook_subscription_id) - path = "/webhook-subscriptions/#{webhook_subscription_id}" - - response, status = BeyondApi::Request.get(@session, - path) - - handle_response(response, status) - end - - # - # A +PUT+ request is used to update a subscription. - # - # The scopes needed for the operation depend on the event types you register for. e.g. Order events require the scope +orde:r+. - # - # $ curl 'https://api-shop.beyondshop.cloud/api/webhook-subscriptions/6f3bc033-c2d1-4f44-80e3-1b668f6bd699' -i -X PUT \ - # -H 'Content-Type: application/json' \ - # -H 'Accept: application/hal+json' \ - # -H 'Authorization: Bearer ' \ - # -d '{ - # "callbackUri":"http://example.com/test/updated", - # "eventTypes": ["product.updated"] - # }' - # - # @beyond_api.scopes +ordr:r+, +prod:r+ - # - # @param webhook_subscription_id [String] the webhook subscription UUID - # @param body [Hash] the request body - # - # @return [OpenStruct] - # - # @example - # body = { - # "callback_uri" => "http://example.com/test/updated", - # "event_types" => ["product.updated"] - # } - # - # @webhook_subscription = session.webhook_subscriptions.update("6f3bc033-c2d1-4f44-80e3-1b668f6bd699", body) - # - def update(webhook_subscription_id, body) - path = "/webhook-subscriptions/#{webhook_subscription_id}" - - response, status = BeyondApi::Request.put(@session, - path, - body) - - handle_response(response, status) - end - end -end From 4b5ff930324b83cc75270b482b6645dd1271b509 Mon Sep 17 00:00:00 2001 From: citin Date: Fri, 9 Aug 2024 11:38:02 +0200 Subject: [PATCH 27/59] update gem config and some linters --- .rubocop.yml | 4 +++ .ruby-version | 2 +- Gemfile | 3 +- Gemfile.lock | 30 +++++++++--------- beyond_api.gemspec | 27 ++++++++-------- lib/beyond_api.rb | 44 +++++---------------------- lib/beyond_api/all_pages_handler.rb | 6 ++-- lib/beyond_api/concerns/connection.rb | 2 +- lib/beyond_api/configuration.rb | 30 ++++++++++++++++++ spec/spec_helper.rb | 16 +++------- 10 files changed, 82 insertions(+), 82 deletions(-) create mode 100644 lib/beyond_api/configuration.rb diff --git a/.rubocop.yml b/.rubocop.yml index 1af1fa2..255afa0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -32,3 +32,7 @@ Style/AsciiComments: Style/SymbolArray: EnforcedStyle: brackets + +# disable Gemspec/DevelopmentDependencies +Gemspec/DevelopmentDependencies: + Enabled: false diff --git a/.ruby-version b/.ruby-version index 944880f..a0891f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.0 +3.3.4 diff --git a/Gemfile b/Gemfile index 803ec0f..cd70397 100644 --- a/Gemfile +++ b/Gemfile @@ -8,9 +8,10 @@ gemspec gem "pry" group :development do - gem 'ruby-lsp' + gem "rubocop" end group :test do gem "factory_bot" + gem "webmock" end diff --git a/Gemfile.lock b/Gemfile.lock index b665caa..0615575 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,12 +19,17 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) bigdecimal (3.1.8) coderay (1.1.3) concurrent-ruby (1.3.3) connection_pool (2.4.1) + crack (1.0.0) + bigdecimal + rexml diff-lcs (1.5.1) dotenv (2.8.1) drb (2.2.1) @@ -39,6 +44,7 @@ GEM net-http faraday-retry (2.2.1) faraday (~> 2.0) + hashdiff (1.1.1) i18n (1.14.5) concurrent-ruby (~> 1.0) json (2.7.2) @@ -53,15 +59,13 @@ GEM parser (3.3.4.0) ast (~> 2.4.1) racc - prism (0.30.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) + public_suffix (6.0.1) racc (1.8.1) rainbow (3.1.1) rake (10.5.0) - rbs (3.5.2) - logger regexp_parser (2.9.2) rexml (3.3.4) strscan @@ -95,8 +99,6 @@ GEM rubocop (~> 1.41) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) - rubocop-ordered_methods (0.12) - rubocop (>= 1.0) rubocop-rspec (2.31.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -104,18 +106,16 @@ GEM rubocop-rspec_rails (~> 2.28) rubocop-rspec_rails (2.29.1) rubocop (~> 1.61) - ruby-lsp (0.17.11) - language_server-protocol (~> 3.17.0) - prism (>= 0.29.0, < 0.31) - rbs (>= 3, < 4) - sorbet-runtime (>= 0.5.10782) ruby-progressbar (1.13.0) - sorbet-runtime (0.5.11514) strscan (3.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) uri (0.13.0) + webmock (3.23.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) yard (0.9.36) zeitwerk (2.6.17) @@ -124,6 +124,7 @@ PLATFORMS x86_64-darwin-22 DEPENDENCIES + activesupport beyond_api! bundler (~> 2.0) dotenv (~> 2.7) @@ -132,11 +133,10 @@ DEPENDENCIES pry rake (~> 10.0) rspec (~> 3.0) - rubocop (~> 1.20) - rubocop-ordered_methods (~> 0.9) + rubocop rubocop-rspec (~> 2.4) - ruby-lsp + webmock yard (~> 0.9) BUNDLED WITH - 2.4.8 + 2.5.17 diff --git a/beyond_api.gemspec b/beyond_api.gemspec index e614dfc..8e6a1cb 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -7,8 +7,7 @@ require "beyond_api/version" Gem::Specification.new do |spec| spec.name = "beyond_api" spec.version = BeyondApi::VERSION - spec.authors = ["Unai Abrisketa", "Kathia Salazar", "German San Emeterio", "Kenneth Gallego"] - + spec.authors = ["Unai Abrisketa", "Kathia Salazar", "German San Emeterio", "Kenneth Gallego", "Andrés Bernardi"] spec.summary = "Ruby client to access the Beyond API" spec.homepage = "https://github.com/ePages-de/beyond_api-ruby_client" @@ -19,19 +18,21 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.5.1" + spec.required_ruby_version = ">= 3.0" - spec.add_development_dependency "bundler", "~> 2.0" - spec.add_development_dependency "dotenv", "~> 2.7" - spec.add_development_dependency "faker", "~> 2.2" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "rubocop", "~> 1.20" - spec.add_development_dependency "rubocop-ordered_methods", "~> 0.9" - spec.add_development_dependency "rubocop-rspec", "~> 2.4" - spec.add_development_dependency "yard", "~> 0.9" + spec.add_development_dependency "bundler", "~> 2.0" + spec.add_development_dependency "dotenv", "~> 2.7" + spec.add_development_dependency "faker", "~> 2.2" + spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rspec", "~> 3.0" + spec.add_development_dependency "rubocop", "~> 1.20" + spec.add_development_dependency "rubocop-rspec", "~> 2.4" + spec.add_development_dependency "yard", "~> 0.9" - spec.add_dependency "zeitwerk" + spec.add_dependency "activesupport", "~> 7.0.0" spec.add_dependency "faraday", "~> 2.10.0" spec.add_dependency "faraday-retry" + spec.add_dependency "zeitwerk" + + spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 3270bc0..a6da35e 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true -require 'zeitwerk' -require 'faraday' -require 'faraday/retry' -require 'json' -require 'forwardable' +require "active_support/all" +require "faraday" +require "faraday/retry" +require "forwardable" +require "json" +require "zeitwerk" module BeyondApi loader = Zeitwerk::Loader.for_gem @@ -16,40 +17,11 @@ module BeyondApi class << self attr_accessor :configuration - + def setup self.configuration ||= Configuration.new - - yield configuration - end - end - - class Configuration - attr_accessor :client_id, :client_secret, - :open_timeout, :timeout, - :log_headers, :log_bodies, :log_level, - :all_pagination_size, :retry_options - def initialize - @client_id = nil - @client_secret = nil - @open_timeout = 2 - @timeout = 5 - - @log_level = :info - @log_headers = false - @log_bodies = false - - @all_pagination_size = 200 - - @retry_options = { - max: 3, - interval: 0.05, - interval_randomness: 0.5, - backoff_factor: 2, - retry_statuses: [409], - exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed] - } + yield configuration end end end diff --git a/lib/beyond_api/all_pages_handler.rb b/lib/beyond_api/all_pages_handler.rb index 99ba7ed..9e1a5e5 100644 --- a/lib/beyond_api/all_pages_handler.rb +++ b/lib/beyond_api/all_pages_handler.rb @@ -35,7 +35,7 @@ def fetch_page(page) get(@url, @params.merge(page:, size: BeyondApi.configuration.all_pagination_size)) end - def process_page(page) + def process_page(page) page_data = fetch_page(page) @response[:embedded][@resource_key].concat( @@ -48,5 +48,5 @@ def update_response_page_info @response[:page][:total_pages] = 1 @response[:page][:number] = 0 end - end -end + end +end diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 11dfb62..ba13cd9 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -3,7 +3,7 @@ module BeyondApi module Concerns module Connection - LOGGER = BeyondApi.logger + LOGGER = BeyondApi.logger LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") def get(path, params = {}) diff --git a/lib/beyond_api/configuration.rb b/lib/beyond_api/configuration.rb new file mode 100644 index 0000000..76671db --- /dev/null +++ b/lib/beyond_api/configuration.rb @@ -0,0 +1,30 @@ +module BeyondApi + class Configuration + attr_accessor :client_id, :client_secret, + :open_timeout, :timeout, + :log_headers, :log_bodies, :log_level, + :all_pagination_size, :retry_options + + def initialize + @client_id = nil + @client_secret = nil + @open_timeout = 2 + @timeout = 5 + + @log_level = :info + @log_headers = false + @log_bodies = false + + @all_pagination_size = 200 + + @retry_options = { + max: 3, + interval: 0.05, + interval_randomness: 0.5, + backoff_factor: 2, + retry_statuses: [409], + exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed] + } + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a2f6a4d..aababc9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,18 +31,10 @@ session.products.delete(product.id) end end - - AppRoot = File.expand_path(File.dirname("ext.rb")) - - load "#{AppRoot}/lib/beyond_api/ext.rb" end -unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil? - BeyondApi.setup do |config| - config.client_id = ENV["CLIENT_ID"] - config.client_secret = ENV["CLIENT_SECRET"] - config.remove_response_links = false - config.remove_response_key_underscores = true - config.object_struct_responses = true - end +BeyondApi.setup do |config| + config.client_id = ENV["CLIENT_ID"] + config.client_secret = ENV["CLIENT_SECRET"] end + From 4128c2bdce380387cc8ab5c49fb1d3980ddc94e4 Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 13 Aug 2024 12:46:54 +0200 Subject: [PATCH 28/59] Update README.md --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 130a2d3..0398ee4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Beyond API Ruby Client +Ruby toolkit for the [ePages API](https://developer.epages.com/beyond-docs/#introduction) + ![Gem Version](https://img.shields.io/gem/v/beyond_api?label=gem%20version) [![Docs](https://img.shields.io/badge/docs-rubydoc-blue)](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client) [![Maintainability](https://api.codeclimate.com/v1/badges/1d173fa0b393e8eaf2a2/maintainability)](https://codeclimate.com/github/ePages-de/beyond_api-ruby_client/maintainability) @@ -18,7 +20,7 @@ Log in to the cockpit of your test shop, navigate to **Apps > Custom apps** and Fill out the form with the **App name**, **Application Callback URL** and **App scopes**. Save your app. -You will then receive your `client_id` and `client_secret`. +You will then receive your `client_id` and `client_secret` that you will use in the next step. ## Installation @@ -50,6 +52,52 @@ To install the gem manually from your shell, run: $ gem install beyond_api ``` +## Generating tokens + +API methods can be accessed through the client instance methods. This gem supports the various authentication methods supported by the ePages API. + +```ruby +# Initializing the client +client = BeyondApi::Token.new(api_url: 'https://team42.beyondshop.cloud/api', client_id: '', client_secret: '') +``` +## Generate a token from [client credentials](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_client_credentials) + +```ruby +client = client.client_credentials + +# => {:access_token=> "", :token_type=>"bearer", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc", :tenant_id=>1147, :iat=>1723477546, :jti=>"mqXCnX/q/vStoJO69q68x1gw61c="} +``` + +## Generate a token from [authorization code](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_authorization_code) + +```ruby +client = client.get('1nBfq_') + +# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> + "orde:r prat:dcur pypr:cur prod:urdc", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} +``` + +## Generate a token from [refresh token](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_refresh_token) + +```ruby +client = client.refresh_token('') + +# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> + "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} +``` + +## Making requests + +After generating your token following the instructions above, you can start using this gem to access various resources available, including categories, products, orders, webhooks, and more. + +``` +client = BeyondApi::ProductManagement::Category.new(api_url: ENV["API_URL"], access_token: '') + +# Retrieve all categories +client.all +# => {:embedded=>{:categories=>[{:id=>"539c1671-1540-4254-adaf-8b22b188d6d2", :name=>"New Category", :type=>"SMART", :default_sort=>"HIGHEST_PRICE_FIRST", :filters=>[], :links=> {:self=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}, :category=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}}}]}, :links=>{:self=>{:href=>"https://team42.beyondshop.cloud/api/categories?page=0&size=20"}}, :page=>{:size=>20, :total_elements=>9, :total_pages=>1, :number=>0}} +``` + ## Documentation See [GETTING_STARTED](https://github.com/ePages-de/beyond_api-ruby_client/blob/master/GETTING_STARTED.md) for information on consuming the Beyond API. From ca15e5685b8c39aaa2e6d9aaf2fbcc2a12bbcff1 Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 13 Aug 2024 12:49:38 +0200 Subject: [PATCH 29/59] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0398ee4..ff813c6 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,7 @@ client = client.get('1nBfq_') ```ruby client = client.refresh_token('') -# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> - "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} +# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} ``` ## Making requests @@ -95,6 +94,7 @@ client = BeyondApi::ProductManagement::Category.new(api_url: ENV["API_URL"], acc # Retrieve all categories client.all + # => {:embedded=>{:categories=>[{:id=>"539c1671-1540-4254-adaf-8b22b188d6d2", :name=>"New Category", :type=>"SMART", :default_sort=>"HIGHEST_PRICE_FIRST", :filters=>[], :links=> {:self=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}, :category=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}}}]}, :links=>{:self=>{:href=>"https://team42.beyondshop.cloud/api/categories?page=0&size=20"}}, :page=>{:size=>20, :total_elements=>9, :total_pages=>1, :number=>0}} ``` From 381f4d6c1230de008e9603f69a5d49452054358e Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 13 Aug 2024 12:57:05 +0200 Subject: [PATCH 30/59] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff813c6..804fd6f 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ client = client.refresh_token('') After generating your token following the instructions above, you can start using this gem to access various resources available, including categories, products, orders, webhooks, and more. -``` +```ruby client = BeyondApi::ProductManagement::Category.new(api_url: ENV["API_URL"], access_token: '') # Retrieve all categories From a10d159c6c42d7e42fc2f9488009491bd09f8b5b Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 13 Aug 2024 17:22:57 +0200 Subject: [PATCH 31/59] update dependencies definition --- Gemfile.lock | 2 +- beyond_api.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0615575..89fcb53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: . specs: beyond_api (0.24.2.pre) + activesupport (~> 7.0) faraday (~> 2.10.0) faraday-retry zeitwerk @@ -124,7 +125,6 @@ PLATFORMS x86_64-darwin-22 DEPENDENCIES - activesupport beyond_api! bundler (~> 2.0) dotenv (~> 2.7) diff --git a/beyond_api.gemspec b/beyond_api.gemspec index 8e6a1cb..bafe560 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rubocop-rspec", "~> 2.4" spec.add_development_dependency "yard", "~> 0.9" - spec.add_dependency "activesupport", "~> 7.0.0" + spec.add_dependency "activesupport", "~> 7.0" spec.add_dependency "faraday", "~> 2.10.0" spec.add_dependency "faraday-retry" spec.add_dependency "zeitwerk" From ff670414e86e56257327e6388a305a1ad59ee29a Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 13 Aug 2024 17:44:03 +0200 Subject: [PATCH 32/59] adds error handling --- lib/beyond_api/concerns/connection.rb | 62 +++++++++---------- lib/beyond_api/error.rb | 42 ++----------- lib/beyond_api/response.rb | 29 ++++----- .../services/authentication/token.rb | 10 +-- 4 files changed, 51 insertions(+), 92 deletions(-) diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index ba13cd9..8bdd68e 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -7,47 +7,43 @@ module Connection LOGGER.level = Kernel.const_get("::Logger::#{BeyondApi.configuration.log_level.to_s.upcase}") def get(path, params = {}) - parsed_response agent.get(path, parsed_request(params)) + handle_request { agent.get(path, parse_request(params)) } end def post(path, body = {}, params = {}) - response = agent.post(path, body) do |request| - request.params = parsed_request(params) - request.body = parsed_request(body) + handle_request do + agent.post(path, body) do |request| + request.params = parse_request(params) + request.body = parse_request(body) + end end - - parsed_response response end def delete(path, params = {}) - parsed_response agent.delete(path, parsed_request(params)) + handle_request { agent.delete(path, parse_request(params)) } end private - def parsed_response(response) - Response.new(response).handle - end - - def parsed_request(hash) + def parse_request(hash) return hash unless @camelize_keys Utils.camelize_keys(hash) end + def handle_request + Response.new(yield).parse + rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e + raise FaradayError, e + end + def agent @agent ||= Faraday.new(url: @session.api_url, ssl: { verify: true }) do |faraday| # Timeouts faraday.options.timeout = BeyondApi.configuration.timeout.to_i faraday.options.open_timeout = BeyondApi.configuration.open_timeout.to_i # Authorization - case @authorization - when :basic - faraday.request :authorization, :basic, BeyondApi.configuration.client_id, - BeyondApi.configuration.client_secret - when :bearer - faraday.request :authorization, "Bearer", @session.access_token - end + faraday.request :authorization, *authorization_config # Headers faraday.headers["Accept"] = "application/json" # Set default accept header faraday.headers["Content-Type"] = "application/json" # Set default content type @@ -60,24 +56,22 @@ def agent end end - def apply_filters(logger) - logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') - logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') + def authorization_config + case @authorization + when :basic + [:basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret] + when :bearer + ["Bearer", @session.access_token] + end end - # def multipart - # create_connection do |faraday| - # faraday.adapter Faraday.default_adapter - # faraday.request :multipart, flat_encode: true - # end - # end - def logger_config - [ - LOGGER, - { bodies: BeyondApi.configuration.log_bodies, - headers: BeyondApi.configuration.log_headers } - ] + [LOGGER, { bodies: BeyondApi.configuration.log_bodies, headers: BeyondApi.configuration.log_headers }] + end + + def apply_filters(logger) + logger.filter(/(code=)([a-zA-Z0-9]+)/, '\1[FILTERED]') + logger.filter(/(refresh_token=)([a-zA-Z0-9.\-\_]+)/, '\1[FILTERED]') end end end diff --git a/lib/beyond_api/error.rb b/lib/beyond_api/error.rb index 771c719..498cb6c 100644 --- a/lib/beyond_api/error.rb +++ b/lib/beyond_api/error.rb @@ -1,45 +1,15 @@ # frozen_string_literal: true module BeyondApi - class FaradayError < StandardError - def initialize(data, code) - @data = data - @code = code - end - - def to_json - { - data:, - code: - } - end - end - class Error < StandardError - attr_reader :error_id, :details, :trace_id, :full_message, :status_code, :error, :error_description - - def initialize(data, status_code = nil) - @error_id = data["errorId"] - @details = data["details"] - @trace_id = data["traceId"] - @error = data["error"] - @error_description = data["error_description"] - @full_message = data - @status_code = status_code + attr_reader :response - super(data["message"] || data["error_description"]) - end + def initialize(response) + @response = response - def to_json - { - error_id: @error_id, - message: @message, - details: @details, - error: @error, - error_description: @error_description, - trace_id: @trace_id, - status_code: @status_code - } + super end end + + class FaradayError < Error; end end diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 746f494..88caf24 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -10,39 +10,32 @@ def initialize(response) @response = response end - def handle + def parse success? ? parsed_response : raise_error end private - # TODO: benchmark this ! def parsed_response return {} if body.blank? - remove_initial_underscore_keys! - snake_case_keys! - deep_symbolize_keys! + body.deep_transform_keys! do |key| + key = remove_initial_underscore(key) + key = snake_case_key(key) + key.to_sym + end end - def remove_initial_underscore_keys! - body.deep_transform_keys!{ |key| remove_initial_underscore(key) } - end - - def snake_case_keys! - body.deep_transform_keys!{ |key| key.to_s.underscore } - end - - def deep_symbolize_keys! - body.deep_symbolize_keys! + def remove_initial_underscore(key) + key.to_s.starts_with?("_") ? key[1..] : key end - def remove_initial_underscore(key) - key.starts_with?('_') ? key[1..-1] : key + def snake_case_key(key) + key.to_s.underscore end def raise_error - raise Error.new(body, status) + raise Error, parsed_response end end end diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb index 9f52e32..464453c 100644 --- a/lib/beyond_api/services/authentication/token.rb +++ b/lib/beyond_api/services/authentication/token.rb @@ -1,11 +1,13 @@ module BeyondApi module Authentication - class Token + class Token < BaseService include Concerns::Connection # @session, @authorization - def initialize(session = nil) - @session = session + def initialize(**params) + super + @authorization = :basic + @camelize_keys = false end def refresh(refresh_token) @@ -13,7 +15,7 @@ def refresh(refresh_token) end def get(code) - post("oauth/token", {}, { grant_type: "authorization_code" , code: }) + post("oauth/token", {}, { grant_type: "authorization_code", code: }) end def client_credentials From 4602916077a9b46d9e3bad0d1639e38e93f40ef8 Mon Sep 17 00:00:00 2001 From: Kathia Date: Wed, 14 Aug 2024 10:33:04 +0200 Subject: [PATCH 33/59] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 804fd6f..e010932 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,7 @@ client = client.client_credentials ```ruby client = client.get('1nBfq_') -# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> - "orde:r prat:dcur pypr:cur prod:urdc", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} +# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} ``` ## Generate a token from [refresh token](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_refresh_token) From 72606fe5d23b2ef6cb630d6dcd9926ecb5b2b5af Mon Sep 17 00:00:00 2001 From: k4th Date: Thu, 15 Aug 2024 07:51:52 +0200 Subject: [PATCH 34/59] Add tests --- Gemfile | 2 + Gemfile.lock | 24 +- bin/console | 3 - lib/beyond_api/concerns/connection.rb | 9 + .../services/product_management/category.rb | 16 ++ .../services/authentication/token_spec.rb | 32 +++ .../product_management/category_spec.rb | 71 +++++ spec/spec_helper.rb | 15 +- spec/support/vcr.rb | 41 +++ .../refreshes_the_token.yml | 67 +++++ ...retrieves_token_via_authorization_code.yml | 61 +++++ ...retrieves_token_via_client_credentials.yml | 66 +++++ .../_all/returns_all_categories.yml | 150 ++++++++++ .../_create/creates_a_new_category.yml | 187 +++++++++++++ .../_destroy/deletes_a_category.yml | 247 +++++++++++++++++ .../_find/returns_a_category.yml | 256 ++++++++++++++++++ .../_update/updates_an_existing_category.yml | 256 ++++++++++++++++++ 17 files changed, 1482 insertions(+), 21 deletions(-) create mode 100644 spec/beyond_api/services/authentication/token_spec.rb create mode 100644 spec/beyond_api/services/product_management/category_spec.rb create mode 100644 spec/support/vcr.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml diff --git a/Gemfile b/Gemfile index cd70397..a46f237 100644 --- a/Gemfile +++ b/Gemfile @@ -13,5 +13,7 @@ end group :test do gem "factory_bot" + gem "jwt" + gem "vcr" gem "webmock" end diff --git a/Gemfile.lock b/Gemfile.lock index 89fcb53..9ea306e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,23 +10,24 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.1.3.4) + activesupport (7.2.0) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) bigdecimal (3.1.8) coderay (1.1.3) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crack (1.0.0) bigdecimal @@ -49,15 +50,16 @@ GEM i18n (1.14.5) concurrent-ruby (~> 1.0) json (2.7.2) + jwt (2.8.2) + base64 language_server-protocol (3.17.0.3) logger (1.6.0) method_source (1.1.0) minitest (5.24.1) - mutex_m (0.2.0) net-http (0.4.1) uri - parallel (1.25.1) - parser (3.3.4.0) + parallel (1.26.2) + parser (3.3.4.2) ast (~> 2.4.1) racc pry (0.14.2) @@ -68,7 +70,7 @@ GEM rainbow (3.1.1) rake (10.5.0) regexp_parser (2.9.2) - rexml (3.3.4) + rexml (3.3.5) strscan rspec (3.13.0) rspec-core (~> 3.13.0) @@ -108,11 +110,13 @@ GEM rubocop-rspec_rails (2.29.1) rubocop (~> 1.61) ruby-progressbar (1.13.0) + securerandom (0.3.1) strscan (3.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) uri (0.13.0) + vcr (6.2.0) webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -130,11 +134,13 @@ DEPENDENCIES dotenv (~> 2.7) factory_bot faker (~> 2.2) + jwt pry rake (~> 10.0) rspec (~> 3.0) rubocop rubocop-rspec (~> 2.4) + vcr webmock yard (~> 0.9) diff --git a/bin/console b/bin/console index ce7d2fa..89df3af 100755 --- a/bin/console +++ b/bin/console @@ -9,9 +9,6 @@ unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil? BeyondApi.setup do |config| config.client_id = ENV["CLIENT_ID"] config.client_secret = ENV["CLIENT_SECRET"] - config.remove_response_links = true - config.remove_response_key_underscores = true - config.object_struct_responses = false end end diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 8bdd68e..806a3b9 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -10,6 +10,15 @@ def get(path, params = {}) handle_request { agent.get(path, parse_request(params)) } end + def put(path, body = {}, params = {}) + handle_request do + agent.put(path, body) do |request| + request.params = parse_request(params) + request.body = parse_request(body) + end + end + end + def post(path, body = {}, params = {}) handle_request do agent.post(path, body) do |request| diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index a2c4058..8e27ebe 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -4,6 +4,22 @@ class Category < BaseService def find(id) get("categories/#{id}") end + + def all(params = {}) + fetch_all_pages("categories", params) + end + + def create(body) + post("categories", body) + end + + def update(id, body) + put("categories/#{id}", body) + end + + def destroy(id) + delete("categories/#{id}") + end end end end diff --git a/spec/beyond_api/services/authentication/token_spec.rb b/spec/beyond_api/services/authentication/token_spec.rb new file mode 100644 index 0000000..388a5be --- /dev/null +++ b/spec/beyond_api/services/authentication/token_spec.rb @@ -0,0 +1,32 @@ +RSpec.describe 'BeyondApi::Authentication::Token', vcr: true do + let(:client) do + BeyondApi::Authentication::Token.new( + api_url: ENV["API_URL"], + client_id: ENV["CLIENT_ID"], + client_secret: ENV["CLIENT_SECRET"] + ) + end + + it "retrieves token via client credentials" do + response = client.client_credentials + expect(response).not_to be nil + expect(response[:access_token].class).to be(String) + expect(response[:refresh_token]).to be(nil) + end + + it "retrieves token via authorization code" do + expect { + response = client.get('abcde') + }.to raise_error(BeyondApi::Error) do |error| + expect(error.response[:error]).to eq("invalid_grant") + expect(error.response[:error_description]).to eq("Invalid authorization code: abcde") + end + end + + it "refreshes the token" do + response = client.refresh(ENV["REFRESH_TOKEN"]) + expect(response).not_to be nil + expect(response[:access_token].class).to be(String) + expect(response[:refresh_token].class).to be(String) + end +end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb new file mode 100644 index 0000000..af4eb5a --- /dev/null +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -0,0 +1,71 @@ +RSpec.describe 'BeyondApi::ProductManagement::Category', vcr: true do + before do + @client = BeyondApi::ProductManagement::Category.new( + api_url: ENV["API_URL"], + access_token: auth_client.client_credentials[:access_token] + ) + end + + describe ".all" do + it "returns all categories" do + response = @client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :categories)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with category" do + before(:each) do + @category = @client.create( + name: "Team42 Category", + type: "SMART", + default_sort: "HIGHEST_PRICE_FIRST" + ) + end + + describe ".find" do + it "returns a category" do + response = @client.find(@category[:id]) + expect(response[:name]).to eq("Team42 Category") + end + end + + describe ".create" do + it "creates a new category" do + expect(@category).not_to be nil + expect(@category[:name]).to eq("Team42 Category") + expect(@category[:type]).to eq("SMART") + expect(@category[:default_sort]).to eq("HIGHEST_PRICE_FIRST") + end + end + + describe ".update" do + it "updates an existing category" do + updated_category_data = { + name: "Updated Test Category", + type: "SMART", + default_sort: "LOWEST_PRICE_FIRST" + } + + updated_category = @client.update(@category[:id], updated_category_data) + expect(updated_category).not_to be nil + expect(updated_category[:name]).to eq("Updated Test Category") + expect(updated_category[:default_sort]).to eq("LOWEST_PRICE_FIRST") + end + end + + describe ".destroy" do + it "deletes a category" do + response = @client.destroy(@category[:id]) + expect(response).to be {} + end + end + + after(:each) do + @client.destroy(@category[:id]) + rescue BeyondApi::Error + end + end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aababc9..fdee6d3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,15 +22,9 @@ FactoryBot.find_definitions end - config.after(:suite) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - - products = session.products.all - products.embedded.products.each do |product| - session.products.delete(product.id) - end - end + AppRoot = File.expand_path(File.dirname("vcr.rb")) + + load "#{AppRoot}/spec/support/vcr.rb" end BeyondApi.setup do |config| @@ -38,3 +32,6 @@ config.client_secret = ENV["CLIENT_SECRET"] end +def auth_client + BeyondApi::Authentication::Token.new(api_url: ENV["API_URL"]) +end diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb new file mode 100644 index 0000000..a64f116 --- /dev/null +++ b/spec/support/vcr.rb @@ -0,0 +1,41 @@ +require "jwt" +require "vcr" + +VCR.configure do |config| + config.cassette_library_dir = "spec/vcr_cassettes" + config.hook_into :webmock + config.configure_rspec_metadata! + config.ignore_localhost = true + config.default_cassette_options = { + match_requests_on: [ :method, :uri, :body ] + } + + config.filter_sensitive_data("") do |interaction| + authorizations = interaction.request.headers["Authorization"].first + if (match = authorizations.match(/^(Bearer|Basic)\s+([^,\s]+)/)) + match.captures.last + end + end + + config.filter_sensitive_data("") do |interaction| + response_body = JSON.parse(interaction.response.body) + response_body["access_token"] if response_body.is_a?(Hash) + rescue JSON::ParserError + nil + end + + config.filter_sensitive_data("") do |interaction| + response_body = JSON.parse(interaction.response.body) + response_body["refresh_token"] if response_body.is_a?(Hash) + rescue JSON::ParserError + nil + end + + config.filter_sensitive_data("") do |interaction| + ENV["REFRESH_TOKEN"] + end + + config.filter_sensitive_data("") do |interaction| + JWT.encode({ exp: (DateTime.now + 1.year).to_i }, nil, "HS256") + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml new file mode 100644 index 0000000..2b60320 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=refresh_token&refresh_token= + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:20 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.075' + X-B3-Traceid: + - c18d2bd93a06719e6588e4467bb349ee + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "refresh_token" : "", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701020, + "jti" : "PmaCtIyee05EfeXa+hPsFx9lHNA=" + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml new file mode 100644 index 0000000..cf69795 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml @@ -0,0 +1,61 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?code=abcde&grant_type=authorization_code + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Thu, 15 Aug 2024 05:50:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 7b2e726e3d43a71295be89159def3075 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "error" : "invalid_grant", + "error_description" : "Invalid authorization code: abcde" + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml new file mode 100644 index 0000000..0fc99a4 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml @@ -0,0 +1,66 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:19 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.095' + X-B3-Traceid: + - 1d24f62f4177873de211bb403233304f + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701019, + "jti" : "Dh7TEvFcW6H+YC4g0EK6QMBXpRk=" + } + recorded_at: Thu, 15 Aug 2024 05:50:19 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml new file mode 100644 index 0000000..96dbf5e --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml @@ -0,0 +1,150 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:20 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.082' + X-B3-Traceid: + - 7ff3e2bf420f231962f1e03701b7fb4c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701020, + "jti" : "AzUxPPnMSDVwQzlYwq21RqK7Hhc=" + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - ab0c4f8b027b155f7625393937bc7f5b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "categories" : [ { + "_id" : "8a4a8f6a-e3d9-4616-9e89-12c42c084534", + "name" : "DO-NOT-DELETE Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 1, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml new file mode 100644 index 0000000..3dc82e0 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml @@ -0,0 +1,187 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.073' + X-B3-Traceid: + - 372d3ca1e7683a3f7c09cc397164562d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701021, + "jti" : "so7eqPGyCHGcPK7pPPAplw2rfs8=" + } + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - e445c425ef3ec4fc665eed40f2d0e795 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "858904b2-b10e-41ce-8f7b-f45d947541f8", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8" + } + } + } + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.035' + X-B3-Traceid: + - e94b20026dd6d8eddaf88ce320f3e72e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml new file mode 100644 index 0000000..9c745fd --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml @@ -0,0 +1,247 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:22 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - 606cb88d38b8b4554d5af7e25b1c74a7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701022, + "jti" : "aGbiZCt009T6WsRpZJKGG9qyE9k=" + } + recorded_at: Thu, 15 Aug 2024 05:50:22 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 15 Aug 2024 05:50:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.029' + X-B3-Traceid: + - 520802273f52194d6ebdcd88fdc58c10 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "137ceb34-0cf7-4139-a3bf-a82e70a89d0e", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e" + } + } + } + recorded_at: Thu, 15 Aug 2024 05:50:22 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 15 Aug 2024 05:50:22 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.034' + X-B3-Traceid: + - e1e2b024ec648b363314194887e83d37 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 15 Aug 2024 05:50:22 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Thu, 15 Aug 2024 05:50:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.012' + X-B3-Traceid: + - a4088d26abaa83a66d8d978aa7725fb8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "resource-not-found", + "details" : { }, + "message" : "No Category found for '137ceb34-0cf7-4139-a3bf-a82e70a89d0e'", + "traceId" : "a4088d26abaa83a66d8d978aa7725fb8" + } + recorded_at: Thu, 15 Aug 2024 05:50:22 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml new file mode 100644 index 0000000..8ed95ea --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:20 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.081' + X-B3-Traceid: + - 3507e56fa0bd34971c418c20b3d4f1d7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701020, + "jti" : "WwBYg3bre0BOmDWi5RJZOHafF74=" + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 15 Aug 2024 05:50:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.034' + X-B3-Traceid: + - 5affc1e741a9298b0538e310d224698f + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "db518b84-206e-43d6-9622-2c7c766210ef", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" + } + } + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.018' + X-B3-Traceid: + - b17e54f0095a440dc56ece5e54375993 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "db518b84-206e-43d6-9622-2c7c766210ef", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" + } + } + } + recorded_at: Thu, 15 Aug 2024 05:50:20 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - bb2005104a0dac4e67a81c958f0bd58e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml new file mode 100644 index 0000000..67b46db --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.086' + X-B3-Traceid: + - d4b64c9c323ad01623e86c399b796097 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1723701021, + "jti" : "f2uXsKDemqxSVnHCT3aceQOcbQA=" + } + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 05ef4940f2a010a010695eb26ac6868a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "fca1f910-388f-4b2e-9b67-a6dbecef199d", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" + } + } + } + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d + body: + encoding: UTF-8 + string: '{"name":"Updated Test Category","type":"SMART","defaultSort":"LOWEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 15 Aug 2024 05:50:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.045' + X-B3-Traceid: + - 418ac8e9b19b16d33dc4b8309bfe7f78 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "fca1f910-388f-4b2e-9b67-a6dbecef199d", + "name" : "Updated Test Category", + "type" : "SMART", + "defaultSort" : "LOWEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" + } + } + } + recorded_at: Thu, 15 Aug 2024 05:50:21 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 15 Aug 2024 05:50:22 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.034' + X-B3-Traceid: + - 6c17c91d246b6f5eee1ac4c567c7055f + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 15 Aug 2024 05:50:22 GMT +recorded_with: VCR 6.2.0 From 10a1133ccd48e65e375c43eee567cb12dd911eab Mon Sep 17 00:00:00 2001 From: k4th Date: Fri, 16 Aug 2024 13:19:38 +0200 Subject: [PATCH 35/59] Rename variables --- .../services/authentication/token_spec.rb | 14 +++----------- .../services/product_management/category_spec.rb | 16 ++++++++-------- spec/spec_helper.rb | 6 +++++- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/spec/beyond_api/services/authentication/token_spec.rb b/spec/beyond_api/services/authentication/token_spec.rb index 388a5be..6de2055 100644 --- a/spec/beyond_api/services/authentication/token_spec.rb +++ b/spec/beyond_api/services/authentication/token_spec.rb @@ -1,14 +1,6 @@ RSpec.describe 'BeyondApi::Authentication::Token', vcr: true do - let(:client) do - BeyondApi::Authentication::Token.new( - api_url: ENV["API_URL"], - client_id: ENV["CLIENT_ID"], - client_secret: ENV["CLIENT_SECRET"] - ) - end - it "retrieves token via client credentials" do - response = client.client_credentials + response = auth_client.client_credentials expect(response).not_to be nil expect(response[:access_token].class).to be(String) expect(response[:refresh_token]).to be(nil) @@ -16,7 +8,7 @@ it "retrieves token via authorization code" do expect { - response = client.get('abcde') + response = auth_client.get('abcde') }.to raise_error(BeyondApi::Error) do |error| expect(error.response[:error]).to eq("invalid_grant") expect(error.response[:error_description]).to eq("Invalid authorization code: abcde") @@ -24,7 +16,7 @@ end it "refreshes the token" do - response = client.refresh(ENV["REFRESH_TOKEN"]) + response = auth_client.refresh(ENV["REFRESH_TOKEN"]) expect(response).not_to be nil expect(response[:access_token].class).to be(String) expect(response[:refresh_token].class).to be(String) diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index af4eb5a..4322d6c 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -1,6 +1,6 @@ RSpec.describe 'BeyondApi::ProductManagement::Category', vcr: true do - before do - @client = BeyondApi::ProductManagement::Category.new( + let(:client) do + BeyondApi::ProductManagement::Category.new( api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token] ) @@ -8,7 +8,7 @@ describe ".all" do it "returns all categories" do - response = @client.all + response = client.all expect(response).not_to be nil expect(response.dig(:embedded, :categories)).to be_kind_of(Array) @@ -18,7 +18,7 @@ context "with category" do before(:each) do - @category = @client.create( + @category = client.create( name: "Team42 Category", type: "SMART", default_sort: "HIGHEST_PRICE_FIRST" @@ -27,7 +27,7 @@ describe ".find" do it "returns a category" do - response = @client.find(@category[:id]) + response = client.find(@category[:id]) expect(response[:name]).to eq("Team42 Category") end end @@ -49,7 +49,7 @@ default_sort: "LOWEST_PRICE_FIRST" } - updated_category = @client.update(@category[:id], updated_category_data) + updated_category = client.update(@category[:id], updated_category_data) expect(updated_category).not_to be nil expect(updated_category[:name]).to eq("Updated Test Category") expect(updated_category[:default_sort]).to eq("LOWEST_PRICE_FIRST") @@ -58,13 +58,13 @@ describe ".destroy" do it "deletes a category" do - response = @client.destroy(@category[:id]) + response = client.destroy(@category[:id]) expect(response).to be {} end end after(:each) do - @client.destroy(@category[:id]) + client.destroy(@category[:id]) rescue BeyondApi::Error end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fdee6d3..c42004f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,5 +33,9 @@ end def auth_client - BeyondApi::Authentication::Token.new(api_url: ENV["API_URL"]) + BeyondApi::Authentication::Token.new( + api_url: ENV["API_URL"], + client_id: ENV["CLIENT_ID"], + client_secret: ENV["CLIENT_SECRET"] + ) end From e70ca118bf6ff2aceb5dba8ec24bd8be2484e7dc Mon Sep 17 00:00:00 2001 From: Kathia Date: Mon, 19 Aug 2024 08:23:05 +0200 Subject: [PATCH 36/59] Rename destroy endpoint methods to delete (#73) --- lib/beyond_api/services/webhook/subscription.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 349f80f..97d1668 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -15,8 +15,8 @@ def delete_all end end - def destroy(id) - delete("webhook-subscriptions/#{id}") + def delete(id) + Connection.delete("webhook-subscriptions/#{id}") end def find(id) From bbbf7579b7b3a3da60c84459ce4d6168a9d24eb1 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 19 Aug 2024 08:25:49 +0200 Subject: [PATCH 37/59] Update tests --- .../services/authentication/signer.rb | 4 +- .../services/product_management/category.rb | 4 +- .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 6 +- .../services/product_management/variation.rb | 2 +- .../services/storefront/script_tag.rb | 4 +- .../services/authentication/signer_spec.rb | 30 + .../services/authentication/token_spec.rb | 2 +- .../services/checkout/shipping_zone_spec.rb | 13 + .../product_management/category_spec.rb | 45 +- .../services/product_management/image_spec.rb | 13 + .../product_management/product_spec.rb | 36 ++ spec/factories/category_data.rb | 14 + spec/factories/product_data.rb | 103 ++++ .../refreshes_the_token.yml | 67 --- ...retrieves_token_via_authorization_code.yml | 61 -- ...retrieves_token_via_client_credentials.yml | 66 --- .../_all/returns_all_categories.yml | 150 ----- .../_create/creates_a_new_category.yml | 187 ------ .../_destroy/deletes_a_category.yml | 247 -------- .../_find/returns_a_category.yml | 256 -------- .../_update/updates_an_existing_category.yml | 256 -------- .../_all/returns_all_products.yml | 559 ++++++++++++++++++ .../_create/creates_a_new_product.yml | 265 +++++++++ .../with_product/_find/returns_a_product.yml | 460 ++++++++++++++ 25 files changed, 1523 insertions(+), 1329 deletions(-) create mode 100644 spec/beyond_api/services/authentication/signer_spec.rb create mode 100644 spec/beyond_api/services/checkout/shipping_zone_spec.rb create mode 100644 spec/beyond_api/services/product_management/image_spec.rb create mode 100644 spec/beyond_api/services/product_management/product_spec.rb create mode 100644 spec/factories/category_data.rb create mode 100644 spec/factories/product_data.rb delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 2e67b2d..2711809 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -9,8 +9,8 @@ def create post("signers") end - def destroy(id) - delete("signers/#{id}") + def delete(id) + Connection.delete("signers/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 8e27ebe..27602c4 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -17,8 +17,8 @@ def update(id, body) put("categories/#{id}", body) end - def destroy(id) - delete("categories/#{id}") + def delete(id) + Connection.delete("categories/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 72b0cb4..658af3c 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Image < BaseService def all(id, params = {}) - get("products/#{id}/images") + get("products/#{id}/images", params) end end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 1ad5c35..31a6f77 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,7 +2,11 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - fetch_all_pages("/products", params) + fetch_all_pages("products", params) + end + + def create(body) + post("products", body) end def find(id) diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 41ba8b2..1af3319 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Variation < BaseService def all(id, params = {}) - get("products/#{id}/variations") + get("products/#{id}/variations", params) end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 6c5eaed..d3491ca 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -11,8 +11,8 @@ def create(script_url) post("script-tags", script_url:) end - def destroy(id) - delete("script-tags/#{id}") + def delete(id) + Connection.delete("script-tags/#{id}") end end end diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb new file mode 100644 index 0000000..aa310d1 --- /dev/null +++ b/spec/beyond_api/services/authentication/signer_spec.rb @@ -0,0 +1,30 @@ +RSpec.describe BeyondApi::Authentication::Signer, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe '#all' do + it 'returns all signers' do + signers = client.all + + expect(signers.dig(:embedded, :signers)).to be_an(Array) + end + end + + context "with signer" do + before(:each) do + @signer = client.create + end + + describe '#create' do + it 'creates a new signer' do + expect(@signer).to be_a(Hash) + end + end + + describe '#delete' do + it 'deletes a signer' do + response = client.delete(@signer[:id]) + expect(response).to be {} + end + end + end +end \ No newline at end of file diff --git a/spec/beyond_api/services/authentication/token_spec.rb b/spec/beyond_api/services/authentication/token_spec.rb index 6de2055..35d6f4b 100644 --- a/spec/beyond_api/services/authentication/token_spec.rb +++ b/spec/beyond_api/services/authentication/token_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe 'BeyondApi::Authentication::Token', vcr: true do +RSpec.describe BeyondApi::Authentication::Token, vcr: true do it "retrieves token via client credentials" do response = auth_client.client_credentials expect(response).not_to be nil diff --git a/spec/beyond_api/services/checkout/shipping_zone_spec.rb b/spec/beyond_api/services/checkout/shipping_zone_spec.rb new file mode 100644 index 0000000..1e58553 --- /dev/null +++ b/spec/beyond_api/services/checkout/shipping_zone_spec.rb @@ -0,0 +1,13 @@ +RSpec.describe BeyondApi::Checkout::ShippingZone, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".all" do + it "returns all shipping_zones" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :shipping_zones)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end +end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index 4322d6c..a3752b6 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -1,10 +1,5 @@ -RSpec.describe 'BeyondApi::ProductManagement::Category', vcr: true do - let(:client) do - BeyondApi::ProductManagement::Category.new( - api_url: ENV["API_URL"], - access_token: auth_client.client_credentials[:access_token] - ) - end +RSpec.describe BeyondApi::ProductManagement::Category, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } describe ".all" do it "returns all categories" do @@ -18,18 +13,7 @@ context "with category" do before(:each) do - @category = client.create( - name: "Team42 Category", - type: "SMART", - default_sort: "HIGHEST_PRICE_FIRST" - ) - end - - describe ".find" do - it "returns a category" do - response = client.find(@category[:id]) - expect(response[:name]).to eq("Team42 Category") - end + @category = client.create(build(:category_data)) end describe ".create" do @@ -41,31 +25,34 @@ end end + describe ".find" do + it "returns a category" do + response = client.find(@category[:id]) + expect(response[:name]).to eq("Team42 Category") + end + end + describe ".update" do it "updates an existing category" do - updated_category_data = { - name: "Updated Test Category", - type: "SMART", - default_sort: "LOWEST_PRICE_FIRST" - } + updated_category_data = FactoryBot.build(:category_data, :lowest_price_first) updated_category = client.update(@category[:id], updated_category_data) expect(updated_category).not_to be nil - expect(updated_category[:name]).to eq("Updated Test Category") + expect(updated_category[:name]).to eq("Category with lowest price first") expect(updated_category[:default_sort]).to eq("LOWEST_PRICE_FIRST") end end - describe ".destroy" do + describe ".delete" do it "deletes a category" do - response = client.destroy(@category[:id]) + response = client.delete(@category[:id]) expect(response).to be {} end end after(:each) do - client.destroy(@category[:id]) + client.delete(@category[:id]) rescue BeyondApi::Error end end -end \ No newline at end of file +end diff --git a/spec/beyond_api/services/product_management/image_spec.rb b/spec/beyond_api/services/product_management/image_spec.rb new file mode 100644 index 0000000..79c14f1 --- /dev/null +++ b/spec/beyond_api/services/product_management/image_spec.rb @@ -0,0 +1,13 @@ +RSpec.describe BeyondApi::ProductManagement::Image, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".all" do + it "returns all images" do + response = client.all("4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc") + + expect(response).not_to be nil + expect(response.dig(:embedded, :images)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end +end diff --git a/spec/beyond_api/services/product_management/product_spec.rb b/spec/beyond_api/services/product_management/product_spec.rb new file mode 100644 index 0000000..d9b9b90 --- /dev/null +++ b/spec/beyond_api/services/product_management/product_spec.rb @@ -0,0 +1,36 @@ +RSpec.describe BeyondApi::ProductManagement::Product, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".all" do + it "returns all products" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :products)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with product" do + before(:each) do + @product = client.create(build(:product_data)) + end + + describe ".create" do + it "creates a new product" do + expect(@product).not_to be nil + expect(@product[:name]).to eq("Team42 Product") + expect(@product[:essential_features]).to eq("Dry. 12% alcohol. Best vine variety.") + expect(@product[:tags]).to eq(["Bestseller", "Red Wine", "Sale"]) + expect(@product[:product_identifiers]).to eq([{ type: "EAN", value: "9780134308135" }]) + end + end + + describe ".find" do + it "returns a product" do + response = client.find(@product[:id]) + expect(response[:name]).to eq("Team42 Product") + end + end + end +end diff --git a/spec/factories/category_data.rb b/spec/factories/category_data.rb new file mode 100644 index 0000000..116b674 --- /dev/null +++ b/spec/factories/category_data.rb @@ -0,0 +1,14 @@ +FactoryBot.define do + factory :category_data, class: Hash do + name { "Team42 Category" } + type { "SMART" } + default_sort { "HIGHEST_PRICE_FIRST" } + + trait :lowest_price_first do + name { "Category with lowest price first" } + default_sort { "LOWEST_PRICE_FIRST" } + end + + initialize_with { attributes } + end +end \ No newline at end of file diff --git a/spec/factories/product_data.rb b/spec/factories/product_data.rb new file mode 100644 index 0000000..67e6f28 --- /dev/null +++ b/spec/factories/product_data.rb @@ -0,0 +1,103 @@ +FactoryBot.define do + factory :product_data, class: Hash do + name { "Team42 Product" } + description { "Spain\nRioja Tempranillo" } + manufacturer { "Grape Vineyard" } + essential_features { "Dry. 12% alcohol. Best vine variety." } + tags { ["Bestseller", "Red Wine", "Sale"] } + + product_identifiers do + [ + { + type: "EAN", + value: "9780134308135" + } + ] + end + + sales_price do + { + tax_model: "GROSS", + amount: 8.7, + currency: "GBP" + } + end + + list_price do + { + tax_model: "GROSS", + amount: 10.95, + currency: "GBP" + } + end + + manufacturer_price do + { + tax_model: "GROSS", + amount: 11.95, + currency: "GBP" + } + end + + visible { true } + tax_class { "REGULAR" } + + shipping_weight do + { + value: 1175.0, + display_unit: "GRAMS" + } + end + + max_order_quantity { 6 } + + shipping_dimension do + { + length: 1500, + width: 1000, + height: 2000 + } + end + + ref_price do + { + ref_quantity: 1, + unit: "LITER", + quantity: 0.75, + price: { + tax_model: "GROSS", + amount: 11.6, + currency: "GBP" + } + } + end + + shipping_period do + { + min: 2, + max: 4, + display_unit: "WEEKS" + } + end + + pickup_period do + { + min: 1, + max: 2, + display_unit: "WEEKS" + } + end + + product_labels do + [ + { + type: "NEW", + active_from: "2024-08-13T11:31:30.210787732", + active_until: "2024-09-10T11:31:30.210787732" + } + ] + end + + initialize_with { attributes } + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml deleted file mode 100644 index 2b60320..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=refresh_token&refresh_token= - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:20 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.075' - X-B3-Traceid: - - c18d2bd93a06719e6588e4467bb349ee - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "refresh_token" : "", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701020, - "jti" : "PmaCtIyee05EfeXa+hPsFx9lHNA=" - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml deleted file mode 100644 index cf69795..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?code=abcde&grant_type=authorization_code - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Thu, 15 Aug 2024 05:50:20 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.044' - X-B3-Traceid: - - 7b2e726e3d43a71295be89159def3075 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "error" : "invalid_grant", - "error_description" : "Invalid authorization code: abcde" - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml deleted file mode 100644 index 0fc99a4..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:19 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.095' - X-B3-Traceid: - - 1d24f62f4177873de211bb403233304f - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701019, - "jti" : "Dh7TEvFcW6H+YC4g0EK6QMBXpRk=" - } - recorded_at: Thu, 15 Aug 2024 05:50:19 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml deleted file mode 100644 index 96dbf5e..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml +++ /dev/null @@ -1,150 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:20 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.082' - X-B3-Traceid: - - 7ff3e2bf420f231962f1e03701b7fb4c - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701020, - "jti" : "AzUxPPnMSDVwQzlYwq21RqK7Hhc=" - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:20 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.033' - X-B3-Traceid: - - ab0c4f8b027b155f7625393937bc7f5b - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "categories" : [ { - "_id" : "8a4a8f6a-e3d9-4616-9e89-12c42c084534", - "name" : "DO-NOT-DELETE Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" - } - } - } ] - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories?page=0&size=20" - } - }, - "page" : { - "size" : 20, - "totalElements" : 1, - "totalPages" : 1, - "number" : 0 - } - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml deleted file mode 100644 index 3dc82e0..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml +++ /dev/null @@ -1,187 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.073' - X-B3-Traceid: - - 372d3ca1e7683a3f7c09cc397164562d - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701021, - "jti" : "so7eqPGyCHGcPK7pPPAplw2rfs8=" - } - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.026' - X-B3-Traceid: - - e445c425ef3ec4fc665eed40f2d0e795 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "858904b2-b10e-41ce-8f7b-f45d947541f8", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8" - } - } - } - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/858904b2-b10e-41ce-8f7b-f45d947541f8 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.035' - X-B3-Traceid: - - e94b20026dd6d8eddaf88ce320f3e72e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml deleted file mode 100644 index 9c745fd..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml +++ /dev/null @@ -1,247 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:22 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.096' - X-B3-Traceid: - - 606cb88d38b8b4554d5af7e25b1c74a7 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701022, - "jti" : "aGbiZCt009T6WsRpZJKGG9qyE9k=" - } - recorded_at: Thu, 15 Aug 2024 05:50:22 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 15 Aug 2024 05:50:22 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.029' - X-B3-Traceid: - - 520802273f52194d6ebdcd88fdc58c10 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "137ceb34-0cf7-4139-a3bf-a82e70a89d0e", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e" - } - } - } - recorded_at: Thu, 15 Aug 2024 05:50:22 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Thu, 15 Aug 2024 05:50:22 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.034' - X-B3-Traceid: - - e1e2b024ec648b363314194887e83d37 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Thu, 15 Aug 2024 05:50:22 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/137ceb34-0cf7-4139-a3bf-a82e70a89d0e - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 15 Aug 2024 05:50:22 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.012' - X-B3-Traceid: - - a4088d26abaa83a66d8d978aa7725fb8 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "errorId" : "resource-not-found", - "details" : { }, - "message" : "No Category found for '137ceb34-0cf7-4139-a3bf-a82e70a89d0e'", - "traceId" : "a4088d26abaa83a66d8d978aa7725fb8" - } - recorded_at: Thu, 15 Aug 2024 05:50:22 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml deleted file mode 100644 index 8ed95ea..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml +++ /dev/null @@ -1,256 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:20 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.081' - X-B3-Traceid: - - 3507e56fa0bd34971c418c20b3d4f1d7 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701020, - "jti" : "WwBYg3bre0BOmDWi5RJZOHafF74=" - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 15 Aug 2024 05:50:20 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.034' - X-B3-Traceid: - - 5affc1e741a9298b0538e310d224698f - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "db518b84-206e-43d6-9622-2c7c766210ef", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" - } - } - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.018' - X-B3-Traceid: - - b17e54f0095a440dc56ece5e54375993 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "db518b84-206e-43d6-9622-2c7c766210ef", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef" - } - } - } - recorded_at: Thu, 15 Aug 2024 05:50:20 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/db518b84-206e-43d6-9622-2c7c766210ef - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.037' - X-B3-Traceid: - - bb2005104a0dac4e67a81c958f0bd58e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml deleted file mode 100644 index 67b46db..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml +++ /dev/null @@ -1,256 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.086' - X-B3-Traceid: - - d4b64c9c323ad01623e86c399b796097 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1723701021, - "jti" : "f2uXsKDemqxSVnHCT3aceQOcbQA=" - } - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.044' - X-B3-Traceid: - - 05ef4940f2a010a010695eb26ac6868a - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "fca1f910-388f-4b2e-9b67-a6dbecef199d", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" - } - } - } - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -- request: - method: put - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d - body: - encoding: UTF-8 - string: '{"name":"Updated Test Category","type":"SMART","defaultSort":"LOWEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 15 Aug 2024 05:50:21 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.045' - X-B3-Traceid: - - 418ac8e9b19b16d33dc4b8309bfe7f78 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "fca1f910-388f-4b2e-9b67-a6dbecef199d", - "name" : "Updated Test Category", - "type" : "SMART", - "defaultSort" : "LOWEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d" - } - } - } - recorded_at: Thu, 15 Aug 2024 05:50:21 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/fca1f910-388f-4b2e-9b67-a6dbecef199d - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Thu, 15 Aug 2024 05:50:22 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.034' - X-B3-Traceid: - - 6c17c91d246b6f5eee1ac4c567c7055f - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Thu, 15 Aug 2024 05:50:22 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml new file mode 100644 index 0000000..53c14ea --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml @@ -0,0 +1,559 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:13:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.098' + X-B3-Traceid: + - d5f36a0ed8968b897ca10114fb554be2 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724048023, + "jti" : "wbmjEm3sklF053GJQPRcuTGUOeM=" + } + recorded_at: Mon, 19 Aug 2024 06:13:42 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/products + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:13:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.059' + X-B3-Traceid: + - 1bb4216510732544b0381d5e21097911 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "products" : [ { + "_id" : "4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc", + "lastModifiedAt" : "2024-08-18T21:43:42.669", + "sku" : "1000", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/additional-descriptions" + } + } + }, { + "_id" : "cb3463f8-90b1-4d0b-a071-d577e9686696", + "lastModifiedAt" : "2024-08-19T05:59:22.945", + "sku" : "1006", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/additional-descriptions" + } + } + }, { + "_id" : "6c1fba11-2983-4cff-bdd1-8d485fd4e836", + "lastModifiedAt" : "2024-08-19T05:59:23.355", + "sku" : "1007", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/additional-descriptions" + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" + }, + "search" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/search" + } + }, + "page" : { + "size" : 20, + "totalElements" : 3, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:13:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml new file mode 100644 index 0000000..f0e43ab --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml @@ -0,0 +1,265 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:13:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - 106773ef766c850d4abdd663005975d6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724048023, + "jti" : "no4BNV9le4jdYPwVubX5/joQQKI=" + } + recorded_at: Mon, 19 Aug 2024 06:13:43 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/products + body: + encoding: UTF-8 + string: '{"name":"Team42 Product","description":"Spain\nRioja Tempranillo","manufacturer":"Grape + Vineyard","essentialFeatures":"Dry. 12% alcohol. Best vine variety.","tags":["Bestseller","Red + Wine","Sale"],"productIdentifiers":[{"type":"EAN","value":"9780134308135"}],"salesPrice":{"taxModel":"GROSS","amount":8.7,"currency":"GBP"},"listPrice":{"taxModel":"GROSS","amount":10.95,"currency":"GBP"},"manufacturerPrice":{"taxModel":"GROSS","amount":11.95,"currency":"GBP"},"visible":true,"taxClass":"REGULAR","shippingWeight":{"value":1175.0,"displayUnit":"GRAMS"},"maxOrderQuantity":6,"shippingDimension":{"length":1500,"width":1000,"height":2000},"refPrice":{"refQuantity":1,"unit":"LITER","quantity":0.75,"price":{"taxModel":"GROSS","amount":11.6,"currency":"GBP"}},"shippingPeriod":{"min":2,"max":4,"displayUnit":"WEEKS"},"pickupPeriod":{"min":1,"max":2,"displayUnit":"WEEKS"},"productLabels":[{"type":"NEW","activeFrom":"2024-08-13T11:31:30.210787732","activeUntil":"2024-09-10T11:31:30.210787732"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:13:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.167' + X-B3-Traceid: + - 53cf7e966ae413885a6038246feccac7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "622de456-b829-4840-ae51-908c3c4c6e72", + "lastModifiedAt" : "2024-08-19T06:13:43.611930663", + "sku" : "1008", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833333333333333333333, + "taxRate" : 0.2 + } + }, + "tags" : [ "Bestseller", "Red Wine", "Sale" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.210787732", + "activeUntil" : "2024-09-10T11:31:30.210787732" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/additional-descriptions" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:13:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml new file mode 100644 index 0000000..7cfd7ca --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml @@ -0,0 +1,460 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:13:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.104' + X-B3-Traceid: + - fcc97b55c81bd4cabec510e5a30bd056 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724048023, + "jti" : "06B85BvxBJ2hdbx/0dtllDESTAw=" + } + recorded_at: Mon, 19 Aug 2024 06:13:43 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/products + body: + encoding: UTF-8 + string: '{"name":"Team42 Product","description":"Spain\nRioja Tempranillo","manufacturer":"Grape + Vineyard","essentialFeatures":"Dry. 12% alcohol. Best vine variety.","tags":["Bestseller","Red + Wine","Sale"],"productIdentifiers":[{"type":"EAN","value":"9780134308135"}],"salesPrice":{"taxModel":"GROSS","amount":8.7,"currency":"GBP"},"listPrice":{"taxModel":"GROSS","amount":10.95,"currency":"GBP"},"manufacturerPrice":{"taxModel":"GROSS","amount":11.95,"currency":"GBP"},"visible":true,"taxClass":"REGULAR","shippingWeight":{"value":1175.0,"displayUnit":"GRAMS"},"maxOrderQuantity":6,"shippingDimension":{"length":1500,"width":1000,"height":2000},"refPrice":{"refQuantity":1,"unit":"LITER","quantity":0.75,"price":{"taxModel":"GROSS","amount":11.6,"currency":"GBP"}},"shippingPeriod":{"min":2,"max":4,"displayUnit":"WEEKS"},"pickupPeriod":{"min":1,"max":2,"displayUnit":"WEEKS"},"productLabels":[{"type":"NEW","activeFrom":"2024-08-13T11:31:30.210787732","activeUntil":"2024-09-10T11:31:30.210787732"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:13:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.118' + X-B3-Traceid: + - 0a105ba76ed042b8991a26d55e9c9bd5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", + "lastModifiedAt" : "2024-08-19T06:13:44.056298618", + "sku" : "1009", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833333333333333333333, + "taxRate" : 0.2 + } + }, + "tags" : [ "Bestseller", "Red Wine", "Sale" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.210787732", + "activeUntil" : "2024-09-10T11:31:30.210787732" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:13:44 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:13:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.029' + X-B3-Traceid: + - cfefacb3c35ac7180bd7b5431781aec5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", + "lastModifiedAt" : "2024-08-19T06:13:44.056", + "sku" : "1009", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:13:44 GMT +recorded_with: VCR 6.2.0 From 4410f8c1faf8f090cec52d5b35fd68825119731b Mon Sep 17 00:00:00 2001 From: Kathia Date: Mon, 19 Aug 2024 08:33:10 +0200 Subject: [PATCH 38/59] Revert "Rename destroy endpoint methods to delete (#73)" (#74) This reverts commit e70ca118bf6ff2aceb5dba8ec24bd8be2484e7dc. --- lib/beyond_api/services/webhook/subscription.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 97d1668..349f80f 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -15,8 +15,8 @@ def delete_all end end - def delete(id) - Connection.delete("webhook-subscriptions/#{id}") + def destroy(id) + delete("webhook-subscriptions/#{id}") end def find(id) From 6677db6fc04e0412241a6bb3d747901a9c3cfb52 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 19 Aug 2024 08:41:37 +0200 Subject: [PATCH 39/59] Update tests --- .../services/authentication/signer.rb | 4 +- .../services/product_management/category.rb | 4 +- .../services/storefront/script_tag.rb | 4 +- .../services/webhook/subscription.rb | 4 +- spec/beyond_api/resources/products_spec.rb | 78 - .../resources/products_view_spec.rb | 15 - spec/beyond_api/resources/variations_spec.rb | 93 - .../services/authentication/signer_spec.rb | 4 +- .../product_management/category_spec.rb | 6 +- .../_all/returns_all_signers.yml | 159 ++ .../_create/creates_a_new_signer.yml | 131 + .../with_signer/_destroy/deletes_a_signer.yml | 185 ++ .../refreshes_the_token.yml | 67 + ...retrieves_token_via_authorization_code.yml | 61 + ...retrieves_token_via_client_credentials.yml | 66 + .../_all/returns_all_shipping_zones.yml | 136 + .../_all/returns_all_categories.yml | 150 + .../_create/creates_a_new_category.yml | 187 ++ .../_destroy/deletes_a_category.yml | 247 ++ .../_find/returns_a_category.yml | 256 ++ .../_update/updates_an_existing_category.yml | 256 ++ .../_all/returns_all_images.yml | 136 + .../_all/returns_all_products.yml | 2413 ++++++++++++++++- .../_create/creates_a_new_product.yml | 52 +- .../with_product/_find/returns_a_product.yml | 92 +- 25 files changed, 4523 insertions(+), 283 deletions(-) delete mode 100644 spec/beyond_api/resources/products_spec.rb delete mode 100644 spec/beyond_api/resources/products_view_spec.rb delete mode 100644 spec/beyond_api/resources/variations_spec.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 2711809..2e67b2d 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -9,8 +9,8 @@ def create post("signers") end - def delete(id) - Connection.delete("signers/#{id}") + def destroy(id) + delete("signers/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 27602c4..8e27ebe 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -17,8 +17,8 @@ def update(id, body) put("categories/#{id}", body) end - def delete(id) - Connection.delete("categories/#{id}") + def destroy(id) + delete("categories/#{id}") end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index d3491ca..6c5eaed 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -11,8 +11,8 @@ def create(script_url) post("script-tags", script_url:) end - def delete(id) - Connection.delete("script-tags/#{id}") + def destroy(id) + delete("script-tags/#{id}") end end end diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 97d1668..349f80f 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -15,8 +15,8 @@ def delete_all end end - def delete(id) - Connection.delete("webhook-subscriptions/#{id}") + def destroy(id) + delete("webhook-subscriptions/#{id}") end def find(id) diff --git a/spec/beyond_api/resources/products_spec.rb b/spec/beyond_api/resources/products_spec.rb deleted file mode 100644 index db72897..0000000 --- a/spec/beyond_api/resources/products_spec.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'BeyondApi::Products' do - let!(:session) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - end - - let(:product) { @product = session.products.create(FactoryBot.build(:product)) } - - let!(:file_path) do - app_root = File.expand_path(File.dirname("ext.rb")) - "#{app_root}/spec/files/" - end - - describe "non existing product" do - it "create a new regular product and " do - product = session.products.create(FactoryBot.build(:product)) - - expect(product).not_to be nil - expect(product.id).not_to be nil - end - end - - - describe "product exist" do - it "find a product sending an ID" do - response = session.products.find(product.id) - expect(response).not_to be nil - expect(response.id).to eq(product.id) - end - - - it "upload multiple images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - images = session.products.upload_multiple_images(product.id, - files, - ["image1.png", "image2.png"]) - expect(images).not_to be nil - expect(images.embedded.images.is_a?(Array)).to eq true - end - - it "upload a single image" do - file = "#{file_path}image1.png" - - image = session.products.upload_image(product.id, file, "image3.png") - expect(image).not_to be nil - expect(image).to eq true - end - - it "sort product images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - session.products.upload_multiple_images(product.id, - files, - ["image1.png", "image2.png"]) - - images = session.products.images(product.id) - - images_sorted = images.embedded.images.sort_by(&:position).reverse.map(&:id) - - sorted = session.products.sort_images(product.id, images_sorted) - - images = session.products.images(product.id) - - expect(sorted).not_to be nil - expect(sorted).to eq true - expect(images.embedded.images.map(&:id)).to eq images_sorted - end - end -end diff --git a/spec/beyond_api/resources/products_view_spec.rb b/spec/beyond_api/resources/products_view_spec.rb deleted file mode 100644 index d76d054..0000000 --- a/spec/beyond_api/resources/products_view_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -RSpec.describe 'BeyondApi::ProductsView' do - let!(:session) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - end - - let(:product) { @product = session.products.create(FactoryBot.build(:product)) } - - it "list products with specific tag" do - response = session.products_view.search_by_tag("beyond_api-ruby_client") - expect(response).not_to be nil - expect(response.embedded.products.class).to be(Array) - expect(response.embedded.products.size).to be >= 1 - end -end diff --git a/spec/beyond_api/resources/variations_spec.rb b/spec/beyond_api/resources/variations_spec.rb deleted file mode 100644 index af774b5..0000000 --- a/spec/beyond_api/resources/variations_spec.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'BeyondApi::Variations' do - let!(:file_path) do - app_root = File.expand_path(File.dirname("ext.rb")) - "#{app_root}/spec/files/" - end - - let!(:session) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - end - - let(:product) { session.products.create(FactoryBot.build(:product, :with_variations)) } - let(:variation) do - session.variations.all(product.id).embedded.variations.first - end - let(:default_image_property) do - body = [{ - property: "defaultImage", - enabled: true - }] - session.products.update_variation_properties(product.id, body) - end - - context "Create variation" do - it "Update image variation property" do - body = [{ - property: "defaultImage", - enabled: true - }] - response = session.products.update_variation_properties(product.id, body) - - expect(response).not_to be nil - default_image_prop = response.embedded.variation_properties.find { |prop| prop.property == "defaultImage" } - - expect(default_image_prop).not_to be nil - expect(default_image_prop.enabled).to be true - end - - it "Upload multiple images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - default_image_property - response = session.variations.upload_multiple_images(product.id, - variation.id, - files, - ["image1.png", "image2.png"]) - - expect(response).not_to be nil - end - - it "Upload a single image" do - file = "#{file_path}image1.png" - - default_image_property - response = session.variations.upload_multiple_images(product.id, - variation.id, - file, - "variation1.png") - - expect(response).not_to be nil - end - - it "sort variation images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - default_image_property - response = session.variations.upload_multiple_images(product.id, - variation.id, - files, - ["image1.png", "image2.png"]) - - images = session.variations.images(product.id, variation.id) - - images_sorted = images.embedded.images.sort_by(&:position).reverse.map(&:id) - - sorted = session.variations.sort_images(product.id, variation.id, images_sorted) - - images = session.variations.images(product.id, variation.id) - - expect(sorted).not_to be nil - expect(sorted).to eq true - expect(images.embedded.images.map(&:id)).to eq images_sorted - end - end -end diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb index aa310d1..de8bd76 100644 --- a/spec/beyond_api/services/authentication/signer_spec.rb +++ b/spec/beyond_api/services/authentication/signer_spec.rb @@ -20,9 +20,9 @@ end end - describe '#delete' do + describe '#destroy' do it 'deletes a signer' do - response = client.delete(@signer[:id]) + response = client.destroy(@signer[:id]) expect(response).to be {} end end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index a3752b6..01e048e 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -43,15 +43,15 @@ end end - describe ".delete" do + describe ".destroy" do it "deletes a category" do - response = client.delete(@category[:id]) + response = client.destroy(@category[:id]) expect(response).to be {} end end after(:each) do - client.delete(@category[:id]) + client.destroy(@category[:id]) rescue BeyondApi::Error end end diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml new file mode 100644 index 0000000..030cc77 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml @@ -0,0 +1,159 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.097' + X-B3-Traceid: + - '0636875c3bbcbab7867bda535fe5e243' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049641, + "jti" : "8JwEzj6jy1EWDAYb40//fdukLso=" + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.025' + X-B3-Traceid: + - 50d800fb4b92bedd1b243cbfadba6fb4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "signers" : [ { + "_id" : "3c910dd7-65d8-4ee5-af7d-dd82de834d4b", + "createdAt" : "2024-08-19T06:37:59.951", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/3c910dd7-65d8-4ee5-af7d-dd82de834d4b" + } + } + }, { + "_id" : "7add803f-df8a-46a4-9e75-5afd75b01adc", + "createdAt" : "2024-08-19T06:36:40.976", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/7add803f-df8a-46a4-9e75-5afd75b01adc" + } + } + }, { + "_id" : "82920cfb-e1ab-4b3c-8e33-5702d86f6876", + "createdAt" : "2024-08-19T06:37:28.279", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/82920cfb-e1ab-4b3c-8e33-5702d86f6876" + } + } + }, { + "_id" : "b3de5fef-8385-4df4-a9a5-74a5aacb1277", + "createdAt" : "2024-08-19T06:35:38.891", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/b3de5fef-8385-4df4-a9a5-74a5aacb1277" + } + } + } ] + } + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml new file mode 100644 index 0000000..f826990 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml @@ -0,0 +1,131 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.107' + X-B3-Traceid: + - 76c69d85f495cae946b442180d524db6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049641, + "jti" : "J/GfScnFC3pMwwgs5YDiIVP1HXo=" + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - 701352c68f255753f503b83c7fc89eba + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "2248041d-692c-4367-afc0-345cc68eab34", + "sharedSecret" : "59dh9nooefbgcqjnqtggu5s5j4", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/2248041d-692c-4367-afc0-345cc68eab34" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml new file mode 100644 index 0000000..7b368bd --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml @@ -0,0 +1,185 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.109' + X-B3-Traceid: + - d72048fff4e94acf0c52280599675dd9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049641, + "jti" : "DjCpOBsqfphiDcCkDgpoRP4k5EM=" + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.040' + X-B3-Traceid: + - c0ee336f1e05d262a21d2b02500caa18 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "494bf9b6-6550-486c-af70-1f6ba20efc15", + "sharedSecret" : "7i089vqpip8rp1rr8knpvtn9vf", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/494bf9b6-6550-486c-af70-1f6ba20efc15" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/signers/494bf9b6-6550-486c-af70-1f6ba20efc15 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - 4ff4a18a386e580d5cb7bad07cd18f96 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml new file mode 100644 index 0000000..b3d84ca --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=refresh_token&refresh_token= + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.068' + X-B3-Traceid: + - 763a7dd5f009d1ffbc6fbf526ebed43e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "refresh_token" : "", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049642, + "jti" : "DrMFA8sRZZLLJO+ba+Jand8vQA0=" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml new file mode 100644 index 0000000..33b231f --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml @@ -0,0 +1,61 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?code=abcde&grant_type=authorization_code + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.065' + X-B3-Traceid: + - f7ff23495578391a48e8521e43b1713c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "error" : "invalid_grant", + "error_description" : "Invalid authorization code: abcde" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml new file mode 100644 index 0000000..ef2289a --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml @@ -0,0 +1,66 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - 7bdb93b33bd69b735ecb9e195d0f5480 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049642, + "jti" : "0kCHmq0DeCKbXbVed8Em4P49/SM=" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml b/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml new file mode 100644 index 0000000..a6034cf --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.102' + X-B3-Traceid: + - ade04437123682156ae9bbd7667045a3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049642, + "jti" : "xEIok9IjDV4GjerA3jFWgrvFXhE=" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shipping-zones + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.020' + X-B3-Traceid: + - a5f64146e475157a05c57418c445a262 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "shipping-zones" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shipping-zones?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml new file mode 100644 index 0000000..46bc703 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml @@ -0,0 +1,150 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - 2e5297c116f26110752a13767ed08317 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049643, + "jti" : "52PRN2EdpqkLoCJ/CEyh6beJ2d4=" + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.024' + X-B3-Traceid: + - da4b1b865b4142c6ab107d91109bd7af + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "categories" : [ { + "_id" : "8a4a8f6a-e3d9-4616-9e89-12c42c084534", + "name" : "DO-NOT-DELETE Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 1, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml new file mode 100644 index 0000000..9131453 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml @@ -0,0 +1,187 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.091' + X-B3-Traceid: + - 9c45eb30e4575f5f4fe5cc084546e684 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049643, + "jti" : "8dcnvbvxhvyHoBbeBAKfSw03gyc=" + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - af3aeca695c94c32801e0c662b63ddb9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "464df7fc-5801-4eda-8c38-22b6ffd2a823", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.047' + X-B3-Traceid: + - 7eeb8ed8a7b09af81f8874d37bb821d0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml new file mode 100644 index 0000000..028cc62 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml @@ -0,0 +1,247 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.112' + X-B3-Traceid: + - dc5d18864eaf21f13f53b1fc42fa463a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049645, + "jti" : "HQfYmpl2Z0QRAzP1B3ryEq8CZ4U=" + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.029' + X-B3-Traceid: + - 36495f254777047ecfac8921032839d3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "349a769f-a19b-401f-bc29-45228f4d115a", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.040' + X-B3-Traceid: + - fb465a06f039def22ea6a2148387eeb7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.016' + X-B3-Traceid: + - 1e6bd69e50fa94a8dd2392ccdcd99aa6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "resource-not-found", + "details" : { }, + "message" : "No Category found for '349a769f-a19b-401f-bc29-45228f4d115a'", + "traceId" : "1e6bd69e50fa94a8dd2392ccdcd99aa6" + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml new file mode 100644 index 0000000..c727718 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.149' + X-B3-Traceid: + - 19f41c49ed1a0b4821d56b1f2a5199d0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049644, + "jti" : "YTMVOzRnfL3aopdXeSQQogD61VQ=" + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.025' + X-B3-Traceid: + - 872ce11570a2ae1a3862dad0b48fab19 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "380c8a2b-cff2-4789-9777-53a232f4d601", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.015' + X-B3-Traceid: + - e685a6f718f5fd74732f9fcdb9c80e2a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "380c8a2b-cff2-4789-9777-53a232f4d601", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - '08eca00fb3f15ee4c11470044e64e130' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml new file mode 100644 index 0000000..6833082 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.139' + X-B3-Traceid: + - eb47a37565c0c4d86ddfbc23d37a76c5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049644, + "jti" : "Vy9nkOpiuE7poFaOts96U5zc7QI=" + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.034' + X-B3-Traceid: + - 1dc369d96881200e2c455f732c3c021c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "5f37b352-8c12-414f-96cf-8152e4e23d4d", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d + body: + encoding: UTF-8 + string: '{"name":"Category with lowest price first","type":"SMART","defaultSort":"LOWEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 38668d975055f9f37ede46c518c54907 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "5f37b352-8c12-414f-96cf-8152e4e23d4d", + "name" : "Category with lowest price first", + "type" : "SMART", + "defaultSort" : "LOWEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - 2dd71cfed1e43d8570f1ab33ffcdf086 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml new file mode 100644 index 0000000..969edad --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - 3f6f1d5807e8bf92dca5c2e04ae7048d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049645, + "jti" : "zq3hO+6bHPoM3k4RR8FK0e/RkmQ=" + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.023' + X-B3-Traceid: + - e0ae07b6811b4d06362a57425a0a55b0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "images" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml index 53c14ea..87fb499 100644 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml @@ -23,7 +23,7 @@ http_interactions: message: OK headers: Date: - - Mon, 19 Aug 2024 06:13:43 GMT + - Mon, 19 Aug 2024 06:40:46 GMT Content-Type: - application/json;charset=utf-8 Transfer-Encoding: @@ -45,9 +45,9 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.098' + - '0.146' X-B3-Traceid: - - d5f36a0ed8968b897ca10114fb554be2 + - 0ec04a3cce6cafd10f5ab15b6102e7b8 X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: @@ -59,10 +59,10 @@ http_interactions: "expires_in" : 3599, "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", "tenantId" : 8542, - "iat" : 1724048023, - "jti" : "wbmjEm3sklF053GJQPRcuTGUOeM=" + "iat" : 1724049646, + "jti" : "mu0JswmAtn8TgH3JWCQ9j902J4I=" } - recorded_at: Mon, 19 Aug 2024 06:13:42 GMT + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT - request: method: get uri: https://team42-beyond-api.beyondshop.cloud/api/products @@ -86,7 +86,7 @@ http_interactions: message: OK headers: Date: - - Mon, 19 Aug 2024 06:13:43 GMT + - Mon, 19 Aug 2024 06:40:46 GMT Content-Type: - application/json Transfer-Encoding: @@ -108,9 +108,9 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.059' + - '0.227' X-B3-Traceid: - - 1bb4216510732544b0381d5e21097911 + - af2a97f1e8074796ca4f5bd8c27aeb0e X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: @@ -538,22 +538,2411 @@ http_interactions: "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/additional-descriptions" } } + }, { + "_id" : "622de456-b829-4840-ae51-908c3c4c6e72", + "lastModifiedAt" : "2024-08-19T06:13:43.612", + "sku" : "1008", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/additional-descriptions" + } + } + }, { + "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", + "lastModifiedAt" : "2024-08-19T06:13:44.056", + "sku" : "1009", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" + } + } + }, { + "_id" : "d0a33d33-f629-46a5-a7d6-dbdb22dbae39", + "lastModifiedAt" : "2024-08-19T06:29:52.033", + "sku" : "1010", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/additional-descriptions" + } + } + }, { + "_id" : "4d16857a-a353-4e88-9cc7-ba0b9cf05c2b", + "lastModifiedAt" : "2024-08-19T06:29:52.458", + "sku" : "1011", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/additional-descriptions" + } + } + }, { + "_id" : "2d9923be-cc36-41f7-8585-795883ceecdc", + "lastModifiedAt" : "2024-08-19T06:30:37.637", + "sku" : "1012", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/additional-descriptions" + } + } + }, { + "_id" : "935f97ed-c875-4f24-9f6b-cdb6f09cbddd", + "lastModifiedAt" : "2024-08-19T06:30:38.101", + "sku" : "1013", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/additional-descriptions" + } + } + }, { + "_id" : "7b16492b-8a5b-4597-8e9d-cd9fcd52af0c", + "lastModifiedAt" : "2024-08-19T06:31:58.649", + "sku" : "1014", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/additional-descriptions" + } + } + }, { + "_id" : "575da236-82ff-4e5c-84f9-a5514ef05b23", + "lastModifiedAt" : "2024-08-19T06:31:59.05", + "sku" : "1015", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/additional-descriptions" + } + } + }, { + "_id" : "26221231-953b-4a1c-9025-7c72e610facd", + "lastModifiedAt" : "2024-08-19T06:35:23.365", + "sku" : "1016", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/additional-descriptions" + } + } + }, { + "_id" : "0b47984d-5322-4d11-9022-41137bd9ddc2", + "lastModifiedAt" : "2024-08-19T06:35:23.857", + "sku" : "1017", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/additional-descriptions" + } + } + }, { + "_id" : "d4aa7727-aaa5-43d4-80f4-0f51bc8a688e", + "lastModifiedAt" : "2024-08-19T06:35:43.277", + "sku" : "1018", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/additional-descriptions" + } + } + }, { + "_id" : "b9bf2184-ae5b-4b06-be1a-f4d1140496e3", + "lastModifiedAt" : "2024-08-19T06:35:43.694", + "sku" : "1019", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/additional-descriptions" + } + } + }, { + "_id" : "bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a", + "lastModifiedAt" : "2024-08-19T06:36:45.318", + "sku" : "1020", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/additional-descriptions" + } + } + }, { + "_id" : "21cb741d-eb0c-4722-8622-a8b555d1fd03", + "lastModifiedAt" : "2024-08-19T06:36:45.749", + "sku" : "1021", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/additional-descriptions" + } + } + }, { + "_id" : "687ac2a5-91a9-4d7e-917d-614fabcbc023", + "lastModifiedAt" : "2024-08-19T06:37:32.536", + "sku" : "1022", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/additional-descriptions" + } + } + }, { + "_id" : "4312d633-0d56-4157-8b33-b587550cca1f", + "lastModifiedAt" : "2024-08-19T06:37:32.972", + "sku" : "1023", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/additional-descriptions" + } + } + }, { + "_id" : "88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d", + "lastModifiedAt" : "2024-08-19T06:38:04.141", + "sku" : "1024", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/additional-descriptions" + } + } } ] }, "_links" : { + "first" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" + }, "self" : { "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" }, + "next" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=1&size=20" + }, + "last" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=1&size=20" + }, "search" : { "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/search" } }, "page" : { "size" : 20, - "totalElements" : 3, - "totalPages" : 1, + "totalElements" : 21, + "totalPages" : 2, "number" : 0 } } - recorded_at: Mon, 19 Aug 2024 06:13:43 GMT + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml index f0e43ab..88ae9c2 100644 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml @@ -23,7 +23,7 @@ http_interactions: message: OK headers: Date: - - Mon, 19 Aug 2024 06:13:43 GMT + - Mon, 19 Aug 2024 06:40:46 GMT Content-Type: - application/json;charset=utf-8 Transfer-Encoding: @@ -45,9 +45,9 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.085' + - '0.156' X-B3-Traceid: - - 106773ef766c850d4abdd663005975d6 + - 226eb06e8a88b8ba020d84ad6821fed5 X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: @@ -59,10 +59,10 @@ http_interactions: "expires_in" : 3599, "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", "tenantId" : 8542, - "iat" : 1724048023, - "jti" : "no4BNV9le4jdYPwVubX5/joQQKI=" + "iat" : 1724049646, + "jti" : "ToaY1QbhYVnXdKVtbo9/zHGP1pY=" } - recorded_at: Mon, 19 Aug 2024 06:13:43 GMT + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT - request: method: post uri: https://team42-beyond-api.beyondshop.cloud/api/products @@ -88,7 +88,7 @@ http_interactions: message: Created headers: Date: - - Mon, 19 Aug 2024 06:13:43 GMT + - Mon, 19 Aug 2024 06:40:47 GMT Content-Type: - application/json Transfer-Encoding: @@ -96,7 +96,7 @@ http_interactions: Connection: - keep-alive Location: - - https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72 + - https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93 X-Content-Type-Options: - nosniff X-Xss-Protection: @@ -112,18 +112,18 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.167' + - '0.145' X-B3-Traceid: - - 53cf7e966ae413885a6038246feccac7 + - 29b58716c856411ff91c828f90cfecd2 X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: encoding: UTF-8 string: |- { - "_id" : "622de456-b829-4840-ae51-908c3c4c6e72", - "lastModifiedAt" : "2024-08-19T06:13:43.611930663", - "sku" : "1008", + "_id" : "0c3d27de-5b4d-4432-bf7b-caf7ff289d93", + "lastModifiedAt" : "2024-08-19T06:40:47.012323725", + "sku" : "1026", "salesPrice" : { "taxModel" : "GROSS", "currency" : "GBP", @@ -220,46 +220,46 @@ http_interactions: "purchasable" : true, "_links" : { "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/availability" } } } }, "_links" : { "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93" }, "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/availability" }, "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attributes" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/attributes" }, "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attachments" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/attachments" }, "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/images" }, "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/default-image" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/default-image" }, "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/videos" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/videos" }, "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/cross-sells" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/cross-sells" }, "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/multiple-images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/multiple-images" }, "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/external-images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/external-images" }, "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/additional-descriptions" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/additional-descriptions" } } } - recorded_at: Mon, 19 Aug 2024 06:13:43 GMT + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml index 7cfd7ca..111c0d4 100644 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml @@ -23,7 +23,7 @@ http_interactions: message: OK headers: Date: - - Mon, 19 Aug 2024 06:13:43 GMT + - Mon, 19 Aug 2024 06:40:47 GMT Content-Type: - application/json;charset=utf-8 Transfer-Encoding: @@ -45,9 +45,9 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.104' + - '0.087' X-B3-Traceid: - - fcc97b55c81bd4cabec510e5a30bd056 + - f7e13b884aa50e1d56de1244c68d8652 X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: @@ -59,10 +59,10 @@ http_interactions: "expires_in" : 3599, "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", "tenantId" : 8542, - "iat" : 1724048023, - "jti" : "06B85BvxBJ2hdbx/0dtllDESTAw=" + "iat" : 1724049647, + "jti" : "Bm+dFIVaS5YT9k2JXpxVf0D0haE=" } - recorded_at: Mon, 19 Aug 2024 06:13:43 GMT + recorded_at: Mon, 19 Aug 2024 06:40:47 GMT - request: method: post uri: https://team42-beyond-api.beyondshop.cloud/api/products @@ -88,7 +88,7 @@ http_interactions: message: Created headers: Date: - - Mon, 19 Aug 2024 06:13:44 GMT + - Mon, 19 Aug 2024 06:40:47 GMT Content-Type: - application/json Transfer-Encoding: @@ -96,7 +96,7 @@ http_interactions: Connection: - keep-alive Location: - - https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c + - https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95 X-Content-Type-Options: - nosniff X-Xss-Protection: @@ -112,18 +112,18 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.118' + - '0.129' X-B3-Traceid: - - 0a105ba76ed042b8991a26d55e9c9bd5 + - 5148ada46a37287265e528a0d4a794bc X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: encoding: UTF-8 string: |- { - "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", - "lastModifiedAt" : "2024-08-19T06:13:44.056298618", - "sku" : "1009", + "_id" : "532065c3-5d71-44a6-8b8d-764c798f3b95", + "lastModifiedAt" : "2024-08-19T06:40:47.429253718", + "sku" : "1027", "salesPrice" : { "taxModel" : "GROSS", "currency" : "GBP", @@ -220,51 +220,51 @@ http_interactions: "purchasable" : true, "_links" : { "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" } } } }, "_links" : { "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95" }, "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" }, "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attributes" }, "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attachments" }, "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/images" }, "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/default-image" }, "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/videos" }, "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/cross-sells" }, "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/multiple-images" }, "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/external-images" }, "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/additional-descriptions" } } } - recorded_at: Mon, 19 Aug 2024 06:13:44 GMT + recorded_at: Mon, 19 Aug 2024 06:40:47 GMT - request: method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c + uri: https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95 body: encoding: US-ASCII string: '' @@ -285,7 +285,7 @@ http_interactions: message: OK headers: Date: - - Mon, 19 Aug 2024 06:13:44 GMT + - Mon, 19 Aug 2024 06:40:47 GMT Content-Type: - application/json Transfer-Encoding: @@ -307,18 +307,18 @@ http_interactions: Server: - epages-beyond X-Request-Time: - - '0.029' + - '0.035' X-B3-Traceid: - - cfefacb3c35ac7180bd7b5431781aec5 + - 7a1e8f0003d347ff5d78ddadbf098880 X-Hello-Human: - Come work with us! https://developer.epages.com/devjobs/ body: encoding: UTF-8 string: |- { - "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", - "lastModifiedAt" : "2024-08-19T06:13:44.056", - "sku" : "1009", + "_id" : "532065c3-5d71-44a6-8b8d-764c798f3b95", + "lastModifiedAt" : "2024-08-19T06:40:47.429", + "sku" : "1027", "salesPrice" : { "taxModel" : "GROSS", "currency" : "GBP", @@ -415,46 +415,46 @@ http_interactions: "purchasable" : true, "_links" : { "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" } } } }, "_links" : { "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95" }, "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" }, "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attributes" }, "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attachments" }, "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/images" }, "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/default-image" }, "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/videos" }, "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/cross-sells" }, "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/multiple-images" }, "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/external-images" }, "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/additional-descriptions" } } } - recorded_at: Mon, 19 Aug 2024 06:13:44 GMT + recorded_at: Mon, 19 Aug 2024 06:40:47 GMT recorded_with: VCR 6.2.0 From a5a7460f73b32b8c371695970b1d9b63a43575c7 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 19 Aug 2024 09:26:10 +0200 Subject: [PATCH 40/59] Add tests --- .../services/storefront/script_tag_spec.rb | 38 +++ .../services/webhook/subscription_spec.rb | 46 ++++ spec/factories/category_data.rb | 2 +- spec/factories/webhook_data.rb | 8 + .../_all/returns_all_script_tags.yml | 136 ++++++++++ .../_create/creates_a_new_category.yml | 182 +++++++++++++ .../_destroy/deletes_a_script_tag.yml | 242 +++++++++++++++++ .../_find/returns_a_script_tag.yml | 182 +++++++++++++ .../returns_all_webhook_subscriptions.yml | 136 ++++++++++ .../creates_a_new_webhook_subscription.yml | 186 +++++++++++++ .../deletes_a_webhook_subscription.yml | 238 ++++++++++++++++ .../_find/returns_a_webhook_subscription.yml | 254 ++++++++++++++++++ 12 files changed, 1649 insertions(+), 1 deletion(-) create mode 100644 spec/beyond_api/services/storefront/script_tag_spec.rb create mode 100644 spec/beyond_api/services/webhook/subscription_spec.rb create mode 100644 spec/factories/webhook_data.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml diff --git a/spec/beyond_api/services/storefront/script_tag_spec.rb b/spec/beyond_api/services/storefront/script_tag_spec.rb new file mode 100644 index 0000000..81fbe0c --- /dev/null +++ b/spec/beyond_api/services/storefront/script_tag_spec.rb @@ -0,0 +1,38 @@ +RSpec.describe BeyondApi::Storefront::ScriptTag, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".all" do + it "returns all script tags" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :script_tags)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with script tag" do + before(:each) do + @script_tag = client.create("https://example.com/scripts/exampleScript.js") + end + + describe ".create" do + it "creates a new category" do + expect(@script_tag).not_to be nil + expect(@script_tag[:script_url]).to eq("https://example.com/scripts/exampleScript.js") + end + end + + describe ".destroy" do + it "deletes a script tag" do + response = client.destroy(@script_tag[:id]) + expect(response).to be {} + end + end + + after(:each) do + client.destroy(@script_tag[:id]) + rescue BeyondApi::Error + end + end +end diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb new file mode 100644 index 0000000..9213b59 --- /dev/null +++ b/spec/beyond_api/services/webhook/subscription_spec.rb @@ -0,0 +1,46 @@ +RSpec.describe BeyondApi::Webhook::Subscription, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".all" do + it "returns all webhook subscriptions" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :subscriptions)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with webhook subscription" do + before(:each) do + @webhook_subscription = client.create(build(:webhook_data)) + end + + describe ".create" do + it "creates a new webhook subscription" do + expect(@webhook_subscription).not_to be nil + expect(@webhook_subscription[:callback_uri]).to eq("http://example.com/test") + expect(@webhook_subscription[:event_types]).to eq(["order.created", "product.created"]) + end + end + + describe ".find" do + it "returns a webhook subscription" do + response = client.find(@webhook_subscription[:id]) + expect(response[:callback_uri]).to eq("http://example.com/test") + end + end + + describe ".destroy" do + it "deletes a webhook subscription" do + response = client.destroy(@webhook_subscription[:id]) + expect(response).to be {} + end + end + + after(:each) do + client.destroy(@webhook_subscription[:id]) + rescue BeyondApi::Error + end + end +end diff --git a/spec/factories/category_data.rb b/spec/factories/category_data.rb index 116b674..8f28256 100644 --- a/spec/factories/category_data.rb +++ b/spec/factories/category_data.rb @@ -11,4 +11,4 @@ initialize_with { attributes } end -end \ No newline at end of file +end diff --git a/spec/factories/webhook_data.rb b/spec/factories/webhook_data.rb new file mode 100644 index 0000000..39b9c4c --- /dev/null +++ b/spec/factories/webhook_data.rb @@ -0,0 +1,8 @@ +FactoryBot.define do + factory :webhook_data, class: Hash do + callback_uri { "http://example.com/test" } + event_types { ["order.created", "product.created"] } + + initialize_with { attributes } + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml new file mode 100644 index 0000000..ef99947 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.088' + X-B3-Traceid: + - d8bb94fce645e11df41f02cdf798c48c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051815, + "jti" : "tZ1d2LY1w2EHdOp6Fio2ID2v6sU=" + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.019' + X-B3-Traceid: + - 4bb5130872df2dc70bef5c5eabcb7790 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "script-tags" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml new file mode 100644 index 0000000..0adb11d --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml @@ -0,0 +1,182 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - 0c97be1daa45232d28dd92b0f670a097 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051815, + "jti" : "oSMzgxORYBuMaGTwU6WxFQhB3PI=" + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.074' + X-B3-Traceid: + - ca7443df2ac52d190d47ea8d7df1ffb4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "3bda8799-ed96-4f27-836a-4fb034e43a48", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - d943e40a62bcba3951b1f008012de45d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml new file mode 100644 index 0000000..a4e4441 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml @@ -0,0 +1,242 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - a593d0cdd236de07616aef78bf6a6655 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051816, + "jti" : "FU5e5c1fVeoVADYx6gMOUbbaE9g=" + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - 4b85311b0c4bc77c83cbd4b03eaf43cc + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "c84ded08-d594-4124-a868-cf660c507e10", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.049' + X-B3-Traceid: + - 7d438309bcb3899f073002e6bcaec3d9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 07:16:57 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.027' + X-B3-Traceid: + - a3989af594a1f550cdfc565446fe21b9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "script-tag.not-found", + "details" : { }, + "message" : "script-tag with id c84ded08-d594-4124-a868-cf660c507e10 could not be found", + "traceId" : "a3989af594a1f550cdfc565446fe21b9" + } + recorded_at: Mon, 19 Aug 2024 07:16:57 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml new file mode 100644 index 0000000..60b4c61 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml @@ -0,0 +1,182 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - 69f92027deeb0baa1b3cc91a4fc2b0a9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051816, + "jti" : "fibGyoBMMp+/jt/tl0DI6Y3psV8=" + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.030' + X-B3-Traceid: + - d76f1dd31353f4c98c74c418a4fe7fc5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "2d427037-5968-46e6-b32a-a59f189ebfb2", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.057' + X-B3-Traceid: + - 26a4d23f761f124c1408ca0ea977412a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml new file mode 100644 index 0000000..394f975 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.111' + X-B3-Traceid: + - e0b99fb5d7ea3fa4fee24a224568d657 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052312, + "jti" : "CtoBgVKfRCv3wpVQ9i1Wt0WOr3U=" + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.054' + X-B3-Traceid: + - 4671d01950bc1fa1eb36536e344c3231 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "subscriptions" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml new file mode 100644 index 0000000..f004bef --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml @@ -0,0 +1,186 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - 29853db6da84b038e366c4c73a92e840 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052312, + "jti" : "dEZQvxoGOAVa9WMsx8d3qhjUrcI=" + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.055' + X-B3-Traceid: + - a543aff3022f92da255ecbc32ba6f474 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "2a3707d0-3cc1-462a-84c2-176c5e1cf689", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.038' + X-B3-Traceid: + - fd40a1d4fc79789287c66b0ad0cc1fa2 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml new file mode 100644 index 0000000..a76d87f --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml @@ -0,0 +1,238 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.101' + X-B3-Traceid: + - 4db8dbee6bd5eb98accdbc08e7882f9a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052313, + "jti" : "2ArIrBGdwUsrtgORQ3UHj53FcCk=" + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - a378220db8b2d3339b2fa689ffc28cc8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "a6cbd477-e250-4aaf-85cc-5dc899573a6c", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:25:14 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.035' + X-B3-Traceid: + - f42e017c7d27b95cff64de4d173ad537 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:14 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 07:25:14 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.017' + X-B3-Traceid: + - e017a73d6b541d39e90ca41bf4fbca6c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:14 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml new file mode 100644 index 0000000..67948af --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml @@ -0,0 +1,254 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - c962e7ebc9678a42f7470be9c81b683b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052313, + "jti" : "puBdyxl6qlmDmf+P8r/jL4V1F8c=" + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - f87514392ebcf7dec97dd79d461f0a0e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "50873c4d-97da-4cbb-b221-1b6da35dd1fd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.022' + X-B3-Traceid: + - d8a9409cf4a1a9da9ff09fc8669e2bc4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "50873c4d-97da-4cbb-b221-1b6da35dd1fd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.031' + X-B3-Traceid: + - bcf9b63acbf3b35ea7c6e4e7c89d2b8c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +recorded_with: VCR 6.2.0 From baab83dd6b03ce707e9e0c5d5b3ed395d1ad7837 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 19 Aug 2024 09:38:33 +0200 Subject: [PATCH 41/59] Update tests --- spec/beyond_api/services/shop/address_spec.rb | 12 ++ spec/beyond_api/services/shop/shop_spec.rb | 11 ++ spec/beyond_api/utils_spec.rb | 2 +- .../_get/returns_the_shop_address.yml | 146 ++++++++++++++++ .../_get/returns_the_shop_details.yml | 160 ++++++++++++++++++ 5 files changed, 330 insertions(+), 1 deletion(-) create mode 100644 spec/beyond_api/services/shop/address_spec.rb create mode 100644 spec/beyond_api/services/shop/shop_spec.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml diff --git a/spec/beyond_api/services/shop/address_spec.rb b/spec/beyond_api/services/shop/address_spec.rb new file mode 100644 index 0000000..4393096 --- /dev/null +++ b/spec/beyond_api/services/shop/address_spec.rb @@ -0,0 +1,12 @@ +RSpec.describe BeyondApi::Shop::Address, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".get" do + it "returns the shop address" do + response = client.show + expect(response).not_to be nil + expect(response.keys).to include(:company, :first_name, :last_name, :email, + :phone, :street, :postal_code, :dependent_locality, :city, :state, :country) + end + end +end diff --git a/spec/beyond_api/services/shop/shop_spec.rb b/spec/beyond_api/services/shop/shop_spec.rb new file mode 100644 index 0000000..742f1a5 --- /dev/null +++ b/spec/beyond_api/services/shop/shop_spec.rb @@ -0,0 +1,11 @@ +RSpec.describe BeyondApi::Shop::Shop, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + + describe ".get" do + it "returns the shop details" do + response = client.show + expect(response).not_to be nil + expect(response.keys).to include(:name, :reseller_name, :primary_hostname, :default_locale) + end + end +end diff --git a/spec/beyond_api/utils_spec.rb b/spec/beyond_api/utils_spec.rb index d1c8d85..edc0d72 100644 --- a/spec/beyond_api/utils_spec.rb +++ b/spec/beyond_api/utils_spec.rb @@ -13,6 +13,6 @@ end it "parse snakecase to camelcase" do - expect("sales_price".camelize(false)).to eq "salesPrice" + expect("sales_price".camelize(:lower)).to eq "salesPrice" end end diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml b/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml new file mode 100644 index 0000000..b672485 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml @@ -0,0 +1,146 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:29:59 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - da5289c9d5b4a4f03418f74baa9563e1 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052599, + "jti" : "+3Bi9GKMlZei8yQdrBRl8otJG9o=" + } + recorded_at: Mon, 19 Aug 2024 07:29:58 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/address + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:29:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.139' + X-B3-Traceid: + - 6c81891217360b02b1c94ad8e223efa4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "company" : "Team42", + "firstName" : "Team42", + "lastName" : "Team42", + "email" : "k.salazar@epages.com", + "phone" : "Team42", + "fax" : null, + "street" : "Team42", + "street2" : null, + "postalCode" : "12345", + "dependentLocality" : null, + "city" : "Somewhere", + "state" : "", + "country" : "GB", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" + }, + "address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:29:59 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml b/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml new file mode 100644 index 0000000..3a71722 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml @@ -0,0 +1,160 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:36:16 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.171' + X-B3-Traceid: + - 5d0474f38fa3cd44d8d2db510cc40b8a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052976, + "jti" : "fP5GZ4flKaRAKWsK77zoPkasf58=" + } + recorded_at: Mon, 19 Aug 2024 07:36:16 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:36:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - 2ae749c42757058dbaa58127e4426c42 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "5227687a-aa6b-487c-9c2b-afccf1573cea", + "name" : "Team42 Beyond API", + "resellerName" : "epages", + "primaryHostname" : "team42-beyond-api.beyondshop.cloud", + "fallbackHostname" : "team42-beyond-api.beyondshop.cloud", + "tax" : { + "taxModel" : "GROSS", + "vatExempted" : false, + "country" : "GB", + "supportedTaxClasses" : [ "EXEMPT", "REDUCED", "REGULAR" ] + }, + "currencies" : [ "GBP" ], + "defaultCurrency" : "GBP", + "locales" : [ "en-GB" ], + "defaultLocale" : "en-GB", + "closedByMerchant" : true, + "emailConfirmed" : true, + "socialSharingEnabled" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + }, + "shop" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + }, + "address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images" + }, + "legal" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/legal" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:36:16 GMT +recorded_with: VCR 6.2.0 From 4250ec3b3f52c5f92351a54670eb2fc6793f3c82 Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 19 Aug 2024 09:45:54 +0200 Subject: [PATCH 42/59] Update tests --- spec/beyond_api/services/authentication/signer_spec.rb | 2 +- spec/beyond_api/services/checkout/shipping_zone_spec.rb | 2 +- spec/beyond_api/services/product_management/category_spec.rb | 2 +- spec/beyond_api/services/product_management/image_spec.rb | 2 +- spec/beyond_api/services/product_management/product_spec.rb | 2 +- spec/beyond_api/services/shop/address_spec.rb | 2 +- spec/beyond_api/services/shop/shop_spec.rb | 2 +- spec/beyond_api/services/storefront/script_tag_spec.rb | 2 +- spec/beyond_api/services/webhook/subscription_spec.rb | 2 +- spec/spec_helper.rb | 4 ++++ 10 files changed, 13 insertions(+), 9 deletions(-) diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb index de8bd76..02c0710 100644 --- a/spec/beyond_api/services/authentication/signer_spec.rb +++ b/spec/beyond_api/services/authentication/signer_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::Authentication::Signer, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe '#all' do it 'returns all signers' do diff --git a/spec/beyond_api/services/checkout/shipping_zone_spec.rb b/spec/beyond_api/services/checkout/shipping_zone_spec.rb index 1e58553..292ba2c 100644 --- a/spec/beyond_api/services/checkout/shipping_zone_spec.rb +++ b/spec/beyond_api/services/checkout/shipping_zone_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::Checkout::ShippingZone, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".all" do it "returns all shipping_zones" do diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index 01e048e..47e1564 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::ProductManagement::Category, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".all" do it "returns all categories" do diff --git a/spec/beyond_api/services/product_management/image_spec.rb b/spec/beyond_api/services/product_management/image_spec.rb index 79c14f1..cb839e9 100644 --- a/spec/beyond_api/services/product_management/image_spec.rb +++ b/spec/beyond_api/services/product_management/image_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::ProductManagement::Image, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".all" do it "returns all images" do diff --git a/spec/beyond_api/services/product_management/product_spec.rb b/spec/beyond_api/services/product_management/product_spec.rb index d9b9b90..39bff0a 100644 --- a/spec/beyond_api/services/product_management/product_spec.rb +++ b/spec/beyond_api/services/product_management/product_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::ProductManagement::Product, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".all" do it "returns all products" do diff --git a/spec/beyond_api/services/shop/address_spec.rb b/spec/beyond_api/services/shop/address_spec.rb index 4393096..0f9e5f1 100644 --- a/spec/beyond_api/services/shop/address_spec.rb +++ b/spec/beyond_api/services/shop/address_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::Shop::Address, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".get" do it "returns the shop address" do diff --git a/spec/beyond_api/services/shop/shop_spec.rb b/spec/beyond_api/services/shop/shop_spec.rb index 742f1a5..35b1e11 100644 --- a/spec/beyond_api/services/shop/shop_spec.rb +++ b/spec/beyond_api/services/shop/shop_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::Shop::Shop, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".get" do it "returns the shop details" do diff --git a/spec/beyond_api/services/storefront/script_tag_spec.rb b/spec/beyond_api/services/storefront/script_tag_spec.rb index 81fbe0c..3cbd7f3 100644 --- a/spec/beyond_api/services/storefront/script_tag_spec.rb +++ b/spec/beyond_api/services/storefront/script_tag_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::Storefront::ScriptTag, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".all" do it "returns all script tags" do diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb index 9213b59..e7d024c 100644 --- a/spec/beyond_api/services/webhook/subscription_spec.rb +++ b/spec/beyond_api/services/webhook/subscription_spec.rb @@ -1,5 +1,5 @@ RSpec.describe BeyondApi::Webhook::Subscription, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: auth_client.client_credentials[:access_token]) } + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } describe ".all" do it "returns all webhook subscriptions" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c42004f..c58969a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -39,3 +39,7 @@ def auth_client client_secret: ENV["CLIENT_SECRET"] ) end + +def beyond_access_token + auth_client.client_credentials[:access_token] +end From a555f4bc777e3fb6f32214d5a1a6f6640ff1fea8 Mon Sep 17 00:00:00 2001 From: citin Date: Mon, 19 Aug 2024 10:07:31 +0200 Subject: [PATCH 43/59] replace destroy by delete --- lib/beyond_api/services/authentication/signer.rb | 4 ++-- lib/beyond_api/services/product_management/category.rb | 4 ++-- lib/beyond_api/services/storefront/script_tag.rb | 4 ++-- lib/beyond_api/services/webhook/subscription.rb | 6 +++--- spec/beyond_api/services/authentication/signer_spec.rb | 6 +++--- .../beyond_api/services/product_management/category_spec.rb | 6 +++--- spec/beyond_api/services/storefront/script_tag_spec.rb | 6 +++--- spec/beyond_api/services/webhook/subscription_spec.rb | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 2e67b2d..8c7371f 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -9,8 +9,8 @@ def create post("signers") end - def destroy(id) - delete("signers/#{id}") + def delete(id) + super("signers/#{id}") # Concerns::Connection delete method end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 8e27ebe..e6926ce 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -17,8 +17,8 @@ def update(id, body) put("categories/#{id}", body) end - def destroy(id) - delete("categories/#{id}") + def delete(id) + super("categories/#{id}") # Concerns::Connection delete method end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 6c5eaed..17c5259 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -11,8 +11,8 @@ def create(script_url) post("script-tags", script_url:) end - def destroy(id) - delete("script-tags/#{id}") + def delete(id) + super("script-tags/#{id}") # Concerns::Connection delete method end end end diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 349f80f..2cb4341 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -11,12 +11,12 @@ def create(body) def delete_all all.dig(:embedded, :subscriptions).each do |subscription| - destroy(subscription[:id]) + delete(subscription[:id]) end end - def destroy(id) - delete("webhook-subscriptions/#{id}") + def delete(id) + super("webhook-subscriptions/#{id}") # Concerns::Connection delete method end def find(id) diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb index 02c0710..07fd084 100644 --- a/spec/beyond_api/services/authentication/signer_spec.rb +++ b/spec/beyond_api/services/authentication/signer_spec.rb @@ -20,11 +20,11 @@ end end - describe '#destroy' do + describe '#delete' do it 'deletes a signer' do - response = client.destroy(@signer[:id]) + response = client.delete(@signer[:id]) expect(response).to be {} end end end -end \ No newline at end of file +end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index 47e1564..dd6f2c3 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -43,15 +43,15 @@ end end - describe ".destroy" do + describe ".delete" do it "deletes a category" do - response = client.destroy(@category[:id]) + response = client.delete(@category[:id]) expect(response).to be {} end end after(:each) do - client.destroy(@category[:id]) + client.delete(@category[:id]) rescue BeyondApi::Error end end diff --git a/spec/beyond_api/services/storefront/script_tag_spec.rb b/spec/beyond_api/services/storefront/script_tag_spec.rb index 3cbd7f3..89b0581 100644 --- a/spec/beyond_api/services/storefront/script_tag_spec.rb +++ b/spec/beyond_api/services/storefront/script_tag_spec.rb @@ -23,15 +23,15 @@ end end - describe ".destroy" do + describe ".delete" do it "deletes a script tag" do - response = client.destroy(@script_tag[:id]) + response = client.delete(@script_tag[:id]) expect(response).to be {} end end after(:each) do - client.destroy(@script_tag[:id]) + client.delete(@script_tag[:id]) rescue BeyondApi::Error end end diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb index e7d024c..48d59f4 100644 --- a/spec/beyond_api/services/webhook/subscription_spec.rb +++ b/spec/beyond_api/services/webhook/subscription_spec.rb @@ -31,15 +31,15 @@ end end - describe ".destroy" do + describe ".delete" do it "deletes a webhook subscription" do - response = client.destroy(@webhook_subscription[:id]) + response = client.delete(@webhook_subscription[:id]) expect(response).to be {} end end after(:each) do - client.destroy(@webhook_subscription[:id]) + client.delete(@webhook_subscription[:id]) rescue BeyondApi::Error end end From 776c62d212dfb6a92d49a8fe107493d807b4a02b Mon Sep 17 00:00:00 2001 From: k4th Date: Mon, 19 Aug 2024 11:07:18 +0200 Subject: [PATCH 44/59] Add recordings --- .../with_signer/_delete/deletes_a_signer.yml | 185 +++++++++++++ .../_delete/deletes_a_category.yml | 247 ++++++++++++++++++ .../_delete/deletes_a_script_tag.yml | 242 +++++++++++++++++ .../deletes_a_webhook_subscription.yml | 238 +++++++++++++++++ 4 files changed, 912 insertions(+) create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml new file mode 100644 index 0000000..dc2e937 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml @@ -0,0 +1,185 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:22:59 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.139' + X-B3-Traceid: + - 27d6f6696bed6e3f01e81ab3577000d5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055779, + "jti" : "l7k8DMT7GM5WeH61G8VGwETkteM=" + } + recorded_at: Mon, 19 Aug 2024 08:22:59 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.041' + X-B3-Traceid: + - 6e71c1fa205231a52c7a58429b64b89b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "92cb69c7-a830-4312-9dae-ffcf6603bba7", + "sharedSecret" : "u3v38frnqt59vka22kqaumpgft", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/92cb69c7-a830-4312-9dae-ffcf6603bba7" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/signers/92cb69c7-a830-4312-9dae-ffcf6603bba7 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.043' + X-B3-Traceid: + - 34a99a554db99d028a1c47648840cf07 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml new file mode 100644 index 0000000..22cb4c8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml @@ -0,0 +1,247 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.095' + X-B3-Traceid: + - 55b33c0580da9f9255ff6ffdb6f8af47 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055780, + "jti" : "bo9G/OG2JbjIQVLDljv+XfIwu/Q=" + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.051' + X-B3-Traceid: + - a91a846530581b514551ae5ee861fdc4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "28171a9e-43d6-4786-9f1d-780152649363", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - fac194a82965a2f8226f3faa67af0b34 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.013' + X-B3-Traceid: + - 6ba81a6b755682d168eecfa9c913f84e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "resource-not-found", + "details" : { }, + "message" : "No Category found for '28171a9e-43d6-4786-9f1d-780152649363'", + "traceId" : "6ba81a6b755682d168eecfa9c913f84e" + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml new file mode 100644 index 0000000..634ca55 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml @@ -0,0 +1,242 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.097' + X-B3-Traceid: + - 2cd075d0bf0e39ff6109d213e139fb9e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055781, + "jti" : "C6UJPHY9f5Dc8FU43LVeiN2zoWw=" + } + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - d1f65daa2ab4973f56910dfe9abd53c6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "861516c1-32ce-4dfe-8bb7-f36d30194eed", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.049' + X-B3-Traceid: + - a28101666148e32f48b4e2d4a98f4e39 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.023' + X-B3-Traceid: + - 4da97a350edaea722e1135e1570c732d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "script-tag.not-found", + "details" : { }, + "message" : "script-tag with id 861516c1-32ce-4dfe-8bb7-f36d30194eed could not be found", + "traceId" : "4da97a350edaea722e1135e1570c732d" + } + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml new file mode 100644 index 0000000..53cbeb6 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml @@ -0,0 +1,238 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.160' + X-B3-Traceid: + - 661b0474ff0beed08492404ba4b3246e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055782, + "jti" : "etTNATIXyAYxSmeXKD6CSUrTCNs=" + } + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.054' + X-B3-Traceid: + - db202fddc69411adc9750a7a93eb1f36 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "ba3d5330-ed1d-440d-abce-7ad54c3f0d08", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - d0c2be1d708e5ef0cd3eb8dadf70b2c1 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.019' + X-B3-Traceid: + - 455eabf287b14c709350c96903b48836 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +recorded_with: VCR 6.2.0 From fe61dae3937617dfa478b1fef56cde0fe6da6aaf Mon Sep 17 00:00:00 2001 From: citin Date: Mon, 19 Aug 2024 12:30:56 +0200 Subject: [PATCH 45/59] fix rubocop linter --- .rubocop.yml | 38 +++++++++------ Gemfile | 14 +++--- Gemfile.lock | 7 +++ Rakefile | 8 ++-- beyond_api.gemspec | 45 +++++++++--------- lib/beyond_api.rb | 12 ++--- lib/beyond_api/all_pages_handler.rb | 2 + lib/beyond_api/concerns/connection.rb | 8 ++-- lib/beyond_api/configuration.rb | 2 + lib/beyond_api/response.rb | 2 +- .../services/authentication/signer.rb | 6 ++- .../services/authentication/token.rb | 8 ++-- lib/beyond_api/services/base_service.rb | 2 + .../services/checkout/shipping_zone.rb | 4 +- .../services/product_management/category.rb | 6 ++- .../services/product_management/image.rb | 2 + .../services/product_management/product.rb | 6 ++- .../services/product_management/variation.rb | 2 + .../product_management/variation_image.rb | 4 +- .../services/product_view/category.rb | 6 ++- lib/beyond_api/services/shop/address.rb | 4 +- lib/beyond_api/services/shop/shop.rb | 4 +- .../services/storefront/script_tag.rb | 6 ++- .../services/webhook/subscription.rb | 6 ++- lib/beyond_api/utils.rb | 14 +++--- lib/beyond_api/version.rb | 2 +- .../beyond_api/install_generator.rb | 4 +- .../templates/beyond_api_initializer.rb | 3 +- .../services/authentication/signer_spec.rb | 8 ++-- .../services/authentication/token_spec.rb | 20 ++++---- .../services/checkout/shipping_zone_spec.rb | 10 ++-- .../product_management/category_spec.rb | 44 +++++++++--------- .../services/product_management/image_spec.rb | 12 +++-- .../product_management/product_spec.rb | 30 ++++++------ spec/beyond_api/services/shop/address_spec.rb | 8 ++-- spec/beyond_api/services/shop/shop_spec.rb | 8 ++-- .../services/storefront/script_tag_spec.rb | 28 +++++------ .../services/webhook/subscription_spec.rb | 34 +++++++------- spec/beyond_api/utils_spec.rb | 10 ++-- spec/beyond_api_spec.rb | 2 +- spec/factories/category_data.rb | 14 +++--- spec/factories/product_data.rb | 46 ++++++++++--------- spec/factories/products.rb | 30 ++++++------ spec/factories/webhook_data.rb | 6 ++- spec/spec_helper.rb | 24 +++++----- spec/support/vcr.rb | 30 ++++++------ 46 files changed, 334 insertions(+), 257 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 255afa0..e35e523 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,38 +1,46 @@ require: - - rubocop-rspec + - rubocop-rails + +# Enable all new cops by default AllCops: - Exclude: - - spec/**/*.rb NewCops: enable + Exclude: + - bin/* + - spec/dummy/bin/* + - spec/dummy/db/schema.rb -Style/StringLiterals: - EnforcedStyle: double_quotes +# Disable not wanted cops Metrics/AbcSize: Enabled: false Metrics/MethodLength: Enabled: false -Metrics/BlockLength: - Enabled: false Metrics/ClassLength: Enabled: false Style/Documentation: Enabled: false +Metrics/BlockLength: + Enabled: false Metrics/CyclomaticComplexity: Enabled: false Metrics/PerceivedComplexity: Enabled: false - -Layout/LineLength: - IgnoredPatterns: ['(\A|\s)#'] - -Style/AsciiComments: +Rails/ContentTag: + Enabled: false +Style/HashAsLastArrayItem: + Enabled: false +Naming/VariableNumber: + Enabled: false +Gemspec/DevelopmentDependencies: Enabled: false +# Prefer to use brackets on symbol arrays + Style/SymbolArray: EnforcedStyle: brackets -# disable Gemspec/DevelopmentDependencies -Gemspec/DevelopmentDependencies: - Enabled: false +# Prefer to use always lambda literals (->) + +Style/Lambda: + EnforcedStyle: literal diff --git a/Gemfile b/Gemfile index a46f237..6eff208 100644 --- a/Gemfile +++ b/Gemfile @@ -1,19 +1,19 @@ # frozen_string_literal: true -source "https://rubygems.org" +source 'https://rubygems.org' # Specify your gem's dependencies in beyond_api.gemspec gemspec -gem "pry" +gem 'pry' group :development do - gem "rubocop" + gem 'rubocop' end group :test do - gem "factory_bot" - gem "jwt" - gem "vcr" - gem "webmock" + gem 'factory_bot' + gem 'jwt' + gem 'vcr' + gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 9ea306e..dd83a2c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,6 +67,7 @@ GEM method_source (~> 1.0) public_suffix (6.0.1) racc (1.8.1) + rack (3.1.7) rainbow (3.1.1) rake (10.5.0) regexp_parser (2.9.2) @@ -102,6 +103,11 @@ GEM rubocop (~> 1.41) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) + rubocop-rails (2.25.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) rubocop-rspec (2.31.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -139,6 +145,7 @@ DEPENDENCIES rake (~> 10.0) rspec (~> 3.0) rubocop + rubocop-rails (~> 2.14) rubocop-rspec (~> 2.4) vcr webmock diff --git a/Rakefile b/Rakefile index 1f2d774..2e5f17c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,13 +1,13 @@ # frozen_string_literal: true -require "bundler/gem_tasks" -require "rspec/core/rake_task" -require "yard" +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' +require 'yard' RSpec::Core::RakeTask.new(:spec) task default: :spec YARD::Rake::YardocTask.new do |t| - t.files = ["lib/**/*.rb"] + t.files = ['lib/**/*.rb'] end diff --git a/beyond_api.gemspec b/beyond_api.gemspec index bafe560..96a9bcc 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -1,38 +1,39 @@ # frozen_string_literal: true -lib = File.expand_path("lib", __dir__) +lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "beyond_api/version" +require 'beyond_api/version' Gem::Specification.new do |spec| - spec.name = "beyond_api" + spec.name = 'beyond_api' spec.version = BeyondApi::VERSION - spec.authors = ["Unai Abrisketa", "Kathia Salazar", "German San Emeterio", "Kenneth Gallego", "Andrés Bernardi"] - spec.summary = "Ruby client to access the Beyond API" - spec.homepage = "https://github.com/ePages-de/beyond_api-ruby_client" + spec.authors = ['Unai Abrisketa', 'Kathia Salazar', 'German San Emeterio', 'Kenneth Gallego', 'Andrés Bernardi'] + spec.summary = 'Ruby client to access the Beyond API' + spec.homepage = 'https://github.com/ePages-de/beyond_api-ruby_client' spec.files = Dir.chdir(File.expand_path(__dir__)) do `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } end - spec.bindir = "exe" + spec.bindir = 'exe' spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] - spec.required_ruby_version = ">= 3.0" + spec.required_ruby_version = '>= 3.3' - spec.add_development_dependency "bundler", "~> 2.0" - spec.add_development_dependency "dotenv", "~> 2.7" - spec.add_development_dependency "faker", "~> 2.2" - spec.add_development_dependency "rake", "~> 10.0" - spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "rubocop", "~> 1.20" - spec.add_development_dependency "rubocop-rspec", "~> 2.4" - spec.add_development_dependency "yard", "~> 0.9" + spec.add_development_dependency 'bundler', '~> 2.0' + spec.add_development_dependency 'dotenv', '~> 2.7' + spec.add_development_dependency 'faker', '~> 2.2' + spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'rubocop', '~> 1.20' + spec.add_development_dependency 'rubocop-rails', '~> 2.14' + spec.add_development_dependency 'rubocop-rspec', '~> 2.4' + spec.add_development_dependency 'yard', '~> 0.9' - spec.add_dependency "activesupport", "~> 7.0" - spec.add_dependency "faraday", "~> 2.10.0" - spec.add_dependency "faraday-retry" - spec.add_dependency "zeitwerk" + spec.add_dependency 'activesupport', '~> 7.0' + spec.add_dependency 'faraday', '~> 2.10.0' + spec.add_dependency 'faraday-retry' + spec.add_dependency 'zeitwerk' - spec.metadata["rubygems_mfa_required"] = "true" + spec.metadata['rubygems_mfa_required'] = 'true' end diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index a6da35e..7c5c075 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require "active_support/all" -require "faraday" -require "faraday/retry" -require "forwardable" -require "json" -require "zeitwerk" +require 'active_support/all' +require 'faraday' +require 'faraday/retry' +require 'forwardable' +require 'json' +require 'zeitwerk' module BeyondApi loader = Zeitwerk::Loader.for_gem diff --git a/lib/beyond_api/all_pages_handler.rb b/lib/beyond_api/all_pages_handler.rb index 9e1a5e5..ebce66e 100644 --- a/lib/beyond_api/all_pages_handler.rb +++ b/lib/beyond_api/all_pages_handler.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi class AllPagesHandler include Concerns::Connection diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 806a3b9..fe2b5ac 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -54,13 +54,13 @@ def agent # Authorization faraday.request :authorization, *authorization_config # Headers - faraday.headers["Accept"] = "application/json" # Set default accept header - faraday.headers["Content-Type"] = "application/json" # Set default content type + faraday.headers['Accept'] = 'application/json' # Set default accept header + faraday.headers['Content-Type'] = 'application/json' # Set default content type # Request options faraday.request :json # Encode request bodies as JSON faraday.request :retry, BeyondApi.configuration.retry_options # Response options - faraday.response :json, content_type: "application/json" + faraday.response :json, content_type: 'application/json' faraday.response :logger, *logger_config { |logger| apply_filters(logger) } end end @@ -70,7 +70,7 @@ def authorization_config when :basic [:basic, BeyondApi.configuration.client_id, BeyondApi.configuration.client_secret] when :bearer - ["Bearer", @session.access_token] + ['Bearer', @session.access_token] end end diff --git a/lib/beyond_api/configuration.rb b/lib/beyond_api/configuration.rb index 76671db..87e3997 100644 --- a/lib/beyond_api/configuration.rb +++ b/lib/beyond_api/configuration.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi class Configuration attr_accessor :client_id, :client_secret, diff --git a/lib/beyond_api/response.rb b/lib/beyond_api/response.rb index 88caf24..5d8683e 100644 --- a/lib/beyond_api/response.rb +++ b/lib/beyond_api/response.rb @@ -27,7 +27,7 @@ def parsed_response end def remove_initial_underscore(key) - key.to_s.starts_with?("_") ? key[1..] : key + key.to_s.starts_with?('_') ? key[1..] : key end def snake_case_key(key) diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 8c7371f..7e1996a 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + module BeyondApi module Authentication class Signer < BaseService def all(params = {}) - get("signers", params) + get('signers', params) end def create - post("signers") + post('signers') end def delete(id) diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb index 464453c..c0bd137 100644 --- a/lib/beyond_api/services/authentication/token.rb +++ b/lib/beyond_api/services/authentication/token.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi module Authentication class Token < BaseService @@ -11,15 +13,15 @@ def initialize(**params) end def refresh(refresh_token) - post("oauth/token", {}, { grant_type: "refresh_token", refresh_token: }) + post('oauth/token', {}, { grant_type: 'refresh_token', refresh_token: }) end def get(code) - post("oauth/token", {}, { grant_type: "authorization_code", code: }) + post('oauth/token', {}, { grant_type: 'authorization_code', code: }) end def client_credentials - post("oauth/token", {}, { grant_type: "client_credentials" }) + post('oauth/token', {}, { grant_type: 'client_credentials' }) end end end diff --git a/lib/beyond_api/services/base_service.rb b/lib/beyond_api/services/base_service.rb index 1bb0089..7fb4c53 100644 --- a/lib/beyond_api/services/base_service.rb +++ b/lib/beyond_api/services/base_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi class BaseService include Concerns::Connection # @session, @authorization diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb index d2836c1..ab7d788 100644 --- a/lib/beyond_api/services/checkout/shipping_zone.rb +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module BeyondApi module Checkout class ShippingZone < BaseService def all - get("shipping-zones") + get('shipping-zones') end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index e6926ce..647650a 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi module ProductManagement class Category < BaseService @@ -6,11 +8,11 @@ def find(id) end def all(params = {}) - fetch_all_pages("categories", params) + fetch_all_pages('categories', params) end def create(body) - post("categories", body) + post('categories', body) end def update(id, body) diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 658af3c..6fd17b5 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi module ProductManagement class Image < BaseService diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 31a6f77..c947f3f 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - fetch_all_pages("products", params) + fetch_all_pages('products', params) end def create(body) - post("products", body) + post('products', body) end def find(id) diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 1af3319..223b14f 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module BeyondApi module ProductManagement class Variation < BaseService diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb index 4a3367b..fa4c9d0 100644 --- a/lib/beyond_api/services/product_management/variation_image.rb +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + module BeyondApi module ProductManagement class VariationImage < BaseService - def all(product_id, variation_id, params = {}) + def all(product_id, variation_id, _params = {}) get("products/#{product_id}/variations/#{variation_id}/images") end end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index 5cb1efc..9f16499 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module BeyondApi module ProductView class Category < BaseService def all(params = {}) - fetch_all_pages("product-view/categories", params) + fetch_all_pages('product-view/categories', params) end def find(id) @@ -10,7 +12,7 @@ def find(id) end def preview(body, params = {}) - post("product-view/categories/preview", body, params) + post('product-view/categories/preview', body, params) end end end diff --git a/lib/beyond_api/services/shop/address.rb b/lib/beyond_api/services/shop/address.rb index cca88aa..800872d 100644 --- a/lib/beyond_api/services/shop/address.rb +++ b/lib/beyond_api/services/shop/address.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module BeyondApi module Shop class Address < BaseService def show - get("shop/address") + get('shop/address') end end end diff --git a/lib/beyond_api/services/shop/shop.rb b/lib/beyond_api/services/shop/shop.rb index d360de1..757c314 100644 --- a/lib/beyond_api/services/shop/shop.rb +++ b/lib/beyond_api/services/shop/shop.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module BeyondApi module Shop class Shop < BaseService def show - get("shop") + get('shop') end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 17c5259..79ffebe 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -1,14 +1,16 @@ +# frozen_string_literal: true + module BeyondApi module Storefront class ScriptTag < BaseService def all(params = {}) params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] - get("script-tags", params) + get('script-tags', params) end def create(script_url) - post("script-tags", script_url:) + post('script-tags', script_url:) end def delete(id) diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 2cb4341..51e3a97 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + module BeyondApi module Webhook class Subscription < BaseService def all(params = {}) - get("webhook-subscriptions", params) + get('webhook-subscriptions', params) end def create(body) - post("webhook-subscriptions", body) + post('webhook-subscriptions', body) end def delete_all diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index 755f294..095354c 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true -require "ostruct" +require 'ostruct' module BeyondApi module Utils def self.file_content_type(file_path) case File.extname(file_path) - when ".png" - "image/png" - when ".jpg", ".jpeg" - "image/jpeg" - when ".gif" - "image/gif" + when '.png' + 'image/png' + when '.jpg', '.jpeg' + 'image/jpeg' + when '.gif' + 'image/gif' end end diff --git a/lib/beyond_api/version.rb b/lib/beyond_api/version.rb index f9e169e..0542a9a 100644 --- a/lib/beyond_api/version.rb +++ b/lib/beyond_api/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module BeyondApi - VERSION = "0.24.2.pre" + VERSION = '0.24.2.pre' end diff --git a/lib/generators/beyond_api/install_generator.rb b/lib/generators/beyond_api/install_generator.rb index d1d61e5..e132c59 100644 --- a/lib/generators/beyond_api/install_generator.rb +++ b/lib/generators/beyond_api/install_generator.rb @@ -3,10 +3,10 @@ module BeyondApi module Generators class InstallGenerator < Rails::Generators::Base - source_root File.expand_path("../templates", __dir__) + source_root File.expand_path('../templates', __dir__) def copy_initializer - template "beyond_api_initializer.rb", "config/initializers/beyond_api.rb" + template 'beyond_api_initializer.rb', 'config/initializers/beyond_api.rb' end end end diff --git a/lib/generators/templates/beyond_api_initializer.rb b/lib/generators/templates/beyond_api_initializer.rb index 7341fb4..7e6218f 100644 --- a/lib/generators/templates/beyond_api_initializer.rb +++ b/lib/generators/templates/beyond_api_initializer.rb @@ -12,7 +12,8 @@ # Configure the request timeout in seconds. Default is 5 seconds. # config.timeout = 5.seconds - # Configure the pagination size when `paginated: false` is sent on `.all()` requests. Value must be between 1 and 1000. + # Configure the pagination size when `paginated: false` is sent on `.all()` requests. + # Value must be between 1 and 1000. # config.all_pagination_size = 200 # ==> Log configuration diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb index 07fd084..8bf53b2 100644 --- a/spec/beyond_api/services/authentication/signer_spec.rb +++ b/spec/beyond_api/services/authentication/signer_spec.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Authentication::Signer, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } describe '#all' do it 'returns all signers' do @@ -9,7 +11,7 @@ end end - context "with signer" do + context 'with signer' do before(:each) do @signer = client.create end @@ -23,7 +25,7 @@ describe '#delete' do it 'deletes a signer' do response = client.delete(@signer[:id]) - expect(response).to be {} + expect(response).to eq({}) end end end diff --git a/spec/beyond_api/services/authentication/token_spec.rb b/spec/beyond_api/services/authentication/token_spec.rb index 35d6f4b..b1dce82 100644 --- a/spec/beyond_api/services/authentication/token_spec.rb +++ b/spec/beyond_api/services/authentication/token_spec.rb @@ -1,22 +1,24 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Authentication::Token, vcr: true do - it "retrieves token via client credentials" do + it 'retrieves token via client credentials' do response = auth_client.client_credentials + expect(response).not_to be nil expect(response[:access_token].class).to be(String) expect(response[:refresh_token]).to be(nil) end - it "retrieves token via authorization code" do - expect { - response = auth_client.get('abcde') - }.to raise_error(BeyondApi::Error) do |error| - expect(error.response[:error]).to eq("invalid_grant") - expect(error.response[:error_description]).to eq("Invalid authorization code: abcde") + it 'retrieves token via authorization code' do + expect { auth_client.get('abcde') }.to raise_error(BeyondApi::Error) do |error| + expect(error.response[:error]).to eq('invalid_grant') + expect(error.response[:error_description]).to eq('Invalid authorization code: abcde') end end - it "refreshes the token" do - response = auth_client.refresh(ENV["REFRESH_TOKEN"]) + it 'refreshes the token' do + response = auth_client.refresh(ENV.fetch('REFRESH_TOKEN', nil)) + expect(response).not_to be nil expect(response[:access_token].class).to be(String) expect(response[:refresh_token].class).to be(String) diff --git a/spec/beyond_api/services/checkout/shipping_zone_spec.rb b/spec/beyond_api/services/checkout/shipping_zone_spec.rb index 292ba2c..8abbd33 100644 --- a/spec/beyond_api/services/checkout/shipping_zone_spec.rb +++ b/spec/beyond_api/services/checkout/shipping_zone_spec.rb @@ -1,13 +1,15 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Checkout::ShippingZone, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".all" do - it "returns all shipping_zones" do + describe '.all' do + it 'returns all shipping_zones' do response = client.all expect(response).not_to be nil expect(response.dig(:embedded, :shipping_zones)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) + expect(response[:page]).to be_kind_of(Hash) end end end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index dd6f2c3..21504d6 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -1,58 +1,60 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::ProductManagement::Category, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".all" do - it "returns all categories" do + describe '.all' do + it 'returns all categories' do response = client.all expect(response).not_to be nil expect(response.dig(:embedded, :categories)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) + expect(response[:page]).to be_kind_of(Hash) end end - context "with category" do + context 'with category' do before(:each) do @category = client.create(build(:category_data)) end - describe ".create" do - it "creates a new category" do + describe '.create' do + it 'creates a new category' do expect(@category).not_to be nil - expect(@category[:name]).to eq("Team42 Category") - expect(@category[:type]).to eq("SMART") - expect(@category[:default_sort]).to eq("HIGHEST_PRICE_FIRST") + expect(@category[:name]).to eq('Team42 Category') + expect(@category[:type]).to eq('SMART') + expect(@category[:default_sort]).to eq('HIGHEST_PRICE_FIRST') end end - describe ".find" do - it "returns a category" do + describe '.find' do + it 'returns a category' do response = client.find(@category[:id]) - expect(response[:name]).to eq("Team42 Category") + expect(response[:name]).to eq('Team42 Category') end end - describe ".update" do - it "updates an existing category" do + describe '.update' do + it 'updates an existing category' do updated_category_data = FactoryBot.build(:category_data, :lowest_price_first) updated_category = client.update(@category[:id], updated_category_data) expect(updated_category).not_to be nil - expect(updated_category[:name]).to eq("Category with lowest price first") - expect(updated_category[:default_sort]).to eq("LOWEST_PRICE_FIRST") + expect(updated_category[:name]).to eq('Category with lowest price first') + expect(updated_category[:default_sort]).to eq('LOWEST_PRICE_FIRST') end end - describe ".delete" do - it "deletes a category" do + describe '.delete' do + it 'deletes a category' do response = client.delete(@category[:id]) - expect(response).to be {} + expect(response).to eq({}) end end after(:each) do client.delete(@category[:id]) - rescue BeyondApi::Error + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException end end end diff --git a/spec/beyond_api/services/product_management/image_spec.rb b/spec/beyond_api/services/product_management/image_spec.rb index cb839e9..0fe5897 100644 --- a/spec/beyond_api/services/product_management/image_spec.rb +++ b/spec/beyond_api/services/product_management/image_spec.rb @@ -1,13 +1,15 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::ProductManagement::Image, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".all" do - it "returns all images" do - response = client.all("4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc") + describe '.all' do + it 'returns all images' do + response = client.all('4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc') expect(response).not_to be nil expect(response.dig(:embedded, :images)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) + expect(response[:page]).to be_kind_of(Hash) end end end diff --git a/spec/beyond_api/services/product_management/product_spec.rb b/spec/beyond_api/services/product_management/product_spec.rb index 39bff0a..b6b6fe7 100644 --- a/spec/beyond_api/services/product_management/product_spec.rb +++ b/spec/beyond_api/services/product_management/product_spec.rb @@ -1,35 +1,37 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::ProductManagement::Product, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".all" do - it "returns all products" do + describe '.all' do + it 'returns all products' do response = client.all expect(response).not_to be nil expect(response.dig(:embedded, :products)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) + expect(response[:page]).to be_kind_of(Hash) end end - context "with product" do + context 'with product' do before(:each) do @product = client.create(build(:product_data)) end - describe ".create" do - it "creates a new product" do + describe '.create' do + it 'creates a new product' do expect(@product).not_to be nil - expect(@product[:name]).to eq("Team42 Product") - expect(@product[:essential_features]).to eq("Dry. 12% alcohol. Best vine variety.") - expect(@product[:tags]).to eq(["Bestseller", "Red Wine", "Sale"]) - expect(@product[:product_identifiers]).to eq([{ type: "EAN", value: "9780134308135" }]) + expect(@product[:name]).to eq('Team42 Product') + expect(@product[:essential_features]).to eq('Dry. 12% alcohol. Best vine variety.') + expect(@product[:tags]).to eq(['Bestseller', 'Red Wine', 'Sale']) + expect(@product[:product_identifiers]).to eq([{ type: 'EAN', value: '9780134308135' }]) end end - describe ".find" do - it "returns a product" do + describe '.find' do + it 'returns a product' do response = client.find(@product[:id]) - expect(response[:name]).to eq("Team42 Product") + expect(response[:name]).to eq('Team42 Product') end end end diff --git a/spec/beyond_api/services/shop/address_spec.rb b/spec/beyond_api/services/shop/address_spec.rb index 0f9e5f1..78a9505 100644 --- a/spec/beyond_api/services/shop/address_spec.rb +++ b/spec/beyond_api/services/shop/address_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Shop::Address, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".get" do - it "returns the shop address" do + describe '.get' do + it 'returns the shop address' do response = client.show expect(response).not_to be nil expect(response.keys).to include(:company, :first_name, :last_name, :email, diff --git a/spec/beyond_api/services/shop/shop_spec.rb b/spec/beyond_api/services/shop/shop_spec.rb index 35b1e11..4920295 100644 --- a/spec/beyond_api/services/shop/shop_spec.rb +++ b/spec/beyond_api/services/shop/shop_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Shop::Shop, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".get" do - it "returns the shop details" do + describe '.get' do + it 'returns the shop details' do response = client.show expect(response).not_to be nil expect(response.keys).to include(:name, :reseller_name, :primary_hostname, :default_locale) diff --git a/spec/beyond_api/services/storefront/script_tag_spec.rb b/spec/beyond_api/services/storefront/script_tag_spec.rb index 89b0581..36b497f 100644 --- a/spec/beyond_api/services/storefront/script_tag_spec.rb +++ b/spec/beyond_api/services/storefront/script_tag_spec.rb @@ -1,38 +1,40 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Storefront::ScriptTag, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".all" do - it "returns all script tags" do + describe '.all' do + it 'returns all script tags' do response = client.all expect(response).not_to be nil expect(response.dig(:embedded, :script_tags)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) + expect(response[:page]).to be_kind_of(Hash) end end - context "with script tag" do + context 'with script tag' do before(:each) do - @script_tag = client.create("https://example.com/scripts/exampleScript.js") + @script_tag = client.create('https://example.com/scripts/exampleScript.js') end - describe ".create" do - it "creates a new category" do + describe '.create' do + it 'creates a new category' do expect(@script_tag).not_to be nil - expect(@script_tag[:script_url]).to eq("https://example.com/scripts/exampleScript.js") + expect(@script_tag[:script_url]).to eq('https://example.com/scripts/exampleScript.js') end end - describe ".delete" do - it "deletes a script tag" do + describe '.delete' do + it 'deletes a script tag' do response = client.delete(@script_tag[:id]) - expect(response).to be {} + expect(response).to eq({}) end end after(:each) do client.delete(@script_tag[:id]) - rescue BeyondApi::Error + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException end end end diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb index 48d59f4..3a045e3 100644 --- a/spec/beyond_api/services/webhook/subscription_spec.rb +++ b/spec/beyond_api/services/webhook/subscription_spec.rb @@ -1,46 +1,48 @@ +# frozen_string_literal: true + RSpec.describe BeyondApi::Webhook::Subscription, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } - describe ".all" do - it "returns all webhook subscriptions" do + describe '.all' do + it 'returns all webhook subscriptions' do response = client.all expect(response).not_to be nil expect(response.dig(:embedded, :subscriptions)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) + expect(response[:page]).to be_kind_of(Hash) end end - context "with webhook subscription" do + context 'with webhook subscription' do before(:each) do @webhook_subscription = client.create(build(:webhook_data)) end - describe ".create" do - it "creates a new webhook subscription" do + describe '.create' do + it 'creates a new webhook subscription' do expect(@webhook_subscription).not_to be nil - expect(@webhook_subscription[:callback_uri]).to eq("http://example.com/test") - expect(@webhook_subscription[:event_types]).to eq(["order.created", "product.created"]) + expect(@webhook_subscription[:callback_uri]).to eq('http://example.com/test') + expect(@webhook_subscription[:event_types]).to eq(['order.created', 'product.created']) end end - describe ".find" do - it "returns a webhook subscription" do + describe '.find' do + it 'returns a webhook subscription' do response = client.find(@webhook_subscription[:id]) - expect(response[:callback_uri]).to eq("http://example.com/test") + expect(response[:callback_uri]).to eq('http://example.com/test') end end - describe ".delete" do - it "deletes a webhook subscription" do + describe '.delete' do + it 'deletes a webhook subscription' do response = client.delete(@webhook_subscription[:id]) - expect(response).to be {} + expect(response).to eq({}) end end after(:each) do client.delete(@webhook_subscription[:id]) - rescue BeyondApi::Error + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException end end end diff --git a/spec/beyond_api/utils_spec.rb b/spec/beyond_api/utils_spec.rb index edc0d72..fd22958 100644 --- a/spec/beyond_api/utils_spec.rb +++ b/spec/beyond_api/utils_spec.rb @@ -2,17 +2,17 @@ RSpec.describe 'BeyondApi::Utils' do let!(:file_path) do - app_root = File.expand_path(File.dirname("ext.rb")) + app_root = File.expand_path(File.dirname('ext.rb')) "#{app_root}/spec/files/" end - it "return image content type" do + it 'return image content type' do file = "#{file_path}image1.png" - expect(BeyondApi::Utils.file_content_type(file)).to eq "image/png" + expect(BeyondApi::Utils.file_content_type(file)).to eq 'image/png' end - it "parse snakecase to camelcase" do - expect("sales_price".camelize(:lower)).to eq "salesPrice" + it 'parse snakecase to camelcase' do + expect('sales_price'.camelize(:lower)).to eq 'salesPrice' end end diff --git a/spec/beyond_api_spec.rb b/spec/beyond_api_spec.rb index 71fe28e..362cb39 100644 --- a/spec/beyond_api_spec.rb +++ b/spec/beyond_api_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe BeyondApi do - it "has a version number" do + it 'has a version number' do expect(BeyondApi::VERSION).not_to be nil end end diff --git a/spec/factories/category_data.rb b/spec/factories/category_data.rb index 8f28256..d150967 100644 --- a/spec/factories/category_data.rb +++ b/spec/factories/category_data.rb @@ -1,12 +1,14 @@ -FactoryBot.define do +# frozen_string_literal: true + +FactoryBot.define do factory :category_data, class: Hash do - name { "Team42 Category" } - type { "SMART" } - default_sort { "HIGHEST_PRICE_FIRST" } + name { 'Team42 Category' } + type { 'SMART' } + default_sort { 'HIGHEST_PRICE_FIRST' } trait :lowest_price_first do - name { "Category with lowest price first" } - default_sort { "LOWEST_PRICE_FIRST" } + name { 'Category with lowest price first' } + default_sort { 'LOWEST_PRICE_FIRST' } end initialize_with { attributes } diff --git a/spec/factories/product_data.rb b/spec/factories/product_data.rb index 67e6f28..8f08410 100644 --- a/spec/factories/product_data.rb +++ b/spec/factories/product_data.rb @@ -1,51 +1,53 @@ +# frozen_string_literal: true + FactoryBot.define do factory :product_data, class: Hash do - name { "Team42 Product" } + name { 'Team42 Product' } description { "Spain\nRioja Tempranillo" } - manufacturer { "Grape Vineyard" } - essential_features { "Dry. 12% alcohol. Best vine variety." } - tags { ["Bestseller", "Red Wine", "Sale"] } + manufacturer { 'Grape Vineyard' } + essential_features { 'Dry. 12% alcohol. Best vine variety.' } + tags { ['Bestseller', 'Red Wine', 'Sale'] } product_identifiers do [ { - type: "EAN", - value: "9780134308135" + type: 'EAN', + value: '9780134308135' } ] end sales_price do { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 8.7, - currency: "GBP" + currency: 'GBP' } end list_price do { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 10.95, - currency: "GBP" + currency: 'GBP' } end manufacturer_price do { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 11.95, - currency: "GBP" + currency: 'GBP' } end visible { true } - tax_class { "REGULAR" } + tax_class { 'REGULAR' } shipping_weight do { value: 1175.0, - display_unit: "GRAMS" + display_unit: 'GRAMS' } end @@ -62,12 +64,12 @@ ref_price do { ref_quantity: 1, - unit: "LITER", + unit: 'LITER', quantity: 0.75, price: { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 11.6, - currency: "GBP" + currency: 'GBP' } } end @@ -76,7 +78,7 @@ { min: 2, max: 4, - display_unit: "WEEKS" + display_unit: 'WEEKS' } end @@ -84,16 +86,16 @@ { min: 1, max: 2, - display_unit: "WEEKS" + display_unit: 'WEEKS' } end product_labels do [ { - type: "NEW", - active_from: "2024-08-13T11:31:30.210787732", - active_until: "2024-09-10T11:31:30.210787732" + type: 'NEW', + active_from: '2024-08-13T11:31:30.210787732', + active_until: '2024-09-10T11:31:30.210787732' } ] end diff --git a/spec/factories/products.rb b/spec/factories/products.rb index d3fd11b..105481d 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "faker" +require 'faker' FactoryBot.define do factory :product, class: Hash do @@ -8,23 +8,23 @@ description { Faker::Lorem.paragraph } manufacturer { Faker::Company.name } essential_features { Faker::Lorem.paragraph } - tags { Faker::Lorem.words(number: 3).push("beyond_api-ruby_client") } + tags { Faker::Lorem.words(number: 3).push('beyond_api-ruby_client') } default = { sales_price: { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 8.7, - currency: "GBP" + currency: 'GBP' }, list_price: { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 10.95, - currency: "GBP" + currency: 'GBP' }, manufacturer_price: { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 99.95, - currency: "GBP" + currency: 'GBP' }, shipping_dimension: { length: 1500, @@ -33,23 +33,23 @@ }, ref_price: { ref_quantity: 1, - unit: "LITER", + unit: 'LITER', quantity: 0.75, price: { - tax_model: "GROSS", + tax_model: 'GROSS', amount: 11.6, - currency: "GBP" + currency: 'GBP' } }, shipping_period: { min: 2, max: 4, - display_unit: "WEEKS" + display_unit: 'WEEKS' }, pickup_period: { min: 1, max: 2, - display_unit: "WEEKS" + display_unit: 'WEEKS' } } @@ -62,8 +62,8 @@ trait :with_variations do variation_attributes do [ - { display_name: "size", values: %w[s m] }, - { display_name: "color", values: %w[red green blue] } + { display_name: 'size', values: %w[s m] }, + { display_name: 'color', values: %w[red green blue] } ] end end diff --git a/spec/factories/webhook_data.rb b/spec/factories/webhook_data.rb index 39b9c4c..dd5aa67 100644 --- a/spec/factories/webhook_data.rb +++ b/spec/factories/webhook_data.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + FactoryBot.define do factory :webhook_data, class: Hash do - callback_uri { "http://example.com/test" } - event_types { ["order.created", "product.created"] } + callback_uri { 'http://example.com/test' } + event_types { ['order.created', 'product.created'] } initialize_with { attributes } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c58969a..665b37b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -require "bundler/setup" -require "dotenv/load" -require "beyond_api" -require "factory_bot" +require 'bundler/setup' +require 'dotenv/load' +require 'beyond_api' +require 'factory_bot' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = ".rspec_status" + config.example_status_persistence_file_path = '.rspec_status' # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! @@ -22,21 +22,21 @@ FactoryBot.find_definitions end - AppRoot = File.expand_path(File.dirname("vcr.rb")) + app_root = File.expand_path(File.dirname('vcr.rb')) - load "#{AppRoot}/spec/support/vcr.rb" + load "#{app_root}/spec/support/vcr.rb" end BeyondApi.setup do |config| - config.client_id = ENV["CLIENT_ID"] - config.client_secret = ENV["CLIENT_SECRET"] + config.client_id = ENV.fetch('CLIENT_ID', nil) + config.client_secret = ENV.fetch('CLIENT_SECRET', nil) end def auth_client BeyondApi::Authentication::Token.new( - api_url: ENV["API_URL"], - client_id: ENV["CLIENT_ID"], - client_secret: ENV["CLIENT_SECRET"] + api_url: ENV.fetch('API_URL', nil), + client_id: ENV.fetch('CLIENT_ID', nil), + client_secret: ENV.fetch('CLIENT_SECRET', nil) ) end diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb index a64f116..d2f2258 100644 --- a/spec/support/vcr.rb +++ b/spec/support/vcr.rb @@ -1,41 +1,43 @@ -require "jwt" -require "vcr" +# frozen_string_literal: true + +require 'jwt' +require 'vcr' VCR.configure do |config| - config.cassette_library_dir = "spec/vcr_cassettes" + config.cassette_library_dir = 'spec/vcr_cassettes' config.hook_into :webmock config.configure_rspec_metadata! config.ignore_localhost = true config.default_cassette_options = { - match_requests_on: [ :method, :uri, :body ] + match_requests_on: [:method, :uri, :body] } - config.filter_sensitive_data("") do |interaction| - authorizations = interaction.request.headers["Authorization"].first + config.filter_sensitive_data('') do |interaction| + authorizations = interaction.request.headers['Authorization'].first if (match = authorizations.match(/^(Bearer|Basic)\s+([^,\s]+)/)) match.captures.last end end - config.filter_sensitive_data("") do |interaction| + config.filter_sensitive_data('') do |interaction| response_body = JSON.parse(interaction.response.body) - response_body["access_token"] if response_body.is_a?(Hash) + response_body['access_token'] if response_body.is_a?(Hash) rescue JSON::ParserError nil end - config.filter_sensitive_data("") do |interaction| + config.filter_sensitive_data('') do |interaction| response_body = JSON.parse(interaction.response.body) - response_body["refresh_token"] if response_body.is_a?(Hash) + response_body['refresh_token'] if response_body.is_a?(Hash) rescue JSON::ParserError nil end - config.filter_sensitive_data("") do |interaction| - ENV["REFRESH_TOKEN"] + config.filter_sensitive_data('') do |_interaction| + ENV.fetch('REFRESH_TOKEN', nil) end - config.filter_sensitive_data("") do |interaction| - JWT.encode({ exp: (DateTime.now + 1.year).to_i }, nil, "HS256") + config.filter_sensitive_data('') do |_interaction| + JWT.encode({ exp: (DateTime.now + 1.year).to_i }, nil, 'HS256') end end From 123457cc2d5109c657548f2b8f759395b75a3e98 Mon Sep 17 00:00:00 2001 From: Kathia Date: Mon, 19 Aug 2024 13:07:57 +0200 Subject: [PATCH 46/59] EPT-2950 Add tests (#75) * Add tests * Rename variables * Update tests * Update tests * Add tests * Update tests * Update tests * replace destroy by delete * Add recordings --------- Co-authored-by: citin --- Gemfile | 2 + Gemfile.lock | 24 +- bin/console | 3 - lib/beyond_api/concerns/connection.rb | 9 + .../services/authentication/signer.rb | 4 +- .../services/product_management/category.rb | 16 + .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 6 +- .../services/product_management/variation.rb | 2 +- .../services/storefront/script_tag.rb | 4 +- .../services/webhook/subscription.rb | 6 +- spec/beyond_api/resources/products_spec.rb | 78 - .../resources/products_view_spec.rb | 15 - spec/beyond_api/resources/variations_spec.rb | 93 - .../services/authentication/signer_spec.rb | 30 + .../services/authentication/token_spec.rb | 24 + .../services/checkout/shipping_zone_spec.rb | 13 + .../product_management/category_spec.rb | 58 + .../services/product_management/image_spec.rb | 13 + .../product_management/product_spec.rb | 36 + spec/beyond_api/services/shop/address_spec.rb | 12 + spec/beyond_api/services/shop/shop_spec.rb | 11 + .../services/storefront/script_tag_spec.rb | 38 + .../services/webhook/subscription_spec.rb | 46 + spec/beyond_api/utils_spec.rb | 2 +- spec/factories/category_data.rb | 14 + spec/factories/product_data.rb | 103 + spec/factories/webhook_data.rb | 8 + spec/spec_helper.rb | 23 +- spec/support/vcr.rb | 41 + .../_all/returns_all_signers.yml | 159 + .../_create/creates_a_new_signer.yml | 131 + .../with_signer/_delete/deletes_a_signer.yml | 185 ++ .../with_signer/_destroy/deletes_a_signer.yml | 185 ++ .../refreshes_the_token.yml | 67 + ...retrieves_token_via_authorization_code.yml | 61 + ...retrieves_token_via_client_credentials.yml | 66 + .../_all/returns_all_shipping_zones.yml | 136 + .../_all/returns_all_categories.yml | 150 + .../_create/creates_a_new_category.yml | 187 ++ .../_delete/deletes_a_category.yml | 247 ++ .../_destroy/deletes_a_category.yml | 247 ++ .../_find/returns_a_category.yml | 256 ++ .../_update/updates_an_existing_category.yml | 256 ++ .../_all/returns_all_images.yml | 136 + .../_all/returns_all_products.yml | 2948 +++++++++++++++++ .../_create/creates_a_new_product.yml | 265 ++ .../with_product/_find/returns_a_product.yml | 460 +++ .../_get/returns_the_shop_address.yml | 146 + .../_get/returns_the_shop_details.yml | 160 + .../_all/returns_all_script_tags.yml | 136 + .../_create/creates_a_new_category.yml | 182 + .../_delete/deletes_a_script_tag.yml | 242 ++ .../_destroy/deletes_a_script_tag.yml | 242 ++ .../_find/returns_a_script_tag.yml | 182 + .../returns_all_webhook_subscriptions.yml | 136 + .../creates_a_new_webhook_subscription.yml | 186 ++ .../deletes_a_webhook_subscription.yml | 238 ++ .../deletes_a_webhook_subscription.yml | 238 ++ .../_find/returns_a_webhook_subscription.yml | 254 ++ 60 files changed, 9002 insertions(+), 218 deletions(-) delete mode 100644 spec/beyond_api/resources/products_spec.rb delete mode 100644 spec/beyond_api/resources/products_view_spec.rb delete mode 100644 spec/beyond_api/resources/variations_spec.rb create mode 100644 spec/beyond_api/services/authentication/signer_spec.rb create mode 100644 spec/beyond_api/services/authentication/token_spec.rb create mode 100644 spec/beyond_api/services/checkout/shipping_zone_spec.rb create mode 100644 spec/beyond_api/services/product_management/category_spec.rb create mode 100644 spec/beyond_api/services/product_management/image_spec.rb create mode 100644 spec/beyond_api/services/product_management/product_spec.rb create mode 100644 spec/beyond_api/services/shop/address_spec.rb create mode 100644 spec/beyond_api/services/shop/shop_spec.rb create mode 100644 spec/beyond_api/services/storefront/script_tag_spec.rb create mode 100644 spec/beyond_api/services/webhook/subscription_spec.rb create mode 100644 spec/factories/category_data.rb create mode 100644 spec/factories/product_data.rb create mode 100644 spec/factories/webhook_data.rb create mode 100644 spec/support/vcr.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml diff --git a/Gemfile b/Gemfile index cd70397..a46f237 100644 --- a/Gemfile +++ b/Gemfile @@ -13,5 +13,7 @@ end group :test do gem "factory_bot" + gem "jwt" + gem "vcr" gem "webmock" end diff --git a/Gemfile.lock b/Gemfile.lock index 89fcb53..9ea306e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,23 +10,24 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.1.3.4) + activesupport (7.2.0) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) bigdecimal (3.1.8) coderay (1.1.3) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crack (1.0.0) bigdecimal @@ -49,15 +50,16 @@ GEM i18n (1.14.5) concurrent-ruby (~> 1.0) json (2.7.2) + jwt (2.8.2) + base64 language_server-protocol (3.17.0.3) logger (1.6.0) method_source (1.1.0) minitest (5.24.1) - mutex_m (0.2.0) net-http (0.4.1) uri - parallel (1.25.1) - parser (3.3.4.0) + parallel (1.26.2) + parser (3.3.4.2) ast (~> 2.4.1) racc pry (0.14.2) @@ -68,7 +70,7 @@ GEM rainbow (3.1.1) rake (10.5.0) regexp_parser (2.9.2) - rexml (3.3.4) + rexml (3.3.5) strscan rspec (3.13.0) rspec-core (~> 3.13.0) @@ -108,11 +110,13 @@ GEM rubocop-rspec_rails (2.29.1) rubocop (~> 1.61) ruby-progressbar (1.13.0) + securerandom (0.3.1) strscan (3.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) uri (0.13.0) + vcr (6.2.0) webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -130,11 +134,13 @@ DEPENDENCIES dotenv (~> 2.7) factory_bot faker (~> 2.2) + jwt pry rake (~> 10.0) rspec (~> 3.0) rubocop rubocop-rspec (~> 2.4) + vcr webmock yard (~> 0.9) diff --git a/bin/console b/bin/console index ce7d2fa..89df3af 100755 --- a/bin/console +++ b/bin/console @@ -9,9 +9,6 @@ unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil? BeyondApi.setup do |config| config.client_id = ENV["CLIENT_ID"] config.client_secret = ENV["CLIENT_SECRET"] - config.remove_response_links = true - config.remove_response_key_underscores = true - config.object_struct_responses = false end end diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 8bdd68e..806a3b9 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -10,6 +10,15 @@ def get(path, params = {}) handle_request { agent.get(path, parse_request(params)) } end + def put(path, body = {}, params = {}) + handle_request do + agent.put(path, body) do |request| + request.params = parse_request(params) + request.body = parse_request(body) + end + end + end + def post(path, body = {}, params = {}) handle_request do agent.post(path, body) do |request| diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 2e67b2d..8c7371f 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -9,8 +9,8 @@ def create post("signers") end - def destroy(id) - delete("signers/#{id}") + def delete(id) + super("signers/#{id}") # Concerns::Connection delete method end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index a2c4058..e6926ce 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -4,6 +4,22 @@ class Category < BaseService def find(id) get("categories/#{id}") end + + def all(params = {}) + fetch_all_pages("categories", params) + end + + def create(body) + post("categories", body) + end + + def update(id, body) + put("categories/#{id}", body) + end + + def delete(id) + super("categories/#{id}") # Concerns::Connection delete method + end end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 72b0cb4..658af3c 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Image < BaseService def all(id, params = {}) - get("products/#{id}/images") + get("products/#{id}/images", params) end end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 1ad5c35..31a6f77 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,7 +2,11 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - fetch_all_pages("/products", params) + fetch_all_pages("products", params) + end + + def create(body) + post("products", body) end def find(id) diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 41ba8b2..1af3319 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Variation < BaseService def all(id, params = {}) - get("products/#{id}/variations") + get("products/#{id}/variations", params) end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 6c5eaed..17c5259 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -11,8 +11,8 @@ def create(script_url) post("script-tags", script_url:) end - def destroy(id) - delete("script-tags/#{id}") + def delete(id) + super("script-tags/#{id}") # Concerns::Connection delete method end end end diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 349f80f..2cb4341 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -11,12 +11,12 @@ def create(body) def delete_all all.dig(:embedded, :subscriptions).each do |subscription| - destroy(subscription[:id]) + delete(subscription[:id]) end end - def destroy(id) - delete("webhook-subscriptions/#{id}") + def delete(id) + super("webhook-subscriptions/#{id}") # Concerns::Connection delete method end def find(id) diff --git a/spec/beyond_api/resources/products_spec.rb b/spec/beyond_api/resources/products_spec.rb deleted file mode 100644 index db72897..0000000 --- a/spec/beyond_api/resources/products_spec.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'BeyondApi::Products' do - let!(:session) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - end - - let(:product) { @product = session.products.create(FactoryBot.build(:product)) } - - let!(:file_path) do - app_root = File.expand_path(File.dirname("ext.rb")) - "#{app_root}/spec/files/" - end - - describe "non existing product" do - it "create a new regular product and " do - product = session.products.create(FactoryBot.build(:product)) - - expect(product).not_to be nil - expect(product.id).not_to be nil - end - end - - - describe "product exist" do - it "find a product sending an ID" do - response = session.products.find(product.id) - expect(response).not_to be nil - expect(response.id).to eq(product.id) - end - - - it "upload multiple images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - images = session.products.upload_multiple_images(product.id, - files, - ["image1.png", "image2.png"]) - expect(images).not_to be nil - expect(images.embedded.images.is_a?(Array)).to eq true - end - - it "upload a single image" do - file = "#{file_path}image1.png" - - image = session.products.upload_image(product.id, file, "image3.png") - expect(image).not_to be nil - expect(image).to eq true - end - - it "sort product images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - session.products.upload_multiple_images(product.id, - files, - ["image1.png", "image2.png"]) - - images = session.products.images(product.id) - - images_sorted = images.embedded.images.sort_by(&:position).reverse.map(&:id) - - sorted = session.products.sort_images(product.id, images_sorted) - - images = session.products.images(product.id) - - expect(sorted).not_to be nil - expect(sorted).to eq true - expect(images.embedded.images.map(&:id)).to eq images_sorted - end - end -end diff --git a/spec/beyond_api/resources/products_view_spec.rb b/spec/beyond_api/resources/products_view_spec.rb deleted file mode 100644 index d76d054..0000000 --- a/spec/beyond_api/resources/products_view_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -RSpec.describe 'BeyondApi::ProductsView' do - let!(:session) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - end - - let(:product) { @product = session.products.create(FactoryBot.build(:product)) } - - it "list products with specific tag" do - response = session.products_view.search_by_tag("beyond_api-ruby_client") - expect(response).not_to be nil - expect(response.embedded.products.class).to be(Array) - expect(response.embedded.products.size).to be >= 1 - end -end diff --git a/spec/beyond_api/resources/variations_spec.rb b/spec/beyond_api/resources/variations_spec.rb deleted file mode 100644 index af774b5..0000000 --- a/spec/beyond_api/resources/variations_spec.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'BeyondApi::Variations' do - let!(:file_path) do - app_root = File.expand_path(File.dirname("ext.rb")) - "#{app_root}/spec/files/" - end - - let!(:session) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - end - - let(:product) { session.products.create(FactoryBot.build(:product, :with_variations)) } - let(:variation) do - session.variations.all(product.id).embedded.variations.first - end - let(:default_image_property) do - body = [{ - property: "defaultImage", - enabled: true - }] - session.products.update_variation_properties(product.id, body) - end - - context "Create variation" do - it "Update image variation property" do - body = [{ - property: "defaultImage", - enabled: true - }] - response = session.products.update_variation_properties(product.id, body) - - expect(response).not_to be nil - default_image_prop = response.embedded.variation_properties.find { |prop| prop.property == "defaultImage" } - - expect(default_image_prop).not_to be nil - expect(default_image_prop.enabled).to be true - end - - it "Upload multiple images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - default_image_property - response = session.variations.upload_multiple_images(product.id, - variation.id, - files, - ["image1.png", "image2.png"]) - - expect(response).not_to be nil - end - - it "Upload a single image" do - file = "#{file_path}image1.png" - - default_image_property - response = session.variations.upload_multiple_images(product.id, - variation.id, - file, - "variation1.png") - - expect(response).not_to be nil - end - - it "sort variation images" do - files = [ - "#{file_path}image1.png", - "#{file_path}image2.png" - ] - - default_image_property - response = session.variations.upload_multiple_images(product.id, - variation.id, - files, - ["image1.png", "image2.png"]) - - images = session.variations.images(product.id, variation.id) - - images_sorted = images.embedded.images.sort_by(&:position).reverse.map(&:id) - - sorted = session.variations.sort_images(product.id, variation.id, images_sorted) - - images = session.variations.images(product.id, variation.id) - - expect(sorted).not_to be nil - expect(sorted).to eq true - expect(images.embedded.images.map(&:id)).to eq images_sorted - end - end -end diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb new file mode 100644 index 0000000..07fd084 --- /dev/null +++ b/spec/beyond_api/services/authentication/signer_spec.rb @@ -0,0 +1,30 @@ +RSpec.describe BeyondApi::Authentication::Signer, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe '#all' do + it 'returns all signers' do + signers = client.all + + expect(signers.dig(:embedded, :signers)).to be_an(Array) + end + end + + context "with signer" do + before(:each) do + @signer = client.create + end + + describe '#create' do + it 'creates a new signer' do + expect(@signer).to be_a(Hash) + end + end + + describe '#delete' do + it 'deletes a signer' do + response = client.delete(@signer[:id]) + expect(response).to be {} + end + end + end +end diff --git a/spec/beyond_api/services/authentication/token_spec.rb b/spec/beyond_api/services/authentication/token_spec.rb new file mode 100644 index 0000000..35d6f4b --- /dev/null +++ b/spec/beyond_api/services/authentication/token_spec.rb @@ -0,0 +1,24 @@ +RSpec.describe BeyondApi::Authentication::Token, vcr: true do + it "retrieves token via client credentials" do + response = auth_client.client_credentials + expect(response).not_to be nil + expect(response[:access_token].class).to be(String) + expect(response[:refresh_token]).to be(nil) + end + + it "retrieves token via authorization code" do + expect { + response = auth_client.get('abcde') + }.to raise_error(BeyondApi::Error) do |error| + expect(error.response[:error]).to eq("invalid_grant") + expect(error.response[:error_description]).to eq("Invalid authorization code: abcde") + end + end + + it "refreshes the token" do + response = auth_client.refresh(ENV["REFRESH_TOKEN"]) + expect(response).not_to be nil + expect(response[:access_token].class).to be(String) + expect(response[:refresh_token].class).to be(String) + end +end diff --git a/spec/beyond_api/services/checkout/shipping_zone_spec.rb b/spec/beyond_api/services/checkout/shipping_zone_spec.rb new file mode 100644 index 0000000..292ba2c --- /dev/null +++ b/spec/beyond_api/services/checkout/shipping_zone_spec.rb @@ -0,0 +1,13 @@ +RSpec.describe BeyondApi::Checkout::ShippingZone, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".all" do + it "returns all shipping_zones" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :shipping_zones)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end +end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb new file mode 100644 index 0000000..dd6f2c3 --- /dev/null +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -0,0 +1,58 @@ +RSpec.describe BeyondApi::ProductManagement::Category, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".all" do + it "returns all categories" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :categories)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with category" do + before(:each) do + @category = client.create(build(:category_data)) + end + + describe ".create" do + it "creates a new category" do + expect(@category).not_to be nil + expect(@category[:name]).to eq("Team42 Category") + expect(@category[:type]).to eq("SMART") + expect(@category[:default_sort]).to eq("HIGHEST_PRICE_FIRST") + end + end + + describe ".find" do + it "returns a category" do + response = client.find(@category[:id]) + expect(response[:name]).to eq("Team42 Category") + end + end + + describe ".update" do + it "updates an existing category" do + updated_category_data = FactoryBot.build(:category_data, :lowest_price_first) + + updated_category = client.update(@category[:id], updated_category_data) + expect(updated_category).not_to be nil + expect(updated_category[:name]).to eq("Category with lowest price first") + expect(updated_category[:default_sort]).to eq("LOWEST_PRICE_FIRST") + end + end + + describe ".delete" do + it "deletes a category" do + response = client.delete(@category[:id]) + expect(response).to be {} + end + end + + after(:each) do + client.delete(@category[:id]) + rescue BeyondApi::Error + end + end +end diff --git a/spec/beyond_api/services/product_management/image_spec.rb b/spec/beyond_api/services/product_management/image_spec.rb new file mode 100644 index 0000000..cb839e9 --- /dev/null +++ b/spec/beyond_api/services/product_management/image_spec.rb @@ -0,0 +1,13 @@ +RSpec.describe BeyondApi::ProductManagement::Image, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".all" do + it "returns all images" do + response = client.all("4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc") + + expect(response).not_to be nil + expect(response.dig(:embedded, :images)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end +end diff --git a/spec/beyond_api/services/product_management/product_spec.rb b/spec/beyond_api/services/product_management/product_spec.rb new file mode 100644 index 0000000..39bff0a --- /dev/null +++ b/spec/beyond_api/services/product_management/product_spec.rb @@ -0,0 +1,36 @@ +RSpec.describe BeyondApi::ProductManagement::Product, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".all" do + it "returns all products" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :products)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with product" do + before(:each) do + @product = client.create(build(:product_data)) + end + + describe ".create" do + it "creates a new product" do + expect(@product).not_to be nil + expect(@product[:name]).to eq("Team42 Product") + expect(@product[:essential_features]).to eq("Dry. 12% alcohol. Best vine variety.") + expect(@product[:tags]).to eq(["Bestseller", "Red Wine", "Sale"]) + expect(@product[:product_identifiers]).to eq([{ type: "EAN", value: "9780134308135" }]) + end + end + + describe ".find" do + it "returns a product" do + response = client.find(@product[:id]) + expect(response[:name]).to eq("Team42 Product") + end + end + end +end diff --git a/spec/beyond_api/services/shop/address_spec.rb b/spec/beyond_api/services/shop/address_spec.rb new file mode 100644 index 0000000..0f9e5f1 --- /dev/null +++ b/spec/beyond_api/services/shop/address_spec.rb @@ -0,0 +1,12 @@ +RSpec.describe BeyondApi::Shop::Address, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".get" do + it "returns the shop address" do + response = client.show + expect(response).not_to be nil + expect(response.keys).to include(:company, :first_name, :last_name, :email, + :phone, :street, :postal_code, :dependent_locality, :city, :state, :country) + end + end +end diff --git a/spec/beyond_api/services/shop/shop_spec.rb b/spec/beyond_api/services/shop/shop_spec.rb new file mode 100644 index 0000000..35b1e11 --- /dev/null +++ b/spec/beyond_api/services/shop/shop_spec.rb @@ -0,0 +1,11 @@ +RSpec.describe BeyondApi::Shop::Shop, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".get" do + it "returns the shop details" do + response = client.show + expect(response).not_to be nil + expect(response.keys).to include(:name, :reseller_name, :primary_hostname, :default_locale) + end + end +end diff --git a/spec/beyond_api/services/storefront/script_tag_spec.rb b/spec/beyond_api/services/storefront/script_tag_spec.rb new file mode 100644 index 0000000..89b0581 --- /dev/null +++ b/spec/beyond_api/services/storefront/script_tag_spec.rb @@ -0,0 +1,38 @@ +RSpec.describe BeyondApi::Storefront::ScriptTag, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".all" do + it "returns all script tags" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :script_tags)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with script tag" do + before(:each) do + @script_tag = client.create("https://example.com/scripts/exampleScript.js") + end + + describe ".create" do + it "creates a new category" do + expect(@script_tag).not_to be nil + expect(@script_tag[:script_url]).to eq("https://example.com/scripts/exampleScript.js") + end + end + + describe ".delete" do + it "deletes a script tag" do + response = client.delete(@script_tag[:id]) + expect(response).to be {} + end + end + + after(:each) do + client.delete(@script_tag[:id]) + rescue BeyondApi::Error + end + end +end diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb new file mode 100644 index 0000000..48d59f4 --- /dev/null +++ b/spec/beyond_api/services/webhook/subscription_spec.rb @@ -0,0 +1,46 @@ +RSpec.describe BeyondApi::Webhook::Subscription, vcr: true do + let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } + + describe ".all" do + it "returns all webhook subscriptions" do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :subscriptions)).to be_kind_of(Array) + expect(response.dig(:page)).to be_kind_of(Hash) + end + end + + context "with webhook subscription" do + before(:each) do + @webhook_subscription = client.create(build(:webhook_data)) + end + + describe ".create" do + it "creates a new webhook subscription" do + expect(@webhook_subscription).not_to be nil + expect(@webhook_subscription[:callback_uri]).to eq("http://example.com/test") + expect(@webhook_subscription[:event_types]).to eq(["order.created", "product.created"]) + end + end + + describe ".find" do + it "returns a webhook subscription" do + response = client.find(@webhook_subscription[:id]) + expect(response[:callback_uri]).to eq("http://example.com/test") + end + end + + describe ".delete" do + it "deletes a webhook subscription" do + response = client.delete(@webhook_subscription[:id]) + expect(response).to be {} + end + end + + after(:each) do + client.delete(@webhook_subscription[:id]) + rescue BeyondApi::Error + end + end +end diff --git a/spec/beyond_api/utils_spec.rb b/spec/beyond_api/utils_spec.rb index d1c8d85..edc0d72 100644 --- a/spec/beyond_api/utils_spec.rb +++ b/spec/beyond_api/utils_spec.rb @@ -13,6 +13,6 @@ end it "parse snakecase to camelcase" do - expect("sales_price".camelize(false)).to eq "salesPrice" + expect("sales_price".camelize(:lower)).to eq "salesPrice" end end diff --git a/spec/factories/category_data.rb b/spec/factories/category_data.rb new file mode 100644 index 0000000..8f28256 --- /dev/null +++ b/spec/factories/category_data.rb @@ -0,0 +1,14 @@ +FactoryBot.define do + factory :category_data, class: Hash do + name { "Team42 Category" } + type { "SMART" } + default_sort { "HIGHEST_PRICE_FIRST" } + + trait :lowest_price_first do + name { "Category with lowest price first" } + default_sort { "LOWEST_PRICE_FIRST" } + end + + initialize_with { attributes } + end +end diff --git a/spec/factories/product_data.rb b/spec/factories/product_data.rb new file mode 100644 index 0000000..67e6f28 --- /dev/null +++ b/spec/factories/product_data.rb @@ -0,0 +1,103 @@ +FactoryBot.define do + factory :product_data, class: Hash do + name { "Team42 Product" } + description { "Spain\nRioja Tempranillo" } + manufacturer { "Grape Vineyard" } + essential_features { "Dry. 12% alcohol. Best vine variety." } + tags { ["Bestseller", "Red Wine", "Sale"] } + + product_identifiers do + [ + { + type: "EAN", + value: "9780134308135" + } + ] + end + + sales_price do + { + tax_model: "GROSS", + amount: 8.7, + currency: "GBP" + } + end + + list_price do + { + tax_model: "GROSS", + amount: 10.95, + currency: "GBP" + } + end + + manufacturer_price do + { + tax_model: "GROSS", + amount: 11.95, + currency: "GBP" + } + end + + visible { true } + tax_class { "REGULAR" } + + shipping_weight do + { + value: 1175.0, + display_unit: "GRAMS" + } + end + + max_order_quantity { 6 } + + shipping_dimension do + { + length: 1500, + width: 1000, + height: 2000 + } + end + + ref_price do + { + ref_quantity: 1, + unit: "LITER", + quantity: 0.75, + price: { + tax_model: "GROSS", + amount: 11.6, + currency: "GBP" + } + } + end + + shipping_period do + { + min: 2, + max: 4, + display_unit: "WEEKS" + } + end + + pickup_period do + { + min: 1, + max: 2, + display_unit: "WEEKS" + } + end + + product_labels do + [ + { + type: "NEW", + active_from: "2024-08-13T11:31:30.210787732", + active_until: "2024-09-10T11:31:30.210787732" + } + ] + end + + initialize_with { attributes } + end +end diff --git a/spec/factories/webhook_data.rb b/spec/factories/webhook_data.rb new file mode 100644 index 0000000..39b9c4c --- /dev/null +++ b/spec/factories/webhook_data.rb @@ -0,0 +1,8 @@ +FactoryBot.define do + factory :webhook_data, class: Hash do + callback_uri { "http://example.com/test" } + event_types { ["order.created", "product.created"] } + + initialize_with { attributes } + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aababc9..c58969a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,15 +22,9 @@ FactoryBot.find_definitions end - config.after(:suite) do - session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) - session.token.client_credentials - - products = session.products.all - products.embedded.products.each do |product| - session.products.delete(product.id) - end - end + AppRoot = File.expand_path(File.dirname("vcr.rb")) + + load "#{AppRoot}/spec/support/vcr.rb" end BeyondApi.setup do |config| @@ -38,3 +32,14 @@ config.client_secret = ENV["CLIENT_SECRET"] end +def auth_client + BeyondApi::Authentication::Token.new( + api_url: ENV["API_URL"], + client_id: ENV["CLIENT_ID"], + client_secret: ENV["CLIENT_SECRET"] + ) +end + +def beyond_access_token + auth_client.client_credentials[:access_token] +end diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb new file mode 100644 index 0000000..a64f116 --- /dev/null +++ b/spec/support/vcr.rb @@ -0,0 +1,41 @@ +require "jwt" +require "vcr" + +VCR.configure do |config| + config.cassette_library_dir = "spec/vcr_cassettes" + config.hook_into :webmock + config.configure_rspec_metadata! + config.ignore_localhost = true + config.default_cassette_options = { + match_requests_on: [ :method, :uri, :body ] + } + + config.filter_sensitive_data("") do |interaction| + authorizations = interaction.request.headers["Authorization"].first + if (match = authorizations.match(/^(Bearer|Basic)\s+([^,\s]+)/)) + match.captures.last + end + end + + config.filter_sensitive_data("") do |interaction| + response_body = JSON.parse(interaction.response.body) + response_body["access_token"] if response_body.is_a?(Hash) + rescue JSON::ParserError + nil + end + + config.filter_sensitive_data("") do |interaction| + response_body = JSON.parse(interaction.response.body) + response_body["refresh_token"] if response_body.is_a?(Hash) + rescue JSON::ParserError + nil + end + + config.filter_sensitive_data("") do |interaction| + ENV["REFRESH_TOKEN"] + end + + config.filter_sensitive_data("") do |interaction| + JWT.encode({ exp: (DateTime.now + 1.year).to_i }, nil, "HS256") + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml new file mode 100644 index 0000000..030cc77 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml @@ -0,0 +1,159 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.097' + X-B3-Traceid: + - '0636875c3bbcbab7867bda535fe5e243' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049641, + "jti" : "8JwEzj6jy1EWDAYb40//fdukLso=" + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.025' + X-B3-Traceid: + - 50d800fb4b92bedd1b243cbfadba6fb4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "signers" : [ { + "_id" : "3c910dd7-65d8-4ee5-af7d-dd82de834d4b", + "createdAt" : "2024-08-19T06:37:59.951", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/3c910dd7-65d8-4ee5-af7d-dd82de834d4b" + } + } + }, { + "_id" : "7add803f-df8a-46a4-9e75-5afd75b01adc", + "createdAt" : "2024-08-19T06:36:40.976", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/7add803f-df8a-46a4-9e75-5afd75b01adc" + } + } + }, { + "_id" : "82920cfb-e1ab-4b3c-8e33-5702d86f6876", + "createdAt" : "2024-08-19T06:37:28.279", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/82920cfb-e1ab-4b3c-8e33-5702d86f6876" + } + } + }, { + "_id" : "b3de5fef-8385-4df4-a9a5-74a5aacb1277", + "createdAt" : "2024-08-19T06:35:38.891", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/b3de5fef-8385-4df4-a9a5-74a5aacb1277" + } + } + } ] + } + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml new file mode 100644 index 0000000..f826990 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml @@ -0,0 +1,131 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.107' + X-B3-Traceid: + - 76c69d85f495cae946b442180d524db6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049641, + "jti" : "J/GfScnFC3pMwwgs5YDiIVP1HXo=" + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - 701352c68f255753f503b83c7fc89eba + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "2248041d-692c-4367-afc0-345cc68eab34", + "sharedSecret" : "59dh9nooefbgcqjnqtggu5s5j4", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/2248041d-692c-4367-afc0-345cc68eab34" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml new file mode 100644 index 0000000..dc2e937 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml @@ -0,0 +1,185 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:22:59 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.139' + X-B3-Traceid: + - 27d6f6696bed6e3f01e81ab3577000d5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055779, + "jti" : "l7k8DMT7GM5WeH61G8VGwETkteM=" + } + recorded_at: Mon, 19 Aug 2024 08:22:59 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.041' + X-B3-Traceid: + - 6e71c1fa205231a52c7a58429b64b89b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "92cb69c7-a830-4312-9dae-ffcf6603bba7", + "sharedSecret" : "u3v38frnqt59vka22kqaumpgft", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/92cb69c7-a830-4312-9dae-ffcf6603bba7" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/signers/92cb69c7-a830-4312-9dae-ffcf6603bba7 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.043' + X-B3-Traceid: + - 34a99a554db99d028a1c47648840cf07 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml new file mode 100644 index 0000000..7b368bd --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml @@ -0,0 +1,185 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:41 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.109' + X-B3-Traceid: + - d72048fff4e94acf0c52280599675dd9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049641, + "jti" : "DjCpOBsqfphiDcCkDgpoRP4k5EM=" + } + recorded_at: Mon, 19 Aug 2024 06:40:41 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/signers + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.040' + X-B3-Traceid: + - c0ee336f1e05d262a21d2b02500caa18 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "494bf9b6-6550-486c-af70-1f6ba20efc15", + "sharedSecret" : "7i089vqpip8rp1rr8knpvtn9vf", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/494bf9b6-6550-486c-af70-1f6ba20efc15" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/signers/494bf9b6-6550-486c-af70-1f6ba20efc15 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - 4ff4a18a386e580d5cb7bad07cd18f96 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml new file mode 100644 index 0000000..b3d84ca --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=refresh_token&refresh_token= + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.068' + X-B3-Traceid: + - 763a7dd5f009d1ffbc6fbf526ebed43e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "refresh_token" : "", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049642, + "jti" : "DrMFA8sRZZLLJO+ba+Jand8vQA0=" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml new file mode 100644 index 0000000..33b231f --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml @@ -0,0 +1,61 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?code=abcde&grant_type=authorization_code + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.065' + X-B3-Traceid: + - f7ff23495578391a48e8521e43b1713c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "error" : "invalid_grant", + "error_description" : "Invalid authorization code: abcde" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml new file mode 100644 index 0000000..ef2289a --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml @@ -0,0 +1,66 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - 7bdb93b33bd69b735ecb9e195d0f5480 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049642, + "jti" : "0kCHmq0DeCKbXbVed8Em4P49/SM=" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml b/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml new file mode 100644 index 0000000..a6034cf --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:42 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.102' + X-B3-Traceid: + - ade04437123682156ae9bbd7667045a3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049642, + "jti" : "xEIok9IjDV4GjerA3jFWgrvFXhE=" + } + recorded_at: Mon, 19 Aug 2024 06:40:42 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shipping-zones + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.020' + X-B3-Traceid: + - a5f64146e475157a05c57418c445a262 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "shipping-zones" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shipping-zones?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml new file mode 100644 index 0000000..46bc703 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml @@ -0,0 +1,150 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - 2e5297c116f26110752a13767ed08317 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049643, + "jti" : "52PRN2EdpqkLoCJ/CEyh6beJ2d4=" + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.024' + X-B3-Traceid: + - da4b1b865b4142c6ab107d91109bd7af + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "categories" : [ { + "_id" : "8a4a8f6a-e3d9-4616-9e89-12c42c084534", + "name" : "DO-NOT-DELETE Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 1, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml new file mode 100644 index 0000000..9131453 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml @@ -0,0 +1,187 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.091' + X-B3-Traceid: + - 9c45eb30e4575f5f4fe5cc084546e684 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049643, + "jti" : "8dcnvbvxhvyHoBbeBAKfSw03gyc=" + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - af3aeca695c94c32801e0c662b63ddb9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "464df7fc-5801-4eda-8c38-22b6ffd2a823", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:43 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.047' + X-B3-Traceid: + - 7eeb8ed8a7b09af81f8874d37bb821d0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:43 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml new file mode 100644 index 0000000..22cb4c8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml @@ -0,0 +1,247 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.095' + X-B3-Traceid: + - 55b33c0580da9f9255ff6ffdb6f8af47 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055780, + "jti" : "bo9G/OG2JbjIQVLDljv+XfIwu/Q=" + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.051' + X-B3-Traceid: + - a91a846530581b514551ae5ee861fdc4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "28171a9e-43d6-4786-9f1d-780152649363", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - fac194a82965a2f8226f3faa67af0b34 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 08:23:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.013' + X-B3-Traceid: + - 6ba81a6b755682d168eecfa9c913f84e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "resource-not-found", + "details" : { }, + "message" : "No Category found for '28171a9e-43d6-4786-9f1d-780152649363'", + "traceId" : "6ba81a6b755682d168eecfa9c913f84e" + } + recorded_at: Mon, 19 Aug 2024 08:23:00 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml new file mode 100644 index 0000000..028cc62 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml @@ -0,0 +1,247 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.112' + X-B3-Traceid: + - dc5d18864eaf21f13f53b1fc42fa463a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049645, + "jti" : "HQfYmpl2Z0QRAzP1B3ryEq8CZ4U=" + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.029' + X-B3-Traceid: + - 36495f254777047ecfac8921032839d3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "349a769f-a19b-401f-bc29-45228f4d115a", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.040' + X-B3-Traceid: + - fb465a06f039def22ea6a2148387eeb7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.016' + X-B3-Traceid: + - 1e6bd69e50fa94a8dd2392ccdcd99aa6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "resource-not-found", + "details" : { }, + "message" : "No Category found for '349a769f-a19b-401f-bc29-45228f4d115a'", + "traceId" : "1e6bd69e50fa94a8dd2392ccdcd99aa6" + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml new file mode 100644 index 0000000..c727718 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.149' + X-B3-Traceid: + - 19f41c49ed1a0b4821d56b1f2a5199d0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049644, + "jti" : "YTMVOzRnfL3aopdXeSQQogD61VQ=" + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.025' + X-B3-Traceid: + - 872ce11570a2ae1a3862dad0b48fab19 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "380c8a2b-cff2-4789-9777-53a232f4d601", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.015' + X-B3-Traceid: + - e685a6f718f5fd74732f9fcdb9c80e2a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "380c8a2b-cff2-4789-9777-53a232f4d601", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - '08eca00fb3f15ee4c11470044e64e130' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml new file mode 100644 index 0000000..6833082 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.139' + X-B3-Traceid: + - eb47a37565c0c4d86ddfbc23d37a76c5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049644, + "jti" : "Vy9nkOpiuE7poFaOts96U5zc7QI=" + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/categories + body: + encoding: UTF-8 + string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.034' + X-B3-Traceid: + - 1dc369d96881200e2c455f732c3c021c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "5f37b352-8c12-414f-96cf-8152e4e23d4d", + "name" : "Team42 Category", + "type" : "SMART", + "defaultSort" : "HIGHEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d + body: + encoding: UTF-8 + string: '{"name":"Category with lowest price first","type":"SMART","defaultSort":"LOWEST_PRICE_FIRST"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 38668d975055f9f37ede46c518c54907 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "5f37b352-8c12-414f-96cf-8152e4e23d4d", + "name" : "Category with lowest price first", + "type" : "SMART", + "defaultSort" : "LOWEST_PRICE_FIRST", + "filters" : [ ], + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + }, + "category" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - 2dd71cfed1e43d8570f1ab33ffcdf086 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 06:40:44 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml new file mode 100644 index 0000000..969edad --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - 3f6f1d5807e8bf92dca5c2e04ae7048d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049645, + "jti" : "zq3hO+6bHPoM3k4RR8FK0e/RkmQ=" + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.023' + X-B3-Traceid: + - e0ae07b6811b4d06362a57425a0a55b0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "images" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml new file mode 100644 index 0000000..87fb499 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml @@ -0,0 +1,2948 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:46 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.146' + X-B3-Traceid: + - 0ec04a3cce6cafd10f5ab15b6102e7b8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049646, + "jti" : "mu0JswmAtn8TgH3JWCQ9j902J4I=" + } + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/products + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.227' + X-B3-Traceid: + - af2a97f1e8074796ca4f5bd8c27aeb0e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "products" : [ { + "_id" : "4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc", + "lastModifiedAt" : "2024-08-18T21:43:42.669", + "sku" : "1000", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/additional-descriptions" + } + } + }, { + "_id" : "cb3463f8-90b1-4d0b-a071-d577e9686696", + "lastModifiedAt" : "2024-08-19T05:59:22.945", + "sku" : "1006", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/additional-descriptions" + } + } + }, { + "_id" : "6c1fba11-2983-4cff-bdd1-8d485fd4e836", + "lastModifiedAt" : "2024-08-19T05:59:23.355", + "sku" : "1007", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/additional-descriptions" + } + } + }, { + "_id" : "622de456-b829-4840-ae51-908c3c4c6e72", + "lastModifiedAt" : "2024-08-19T06:13:43.612", + "sku" : "1008", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/additional-descriptions" + } + } + }, { + "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", + "lastModifiedAt" : "2024-08-19T06:13:44.056", + "sku" : "1009", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" + } + } + }, { + "_id" : "d0a33d33-f629-46a5-a7d6-dbdb22dbae39", + "lastModifiedAt" : "2024-08-19T06:29:52.033", + "sku" : "1010", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/additional-descriptions" + } + } + }, { + "_id" : "4d16857a-a353-4e88-9cc7-ba0b9cf05c2b", + "lastModifiedAt" : "2024-08-19T06:29:52.458", + "sku" : "1011", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/additional-descriptions" + } + } + }, { + "_id" : "2d9923be-cc36-41f7-8585-795883ceecdc", + "lastModifiedAt" : "2024-08-19T06:30:37.637", + "sku" : "1012", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/additional-descriptions" + } + } + }, { + "_id" : "935f97ed-c875-4f24-9f6b-cdb6f09cbddd", + "lastModifiedAt" : "2024-08-19T06:30:38.101", + "sku" : "1013", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/additional-descriptions" + } + } + }, { + "_id" : "7b16492b-8a5b-4597-8e9d-cd9fcd52af0c", + "lastModifiedAt" : "2024-08-19T06:31:58.649", + "sku" : "1014", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/additional-descriptions" + } + } + }, { + "_id" : "575da236-82ff-4e5c-84f9-a5514ef05b23", + "lastModifiedAt" : "2024-08-19T06:31:59.05", + "sku" : "1015", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/additional-descriptions" + } + } + }, { + "_id" : "26221231-953b-4a1c-9025-7c72e610facd", + "lastModifiedAt" : "2024-08-19T06:35:23.365", + "sku" : "1016", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/additional-descriptions" + } + } + }, { + "_id" : "0b47984d-5322-4d11-9022-41137bd9ddc2", + "lastModifiedAt" : "2024-08-19T06:35:23.857", + "sku" : "1017", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/additional-descriptions" + } + } + }, { + "_id" : "d4aa7727-aaa5-43d4-80f4-0f51bc8a688e", + "lastModifiedAt" : "2024-08-19T06:35:43.277", + "sku" : "1018", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/additional-descriptions" + } + } + }, { + "_id" : "b9bf2184-ae5b-4b06-be1a-f4d1140496e3", + "lastModifiedAt" : "2024-08-19T06:35:43.694", + "sku" : "1019", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/additional-descriptions" + } + } + }, { + "_id" : "bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a", + "lastModifiedAt" : "2024-08-19T06:36:45.318", + "sku" : "1020", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/additional-descriptions" + } + } + }, { + "_id" : "21cb741d-eb0c-4722-8622-a8b555d1fd03", + "lastModifiedAt" : "2024-08-19T06:36:45.749", + "sku" : "1021", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/additional-descriptions" + } + } + }, { + "_id" : "687ac2a5-91a9-4d7e-917d-614fabcbc023", + "lastModifiedAt" : "2024-08-19T06:37:32.536", + "sku" : "1022", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/additional-descriptions" + } + } + }, { + "_id" : "4312d633-0d56-4157-8b33-b587550cca1f", + "lastModifiedAt" : "2024-08-19T06:37:32.972", + "sku" : "1023", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/additional-descriptions" + } + } + }, { + "_id" : "88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d", + "lastModifiedAt" : "2024-08-19T06:38:04.141", + "sku" : "1024", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/additional-descriptions" + } + } + } ] + }, + "_links" : { + "first" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" + }, + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" + }, + "next" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=1&size=20" + }, + "last" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=1&size=20" + }, + "search" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/search" + } + }, + "page" : { + "size" : 20, + "totalElements" : 21, + "totalPages" : 2, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml new file mode 100644 index 0000000..88ae9c2 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml @@ -0,0 +1,265 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:46 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.156' + X-B3-Traceid: + - 226eb06e8a88b8ba020d84ad6821fed5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049646, + "jti" : "ToaY1QbhYVnXdKVtbo9/zHGP1pY=" + } + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/products + body: + encoding: UTF-8 + string: '{"name":"Team42 Product","description":"Spain\nRioja Tempranillo","manufacturer":"Grape + Vineyard","essentialFeatures":"Dry. 12% alcohol. Best vine variety.","tags":["Bestseller","Red + Wine","Sale"],"productIdentifiers":[{"type":"EAN","value":"9780134308135"}],"salesPrice":{"taxModel":"GROSS","amount":8.7,"currency":"GBP"},"listPrice":{"taxModel":"GROSS","amount":10.95,"currency":"GBP"},"manufacturerPrice":{"taxModel":"GROSS","amount":11.95,"currency":"GBP"},"visible":true,"taxClass":"REGULAR","shippingWeight":{"value":1175.0,"displayUnit":"GRAMS"},"maxOrderQuantity":6,"shippingDimension":{"length":1500,"width":1000,"height":2000},"refPrice":{"refQuantity":1,"unit":"LITER","quantity":0.75,"price":{"taxModel":"GROSS","amount":11.6,"currency":"GBP"}},"shippingPeriod":{"min":2,"max":4,"displayUnit":"WEEKS"},"pickupPeriod":{"min":1,"max":2,"displayUnit":"WEEKS"},"productLabels":[{"type":"NEW","activeFrom":"2024-08-13T11:31:30.210787732","activeUntil":"2024-09-10T11:31:30.210787732"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.145' + X-B3-Traceid: + - 29b58716c856411ff91c828f90cfecd2 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "0c3d27de-5b4d-4432-bf7b-caf7ff289d93", + "lastModifiedAt" : "2024-08-19T06:40:47.012323725", + "sku" : "1026", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833333333333333333333, + "taxRate" : 0.2 + } + }, + "tags" : [ "Bestseller", "Red Wine", "Sale" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.210787732", + "activeUntil" : "2024-09-10T11:31:30.210787732" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/additional-descriptions" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:46 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml new file mode 100644 index 0000000..111c0d4 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml @@ -0,0 +1,460 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:47 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.087' + X-B3-Traceid: + - f7e13b884aa50e1d56de1244c68d8652 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724049647, + "jti" : "Bm+dFIVaS5YT9k2JXpxVf0D0haE=" + } + recorded_at: Mon, 19 Aug 2024 06:40:47 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/products + body: + encoding: UTF-8 + string: '{"name":"Team42 Product","description":"Spain\nRioja Tempranillo","manufacturer":"Grape + Vineyard","essentialFeatures":"Dry. 12% alcohol. Best vine variety.","tags":["Bestseller","Red + Wine","Sale"],"productIdentifiers":[{"type":"EAN","value":"9780134308135"}],"salesPrice":{"taxModel":"GROSS","amount":8.7,"currency":"GBP"},"listPrice":{"taxModel":"GROSS","amount":10.95,"currency":"GBP"},"manufacturerPrice":{"taxModel":"GROSS","amount":11.95,"currency":"GBP"},"visible":true,"taxClass":"REGULAR","shippingWeight":{"value":1175.0,"displayUnit":"GRAMS"},"maxOrderQuantity":6,"shippingDimension":{"length":1500,"width":1000,"height":2000},"refPrice":{"refQuantity":1,"unit":"LITER","quantity":0.75,"price":{"taxModel":"GROSS","amount":11.6,"currency":"GBP"}},"shippingPeriod":{"min":2,"max":4,"displayUnit":"WEEKS"},"pickupPeriod":{"min":1,"max":2,"displayUnit":"WEEKS"},"productLabels":[{"type":"NEW","activeFrom":"2024-08-13T11:31:30.210787732","activeUntil":"2024-09-10T11:31:30.210787732"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 06:40:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.129' + X-B3-Traceid: + - 5148ada46a37287265e528a0d4a794bc + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "532065c3-5d71-44a6-8b8d-764c798f3b95", + "lastModifiedAt" : "2024-08-19T06:40:47.429253718", + "sku" : "1027", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833333333333333333333, + "taxRate" : 0.2 + } + }, + "tags" : [ "Bestseller", "Red Wine", "Sale" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.210787732", + "activeUntil" : "2024-09-10T11:31:30.210787732" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/additional-descriptions" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:47 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 06:40:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.035' + X-B3-Traceid: + - 7a1e8f0003d347ff5d78ddadbf098880 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "532065c3-5d71-44a6-8b8d-764c798f3b95", + "lastModifiedAt" : "2024-08-19T06:40:47.429", + "sku" : "1027", + "salesPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 8.7, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 7.25, + "taxRate" : 0.2 + } + }, + "listPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 10.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.125, + "taxRate" : 0.2 + } + }, + "manufacturerPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.95, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.95833, + "taxRate" : 0.2 + } + }, + "tags" : [ "Sale", "Bestseller", "Red Wine" ], + "productIdentifiers" : [ { + "type" : "EAN", + "value" : "9780134308135" + } ], + "visible" : true, + "taxClass" : "REGULAR", + "shippingWeight" : { + "value" : 1175.0, + "displayUnit" : "GRAMS" + }, + "maxOrderQuantity" : 6, + "shippingDimension" : { + "length" : 1500, + "width" : 1000, + "height" : 2000 + }, + "refPrice" : { + "refQuantity" : 1, + "unit" : "LITER", + "quantity" : 0.75, + "price" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 11.6, + "derivedPrice" : { + "taxModel" : "NET", + "currency" : "GBP", + "amount" : 9.6667, + "taxRate" : 0.2 + } + } + }, + "shippingPeriod" : { + "min" : 2, + "max" : 4, + "displayUnit" : "WEEKS" + }, + "pickupPeriod" : { + "min" : 1, + "max" : 2, + "displayUnit" : "WEEKS" + }, + "name" : "Team42 Product", + "description" : "Spain\nRioja Tempranillo", + "manufacturer" : "Grape Vineyard", + "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", + "variationAttributes" : [ ], + "customText" : null, + "productLabels" : [ { + "type" : "NEW", + "activeFrom" : "2024-08-13T11:31:30.211", + "activeUntil" : "2024-09-10T11:31:30.211" + } ], + "isVariationProduct" : false, + "_embedded" : { + "availability" : { + "availabilityState" : "IN_STOCK", + "availableStock" : null, + "stockThreshold" : null, + "purchasable" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" + } + } + } + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95" + }, + "availability" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attributes" + }, + "attachments" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attachments" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/images" + }, + "default-image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/default-image" + }, + "videos" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/videos" + }, + "cross-sells" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/cross-sells" + }, + "multiple-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/multiple-images" + }, + "external-images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/external-images" + }, + "additional-descriptions" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/additional-descriptions" + } + } + } + recorded_at: Mon, 19 Aug 2024 06:40:47 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml b/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml new file mode 100644 index 0000000..b672485 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml @@ -0,0 +1,146 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:29:59 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - da5289c9d5b4a4f03418f74baa9563e1 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052599, + "jti" : "+3Bi9GKMlZei8yQdrBRl8otJG9o=" + } + recorded_at: Mon, 19 Aug 2024 07:29:58 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/address + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:29:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.139' + X-B3-Traceid: + - 6c81891217360b02b1c94ad8e223efa4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "company" : "Team42", + "firstName" : "Team42", + "lastName" : "Team42", + "email" : "k.salazar@epages.com", + "phone" : "Team42", + "fax" : null, + "street" : "Team42", + "street2" : null, + "postalCode" : "12345", + "dependentLocality" : null, + "city" : "Somewhere", + "state" : "", + "country" : "GB", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" + }, + "address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:29:59 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml b/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml new file mode 100644 index 0000000..3a71722 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml @@ -0,0 +1,160 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:36:16 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.171' + X-B3-Traceid: + - 5d0474f38fa3cd44d8d2db510cc40b8a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052976, + "jti" : "fP5GZ4flKaRAKWsK77zoPkasf58=" + } + recorded_at: Mon, 19 Aug 2024 07:36:16 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:36:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - 2ae749c42757058dbaa58127e4426c42 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "5227687a-aa6b-487c-9c2b-afccf1573cea", + "name" : "Team42 Beyond API", + "resellerName" : "epages", + "primaryHostname" : "team42-beyond-api.beyondshop.cloud", + "fallbackHostname" : "team42-beyond-api.beyondshop.cloud", + "tax" : { + "taxModel" : "GROSS", + "vatExempted" : false, + "country" : "GB", + "supportedTaxClasses" : [ "EXEMPT", "REDUCED", "REGULAR" ] + }, + "currencies" : [ "GBP" ], + "defaultCurrency" : "GBP", + "locales" : [ "en-GB" ], + "defaultLocale" : "en-GB", + "closedByMerchant" : true, + "emailConfirmed" : true, + "socialSharingEnabled" : true, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + }, + "shop" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + }, + "address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" + }, + "images" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images" + }, + "legal" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/legal" + }, + "attributes" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:36:16 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml new file mode 100644 index 0000000..ef99947 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.088' + X-B3-Traceid: + - d8bb94fce645e11df41f02cdf798c48c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051815, + "jti" : "tZ1d2LY1w2EHdOp6Fio2ID2v6sU=" + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.019' + X-B3-Traceid: + - 4bb5130872df2dc70bef5c5eabcb7790 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "script-tags" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml new file mode 100644 index 0000000..0adb11d --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml @@ -0,0 +1,182 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - 0c97be1daa45232d28dd92b0f670a097 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051815, + "jti" : "oSMzgxORYBuMaGTwU6WxFQhB3PI=" + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:16:55 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.074' + X-B3-Traceid: + - ca7443df2ac52d190d47ea8d7df1ffb4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "3bda8799-ed96-4f27-836a-4fb034e43a48", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - d943e40a62bcba3951b1f008012de45d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:16:55 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml new file mode 100644 index 0000000..634ca55 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml @@ -0,0 +1,242 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.097' + X-B3-Traceid: + - 2cd075d0bf0e39ff6109d213e139fb9e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055781, + "jti" : "C6UJPHY9f5Dc8FU43LVeiN2zoWw=" + } + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - d1f65daa2ab4973f56910dfe9abd53c6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "861516c1-32ce-4dfe-8bb7-f36d30194eed", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.049' + X-B3-Traceid: + - a28101666148e32f48b4e2d4a98f4e39 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 08:23:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.023' + X-B3-Traceid: + - 4da97a350edaea722e1135e1570c732d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "script-tag.not-found", + "details" : { }, + "message" : "script-tag with id 861516c1-32ce-4dfe-8bb7-f36d30194eed could not be found", + "traceId" : "4da97a350edaea722e1135e1570c732d" + } + recorded_at: Mon, 19 Aug 2024 08:23:01 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml new file mode 100644 index 0000000..a4e4441 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml @@ -0,0 +1,242 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - a593d0cdd236de07616aef78bf6a6655 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051816, + "jti" : "FU5e5c1fVeoVADYx6gMOUbbaE9g=" + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - 4b85311b0c4bc77c83cbd4b03eaf43cc + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "c84ded08-d594-4124-a868-cf660c507e10", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.049' + X-B3-Traceid: + - 7d438309bcb3899f073002e6bcaec3d9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 07:16:57 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.027' + X-B3-Traceid: + - a3989af594a1f550cdfc565446fe21b9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "script-tag.not-found", + "details" : { }, + "message" : "script-tag with id c84ded08-d594-4124-a868-cf660c507e10 could not be found", + "traceId" : "a3989af594a1f550cdfc565446fe21b9" + } + recorded_at: Mon, 19 Aug 2024 07:16:57 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml new file mode 100644 index 0000000..60b4c61 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml @@ -0,0 +1,182 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - 69f92027deeb0baa1b3cc91a4fc2b0a9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724051816, + "jti" : "fibGyoBMMp+/jt/tl0DI6Y3psV8=" + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags + body: + encoding: UTF-8 + string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.030' + X-B3-Traceid: + - d76f1dd31353f4c98c74c418a4fe7fc5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "2d427037-5968-46e6-b32a-a59f189ebfb2", + "categories" : [ ], + "scriptUrl" : "https://example.com/scripts/exampleScript.js", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:16:56 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.057' + X-B3-Traceid: + - 26a4d23f761f124c1408ca0ea977412a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:16:56 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml new file mode 100644 index 0000000..394f975 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.111' + X-B3-Traceid: + - e0b99fb5d7ea3fa4fee24a224568d657 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052312, + "jti" : "CtoBgVKfRCv3wpVQ9i1Wt0WOr3U=" + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.054' + X-B3-Traceid: + - 4671d01950bc1fa1eb36536e344c3231 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "subscriptions" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml new file mode 100644 index 0000000..f004bef --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml @@ -0,0 +1,186 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - 29853db6da84b038e366c4c73a92e840 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052312, + "jti" : "dEZQvxoGOAVa9WMsx8d3qhjUrcI=" + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:25:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.055' + X-B3-Traceid: + - a543aff3022f92da255ecbc32ba6f474 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "2a3707d0-3cc1-462a-84c2-176c5e1cf689", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:12 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.038' + X-B3-Traceid: + - fd40a1d4fc79789287c66b0ad0cc1fa2 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml new file mode 100644 index 0000000..53cbeb6 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml @@ -0,0 +1,238 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.160' + X-B3-Traceid: + - 661b0474ff0beed08492404ba4b3246e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724055782, + "jti" : "etTNATIXyAYxSmeXKD6CSUrTCNs=" + } + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.054' + X-B3-Traceid: + - db202fddc69411adc9750a7a93eb1f36 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "ba3d5330-ed1d-440d-abce-7ad54c3f0d08", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - d0c2be1d708e5ef0cd3eb8dadf70b2c1 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 08:23:02 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.019' + X-B3-Traceid: + - 455eabf287b14c709350c96903b48836 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 08:23:02 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml new file mode 100644 index 0000000..a76d87f --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml @@ -0,0 +1,238 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.101' + X-B3-Traceid: + - 4db8dbee6bd5eb98accdbc08e7882f9a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052313, + "jti" : "2ArIrBGdwUsrtgORQ3UHj53FcCk=" + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - a378220db8b2d3339b2fa689ffc28cc8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "a6cbd477-e250-4aaf-85cc-5dc899573a6c", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:25:14 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.035' + X-B3-Traceid: + - f42e017c7d27b95cff64de4d173ad537 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:14 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 19 Aug 2024 07:25:14 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.017' + X-B3-Traceid: + - e017a73d6b541d39e90ca41bf4fbca6c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:14 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml new file mode 100644 index 0000000..67948af --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml @@ -0,0 +1,254 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - c962e7ebc9678a42f7470be9c81b683b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724052313, + "jti" : "puBdyxl6qlmDmf+P8r/jL4V1F8c=" + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.033' + X-B3-Traceid: + - f87514392ebcf7dec97dd79d461f0a0e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "50873c4d-97da-4cbb-b221-1b6da35dd1fd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.022' + X-B3-Traceid: + - d8a9409cf4a1a9da9ff09fc8669e2bc4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "order.created", "product.created" ], + "active" : true, + "_id" : "50873c4d-97da-4cbb-b221-1b6da35dd1fd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd/deactivate" + } + } + } + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 19 Aug 2024 07:25:13 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.031' + X-B3-Traceid: + - bcf9b63acbf3b35ea7c6e4e7c89d2b8c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 19 Aug 2024 07:25:13 GMT +recorded_with: VCR 6.2.0 From 028109c8108e2e1429cbb3a218cf652eac86023b Mon Sep 17 00:00:00 2001 From: Andres Bernardi Date: Mon, 19 Aug 2024 13:12:04 +0200 Subject: [PATCH 47/59] Revert "EPT-2950 Add tests (#75)" This reverts commit 123457cc2d5109c657548f2b8f759395b75a3e98. --- Gemfile | 2 - Gemfile.lock | 24 +- bin/console | 3 + lib/beyond_api/concerns/connection.rb | 9 - .../services/authentication/signer.rb | 4 +- .../services/product_management/category.rb | 16 - .../services/product_management/image.rb | 2 +- .../services/product_management/product.rb | 6 +- .../services/product_management/variation.rb | 2 +- .../services/storefront/script_tag.rb | 4 +- .../services/webhook/subscription.rb | 6 +- spec/beyond_api/resources/products_spec.rb | 78 + .../resources/products_view_spec.rb | 15 + spec/beyond_api/resources/variations_spec.rb | 93 + .../services/authentication/signer_spec.rb | 30 - .../services/authentication/token_spec.rb | 24 - .../services/checkout/shipping_zone_spec.rb | 13 - .../product_management/category_spec.rb | 58 - .../services/product_management/image_spec.rb | 13 - .../product_management/product_spec.rb | 36 - spec/beyond_api/services/shop/address_spec.rb | 12 - spec/beyond_api/services/shop/shop_spec.rb | 11 - .../services/storefront/script_tag_spec.rb | 38 - .../services/webhook/subscription_spec.rb | 46 - spec/beyond_api/utils_spec.rb | 2 +- spec/factories/category_data.rb | 14 - spec/factories/product_data.rb | 103 - spec/factories/webhook_data.rb | 8 - spec/spec_helper.rb | 23 +- spec/support/vcr.rb | 41 - .../_all/returns_all_signers.yml | 159 - .../_create/creates_a_new_signer.yml | 131 - .../with_signer/_delete/deletes_a_signer.yml | 185 -- .../with_signer/_destroy/deletes_a_signer.yml | 185 -- .../refreshes_the_token.yml | 67 - ...retrieves_token_via_authorization_code.yml | 61 - ...retrieves_token_via_client_credentials.yml | 66 - .../_all/returns_all_shipping_zones.yml | 136 - .../_all/returns_all_categories.yml | 150 - .../_create/creates_a_new_category.yml | 187 -- .../_delete/deletes_a_category.yml | 247 -- .../_destroy/deletes_a_category.yml | 247 -- .../_find/returns_a_category.yml | 256 -- .../_update/updates_an_existing_category.yml | 256 -- .../_all/returns_all_images.yml | 136 - .../_all/returns_all_products.yml | 2948 ----------------- .../_create/creates_a_new_product.yml | 265 -- .../with_product/_find/returns_a_product.yml | 460 --- .../_get/returns_the_shop_address.yml | 146 - .../_get/returns_the_shop_details.yml | 160 - .../_all/returns_all_script_tags.yml | 136 - .../_create/creates_a_new_category.yml | 182 - .../_delete/deletes_a_script_tag.yml | 242 -- .../_destroy/deletes_a_script_tag.yml | 242 -- .../_find/returns_a_script_tag.yml | 182 - .../returns_all_webhook_subscriptions.yml | 136 - .../creates_a_new_webhook_subscription.yml | 186 -- .../deletes_a_webhook_subscription.yml | 238 -- .../deletes_a_webhook_subscription.yml | 238 -- .../_find/returns_a_webhook_subscription.yml | 254 -- 60 files changed, 218 insertions(+), 9002 deletions(-) create mode 100644 spec/beyond_api/resources/products_spec.rb create mode 100644 spec/beyond_api/resources/products_view_spec.rb create mode 100644 spec/beyond_api/resources/variations_spec.rb delete mode 100644 spec/beyond_api/services/authentication/signer_spec.rb delete mode 100644 spec/beyond_api/services/authentication/token_spec.rb delete mode 100644 spec/beyond_api/services/checkout/shipping_zone_spec.rb delete mode 100644 spec/beyond_api/services/product_management/category_spec.rb delete mode 100644 spec/beyond_api/services/product_management/image_spec.rb delete mode 100644 spec/beyond_api/services/product_management/product_spec.rb delete mode 100644 spec/beyond_api/services/shop/address_spec.rb delete mode 100644 spec/beyond_api/services/shop/shop_spec.rb delete mode 100644 spec/beyond_api/services/storefront/script_tag_spec.rb delete mode 100644 spec/beyond_api/services/webhook/subscription_spec.rb delete mode 100644 spec/factories/category_data.rb delete mode 100644 spec/factories/product_data.rb delete mode 100644 spec/factories/webhook_data.rb delete mode 100644 spec/support/vcr.rb delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml delete mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml diff --git a/Gemfile b/Gemfile index a46f237..cd70397 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,5 @@ end group :test do gem "factory_bot" - gem "jwt" - gem "vcr" gem "webmock" end diff --git a/Gemfile.lock b/Gemfile.lock index 9ea306e..89fcb53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,24 +10,23 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.2.0) + activesupport (7.1.3.4) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.3.1) + concurrent-ruby (~> 1.0, >= 1.0.2) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) - logger (>= 1.4.2) minitest (>= 5.1) - securerandom (>= 0.3) - tzinfo (~> 2.0, >= 2.0.5) + mutex_m + tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) bigdecimal (3.1.8) coderay (1.1.3) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.3) connection_pool (2.4.1) crack (1.0.0) bigdecimal @@ -50,16 +49,15 @@ GEM i18n (1.14.5) concurrent-ruby (~> 1.0) json (2.7.2) - jwt (2.8.2) - base64 language_server-protocol (3.17.0.3) logger (1.6.0) method_source (1.1.0) minitest (5.24.1) + mutex_m (0.2.0) net-http (0.4.1) uri - parallel (1.26.2) - parser (3.3.4.2) + parallel (1.25.1) + parser (3.3.4.0) ast (~> 2.4.1) racc pry (0.14.2) @@ -70,7 +68,7 @@ GEM rainbow (3.1.1) rake (10.5.0) regexp_parser (2.9.2) - rexml (3.3.5) + rexml (3.3.4) strscan rspec (3.13.0) rspec-core (~> 3.13.0) @@ -110,13 +108,11 @@ GEM rubocop-rspec_rails (2.29.1) rubocop (~> 1.61) ruby-progressbar (1.13.0) - securerandom (0.3.1) strscan (3.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) uri (0.13.0) - vcr (6.2.0) webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -134,13 +130,11 @@ DEPENDENCIES dotenv (~> 2.7) factory_bot faker (~> 2.2) - jwt pry rake (~> 10.0) rspec (~> 3.0) rubocop rubocop-rspec (~> 2.4) - vcr webmock yard (~> 0.9) diff --git a/bin/console b/bin/console index 89df3af..ce7d2fa 100755 --- a/bin/console +++ b/bin/console @@ -9,6 +9,9 @@ unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil? BeyondApi.setup do |config| config.client_id = ENV["CLIENT_ID"] config.client_secret = ENV["CLIENT_SECRET"] + config.remove_response_links = true + config.remove_response_key_underscores = true + config.object_struct_responses = false end end diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 806a3b9..8bdd68e 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -10,15 +10,6 @@ def get(path, params = {}) handle_request { agent.get(path, parse_request(params)) } end - def put(path, body = {}, params = {}) - handle_request do - agent.put(path, body) do |request| - request.params = parse_request(params) - request.body = parse_request(body) - end - end - end - def post(path, body = {}, params = {}) handle_request do agent.post(path, body) do |request| diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 8c7371f..2e67b2d 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -9,8 +9,8 @@ def create post("signers") end - def delete(id) - super("signers/#{id}") # Concerns::Connection delete method + def destroy(id) + delete("signers/#{id}") end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index e6926ce..a2c4058 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -4,22 +4,6 @@ class Category < BaseService def find(id) get("categories/#{id}") end - - def all(params = {}) - fetch_all_pages("categories", params) - end - - def create(body) - post("categories", body) - end - - def update(id, body) - put("categories/#{id}", body) - end - - def delete(id) - super("categories/#{id}") # Concerns::Connection delete method - end end end end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 658af3c..72b0cb4 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Image < BaseService def all(id, params = {}) - get("products/#{id}/images", params) + get("products/#{id}/images") end end end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index 31a6f77..1ad5c35 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,11 +2,7 @@ module BeyondApi module ProductManagement class Product < BaseService def all(params = {}) - fetch_all_pages("products", params) - end - - def create(body) - post("products", body) + fetch_all_pages("/products", params) end def find(id) diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 1af3319..41ba8b2 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,7 @@ module BeyondApi module ProductManagement class Variation < BaseService def all(id, params = {}) - get("products/#{id}/variations", params) + get("products/#{id}/variations") end end end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 17c5259..6c5eaed 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -11,8 +11,8 @@ def create(script_url) post("script-tags", script_url:) end - def delete(id) - super("script-tags/#{id}") # Concerns::Connection delete method + def destroy(id) + delete("script-tags/#{id}") end end end diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 2cb4341..349f80f 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -11,12 +11,12 @@ def create(body) def delete_all all.dig(:embedded, :subscriptions).each do |subscription| - delete(subscription[:id]) + destroy(subscription[:id]) end end - def delete(id) - super("webhook-subscriptions/#{id}") # Concerns::Connection delete method + def destroy(id) + delete("webhook-subscriptions/#{id}") end def find(id) diff --git a/spec/beyond_api/resources/products_spec.rb b/spec/beyond_api/resources/products_spec.rb new file mode 100644 index 0000000..db72897 --- /dev/null +++ b/spec/beyond_api/resources/products_spec.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +RSpec.describe 'BeyondApi::Products' do + let!(:session) do + session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) + session.token.client_credentials + end + + let(:product) { @product = session.products.create(FactoryBot.build(:product)) } + + let!(:file_path) do + app_root = File.expand_path(File.dirname("ext.rb")) + "#{app_root}/spec/files/" + end + + describe "non existing product" do + it "create a new regular product and " do + product = session.products.create(FactoryBot.build(:product)) + + expect(product).not_to be nil + expect(product.id).not_to be nil + end + end + + + describe "product exist" do + it "find a product sending an ID" do + response = session.products.find(product.id) + expect(response).not_to be nil + expect(response.id).to eq(product.id) + end + + + it "upload multiple images" do + files = [ + "#{file_path}image1.png", + "#{file_path}image2.png" + ] + + images = session.products.upload_multiple_images(product.id, + files, + ["image1.png", "image2.png"]) + expect(images).not_to be nil + expect(images.embedded.images.is_a?(Array)).to eq true + end + + it "upload a single image" do + file = "#{file_path}image1.png" + + image = session.products.upload_image(product.id, file, "image3.png") + expect(image).not_to be nil + expect(image).to eq true + end + + it "sort product images" do + files = [ + "#{file_path}image1.png", + "#{file_path}image2.png" + ] + + session.products.upload_multiple_images(product.id, + files, + ["image1.png", "image2.png"]) + + images = session.products.images(product.id) + + images_sorted = images.embedded.images.sort_by(&:position).reverse.map(&:id) + + sorted = session.products.sort_images(product.id, images_sorted) + + images = session.products.images(product.id) + + expect(sorted).not_to be nil + expect(sorted).to eq true + expect(images.embedded.images.map(&:id)).to eq images_sorted + end + end +end diff --git a/spec/beyond_api/resources/products_view_spec.rb b/spec/beyond_api/resources/products_view_spec.rb new file mode 100644 index 0000000..d76d054 --- /dev/null +++ b/spec/beyond_api/resources/products_view_spec.rb @@ -0,0 +1,15 @@ +RSpec.describe 'BeyondApi::ProductsView' do + let!(:session) do + session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) + session.token.client_credentials + end + + let(:product) { @product = session.products.create(FactoryBot.build(:product)) } + + it "list products with specific tag" do + response = session.products_view.search_by_tag("beyond_api-ruby_client") + expect(response).not_to be nil + expect(response.embedded.products.class).to be(Array) + expect(response.embedded.products.size).to be >= 1 + end +end diff --git a/spec/beyond_api/resources/variations_spec.rb b/spec/beyond_api/resources/variations_spec.rb new file mode 100644 index 0000000..af774b5 --- /dev/null +++ b/spec/beyond_api/resources/variations_spec.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +RSpec.describe 'BeyondApi::Variations' do + let!(:file_path) do + app_root = File.expand_path(File.dirname("ext.rb")) + "#{app_root}/spec/files/" + end + + let!(:session) do + session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) + session.token.client_credentials + end + + let(:product) { session.products.create(FactoryBot.build(:product, :with_variations)) } + let(:variation) do + session.variations.all(product.id).embedded.variations.first + end + let(:default_image_property) do + body = [{ + property: "defaultImage", + enabled: true + }] + session.products.update_variation_properties(product.id, body) + end + + context "Create variation" do + it "Update image variation property" do + body = [{ + property: "defaultImage", + enabled: true + }] + response = session.products.update_variation_properties(product.id, body) + + expect(response).not_to be nil + default_image_prop = response.embedded.variation_properties.find { |prop| prop.property == "defaultImage" } + + expect(default_image_prop).not_to be nil + expect(default_image_prop.enabled).to be true + end + + it "Upload multiple images" do + files = [ + "#{file_path}image1.png", + "#{file_path}image2.png" + ] + + default_image_property + response = session.variations.upload_multiple_images(product.id, + variation.id, + files, + ["image1.png", "image2.png"]) + + expect(response).not_to be nil + end + + it "Upload a single image" do + file = "#{file_path}image1.png" + + default_image_property + response = session.variations.upload_multiple_images(product.id, + variation.id, + file, + "variation1.png") + + expect(response).not_to be nil + end + + it "sort variation images" do + files = [ + "#{file_path}image1.png", + "#{file_path}image2.png" + ] + + default_image_property + response = session.variations.upload_multiple_images(product.id, + variation.id, + files, + ["image1.png", "image2.png"]) + + images = session.variations.images(product.id, variation.id) + + images_sorted = images.embedded.images.sort_by(&:position).reverse.map(&:id) + + sorted = session.variations.sort_images(product.id, variation.id, images_sorted) + + images = session.variations.images(product.id, variation.id) + + expect(sorted).not_to be nil + expect(sorted).to eq true + expect(images.embedded.images.map(&:id)).to eq images_sorted + end + end +end diff --git a/spec/beyond_api/services/authentication/signer_spec.rb b/spec/beyond_api/services/authentication/signer_spec.rb deleted file mode 100644 index 07fd084..0000000 --- a/spec/beyond_api/services/authentication/signer_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -RSpec.describe BeyondApi::Authentication::Signer, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe '#all' do - it 'returns all signers' do - signers = client.all - - expect(signers.dig(:embedded, :signers)).to be_an(Array) - end - end - - context "with signer" do - before(:each) do - @signer = client.create - end - - describe '#create' do - it 'creates a new signer' do - expect(@signer).to be_a(Hash) - end - end - - describe '#delete' do - it 'deletes a signer' do - response = client.delete(@signer[:id]) - expect(response).to be {} - end - end - end -end diff --git a/spec/beyond_api/services/authentication/token_spec.rb b/spec/beyond_api/services/authentication/token_spec.rb deleted file mode 100644 index 35d6f4b..0000000 --- a/spec/beyond_api/services/authentication/token_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -RSpec.describe BeyondApi::Authentication::Token, vcr: true do - it "retrieves token via client credentials" do - response = auth_client.client_credentials - expect(response).not_to be nil - expect(response[:access_token].class).to be(String) - expect(response[:refresh_token]).to be(nil) - end - - it "retrieves token via authorization code" do - expect { - response = auth_client.get('abcde') - }.to raise_error(BeyondApi::Error) do |error| - expect(error.response[:error]).to eq("invalid_grant") - expect(error.response[:error_description]).to eq("Invalid authorization code: abcde") - end - end - - it "refreshes the token" do - response = auth_client.refresh(ENV["REFRESH_TOKEN"]) - expect(response).not_to be nil - expect(response[:access_token].class).to be(String) - expect(response[:refresh_token].class).to be(String) - end -end diff --git a/spec/beyond_api/services/checkout/shipping_zone_spec.rb b/spec/beyond_api/services/checkout/shipping_zone_spec.rb deleted file mode 100644 index 292ba2c..0000000 --- a/spec/beyond_api/services/checkout/shipping_zone_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -RSpec.describe BeyondApi::Checkout::ShippingZone, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".all" do - it "returns all shipping_zones" do - response = client.all - - expect(response).not_to be nil - expect(response.dig(:embedded, :shipping_zones)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) - end - end -end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb deleted file mode 100644 index dd6f2c3..0000000 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -RSpec.describe BeyondApi::ProductManagement::Category, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".all" do - it "returns all categories" do - response = client.all - - expect(response).not_to be nil - expect(response.dig(:embedded, :categories)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) - end - end - - context "with category" do - before(:each) do - @category = client.create(build(:category_data)) - end - - describe ".create" do - it "creates a new category" do - expect(@category).not_to be nil - expect(@category[:name]).to eq("Team42 Category") - expect(@category[:type]).to eq("SMART") - expect(@category[:default_sort]).to eq("HIGHEST_PRICE_FIRST") - end - end - - describe ".find" do - it "returns a category" do - response = client.find(@category[:id]) - expect(response[:name]).to eq("Team42 Category") - end - end - - describe ".update" do - it "updates an existing category" do - updated_category_data = FactoryBot.build(:category_data, :lowest_price_first) - - updated_category = client.update(@category[:id], updated_category_data) - expect(updated_category).not_to be nil - expect(updated_category[:name]).to eq("Category with lowest price first") - expect(updated_category[:default_sort]).to eq("LOWEST_PRICE_FIRST") - end - end - - describe ".delete" do - it "deletes a category" do - response = client.delete(@category[:id]) - expect(response).to be {} - end - end - - after(:each) do - client.delete(@category[:id]) - rescue BeyondApi::Error - end - end -end diff --git a/spec/beyond_api/services/product_management/image_spec.rb b/spec/beyond_api/services/product_management/image_spec.rb deleted file mode 100644 index cb839e9..0000000 --- a/spec/beyond_api/services/product_management/image_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -RSpec.describe BeyondApi::ProductManagement::Image, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".all" do - it "returns all images" do - response = client.all("4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc") - - expect(response).not_to be nil - expect(response.dig(:embedded, :images)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) - end - end -end diff --git a/spec/beyond_api/services/product_management/product_spec.rb b/spec/beyond_api/services/product_management/product_spec.rb deleted file mode 100644 index 39bff0a..0000000 --- a/spec/beyond_api/services/product_management/product_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -RSpec.describe BeyondApi::ProductManagement::Product, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".all" do - it "returns all products" do - response = client.all - - expect(response).not_to be nil - expect(response.dig(:embedded, :products)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) - end - end - - context "with product" do - before(:each) do - @product = client.create(build(:product_data)) - end - - describe ".create" do - it "creates a new product" do - expect(@product).not_to be nil - expect(@product[:name]).to eq("Team42 Product") - expect(@product[:essential_features]).to eq("Dry. 12% alcohol. Best vine variety.") - expect(@product[:tags]).to eq(["Bestseller", "Red Wine", "Sale"]) - expect(@product[:product_identifiers]).to eq([{ type: "EAN", value: "9780134308135" }]) - end - end - - describe ".find" do - it "returns a product" do - response = client.find(@product[:id]) - expect(response[:name]).to eq("Team42 Product") - end - end - end -end diff --git a/spec/beyond_api/services/shop/address_spec.rb b/spec/beyond_api/services/shop/address_spec.rb deleted file mode 100644 index 0f9e5f1..0000000 --- a/spec/beyond_api/services/shop/address_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -RSpec.describe BeyondApi::Shop::Address, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".get" do - it "returns the shop address" do - response = client.show - expect(response).not_to be nil - expect(response.keys).to include(:company, :first_name, :last_name, :email, - :phone, :street, :postal_code, :dependent_locality, :city, :state, :country) - end - end -end diff --git a/spec/beyond_api/services/shop/shop_spec.rb b/spec/beyond_api/services/shop/shop_spec.rb deleted file mode 100644 index 35b1e11..0000000 --- a/spec/beyond_api/services/shop/shop_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -RSpec.describe BeyondApi::Shop::Shop, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".get" do - it "returns the shop details" do - response = client.show - expect(response).not_to be nil - expect(response.keys).to include(:name, :reseller_name, :primary_hostname, :default_locale) - end - end -end diff --git a/spec/beyond_api/services/storefront/script_tag_spec.rb b/spec/beyond_api/services/storefront/script_tag_spec.rb deleted file mode 100644 index 89b0581..0000000 --- a/spec/beyond_api/services/storefront/script_tag_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -RSpec.describe BeyondApi::Storefront::ScriptTag, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".all" do - it "returns all script tags" do - response = client.all - - expect(response).not_to be nil - expect(response.dig(:embedded, :script_tags)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) - end - end - - context "with script tag" do - before(:each) do - @script_tag = client.create("https://example.com/scripts/exampleScript.js") - end - - describe ".create" do - it "creates a new category" do - expect(@script_tag).not_to be nil - expect(@script_tag[:script_url]).to eq("https://example.com/scripts/exampleScript.js") - end - end - - describe ".delete" do - it "deletes a script tag" do - response = client.delete(@script_tag[:id]) - expect(response).to be {} - end - end - - after(:each) do - client.delete(@script_tag[:id]) - rescue BeyondApi::Error - end - end -end diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb deleted file mode 100644 index 48d59f4..0000000 --- a/spec/beyond_api/services/webhook/subscription_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -RSpec.describe BeyondApi::Webhook::Subscription, vcr: true do - let(:client) { described_class.new(api_url: ENV["API_URL"], access_token: beyond_access_token) } - - describe ".all" do - it "returns all webhook subscriptions" do - response = client.all - - expect(response).not_to be nil - expect(response.dig(:embedded, :subscriptions)).to be_kind_of(Array) - expect(response.dig(:page)).to be_kind_of(Hash) - end - end - - context "with webhook subscription" do - before(:each) do - @webhook_subscription = client.create(build(:webhook_data)) - end - - describe ".create" do - it "creates a new webhook subscription" do - expect(@webhook_subscription).not_to be nil - expect(@webhook_subscription[:callback_uri]).to eq("http://example.com/test") - expect(@webhook_subscription[:event_types]).to eq(["order.created", "product.created"]) - end - end - - describe ".find" do - it "returns a webhook subscription" do - response = client.find(@webhook_subscription[:id]) - expect(response[:callback_uri]).to eq("http://example.com/test") - end - end - - describe ".delete" do - it "deletes a webhook subscription" do - response = client.delete(@webhook_subscription[:id]) - expect(response).to be {} - end - end - - after(:each) do - client.delete(@webhook_subscription[:id]) - rescue BeyondApi::Error - end - end -end diff --git a/spec/beyond_api/utils_spec.rb b/spec/beyond_api/utils_spec.rb index edc0d72..d1c8d85 100644 --- a/spec/beyond_api/utils_spec.rb +++ b/spec/beyond_api/utils_spec.rb @@ -13,6 +13,6 @@ end it "parse snakecase to camelcase" do - expect("sales_price".camelize(:lower)).to eq "salesPrice" + expect("sales_price".camelize(false)).to eq "salesPrice" end end diff --git a/spec/factories/category_data.rb b/spec/factories/category_data.rb deleted file mode 100644 index 8f28256..0000000 --- a/spec/factories/category_data.rb +++ /dev/null @@ -1,14 +0,0 @@ -FactoryBot.define do - factory :category_data, class: Hash do - name { "Team42 Category" } - type { "SMART" } - default_sort { "HIGHEST_PRICE_FIRST" } - - trait :lowest_price_first do - name { "Category with lowest price first" } - default_sort { "LOWEST_PRICE_FIRST" } - end - - initialize_with { attributes } - end -end diff --git a/spec/factories/product_data.rb b/spec/factories/product_data.rb deleted file mode 100644 index 67e6f28..0000000 --- a/spec/factories/product_data.rb +++ /dev/null @@ -1,103 +0,0 @@ -FactoryBot.define do - factory :product_data, class: Hash do - name { "Team42 Product" } - description { "Spain\nRioja Tempranillo" } - manufacturer { "Grape Vineyard" } - essential_features { "Dry. 12% alcohol. Best vine variety." } - tags { ["Bestseller", "Red Wine", "Sale"] } - - product_identifiers do - [ - { - type: "EAN", - value: "9780134308135" - } - ] - end - - sales_price do - { - tax_model: "GROSS", - amount: 8.7, - currency: "GBP" - } - end - - list_price do - { - tax_model: "GROSS", - amount: 10.95, - currency: "GBP" - } - end - - manufacturer_price do - { - tax_model: "GROSS", - amount: 11.95, - currency: "GBP" - } - end - - visible { true } - tax_class { "REGULAR" } - - shipping_weight do - { - value: 1175.0, - display_unit: "GRAMS" - } - end - - max_order_quantity { 6 } - - shipping_dimension do - { - length: 1500, - width: 1000, - height: 2000 - } - end - - ref_price do - { - ref_quantity: 1, - unit: "LITER", - quantity: 0.75, - price: { - tax_model: "GROSS", - amount: 11.6, - currency: "GBP" - } - } - end - - shipping_period do - { - min: 2, - max: 4, - display_unit: "WEEKS" - } - end - - pickup_period do - { - min: 1, - max: 2, - display_unit: "WEEKS" - } - end - - product_labels do - [ - { - type: "NEW", - active_from: "2024-08-13T11:31:30.210787732", - active_until: "2024-09-10T11:31:30.210787732" - } - ] - end - - initialize_with { attributes } - end -end diff --git a/spec/factories/webhook_data.rb b/spec/factories/webhook_data.rb deleted file mode 100644 index 39b9c4c..0000000 --- a/spec/factories/webhook_data.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryBot.define do - factory :webhook_data, class: Hash do - callback_uri { "http://example.com/test" } - event_types { ["order.created", "product.created"] } - - initialize_with { attributes } - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c58969a..aababc9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,9 +22,15 @@ FactoryBot.find_definitions end - AppRoot = File.expand_path(File.dirname("vcr.rb")) - - load "#{AppRoot}/spec/support/vcr.rb" + config.after(:suite) do + session = BeyondApi::Session.new(api_url: ENV["SHOP_URL"]) + session.token.client_credentials + + products = session.products.all + products.embedded.products.each do |product| + session.products.delete(product.id) + end + end end BeyondApi.setup do |config| @@ -32,14 +38,3 @@ config.client_secret = ENV["CLIENT_SECRET"] end -def auth_client - BeyondApi::Authentication::Token.new( - api_url: ENV["API_URL"], - client_id: ENV["CLIENT_ID"], - client_secret: ENV["CLIENT_SECRET"] - ) -end - -def beyond_access_token - auth_client.client_credentials[:access_token] -end diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb deleted file mode 100644 index a64f116..0000000 --- a/spec/support/vcr.rb +++ /dev/null @@ -1,41 +0,0 @@ -require "jwt" -require "vcr" - -VCR.configure do |config| - config.cassette_library_dir = "spec/vcr_cassettes" - config.hook_into :webmock - config.configure_rspec_metadata! - config.ignore_localhost = true - config.default_cassette_options = { - match_requests_on: [ :method, :uri, :body ] - } - - config.filter_sensitive_data("") do |interaction| - authorizations = interaction.request.headers["Authorization"].first - if (match = authorizations.match(/^(Bearer|Basic)\s+([^,\s]+)/)) - match.captures.last - end - end - - config.filter_sensitive_data("") do |interaction| - response_body = JSON.parse(interaction.response.body) - response_body["access_token"] if response_body.is_a?(Hash) - rescue JSON::ParserError - nil - end - - config.filter_sensitive_data("") do |interaction| - response_body = JSON.parse(interaction.response.body) - response_body["refresh_token"] if response_body.is_a?(Hash) - rescue JSON::ParserError - nil - end - - config.filter_sensitive_data("") do |interaction| - ENV["REFRESH_TOKEN"] - end - - config.filter_sensitive_data("") do |interaction| - JWT.encode({ exp: (DateTime.now + 1.year).to_i }, nil, "HS256") - end -end diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml deleted file mode 100644 index 030cc77..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/_all/returns_all_signers.yml +++ /dev/null @@ -1,159 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:41 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.097' - X-B3-Traceid: - - '0636875c3bbcbab7867bda535fe5e243' - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049641, - "jti" : "8JwEzj6jy1EWDAYb40//fdukLso=" - } - recorded_at: Mon, 19 Aug 2024 06:40:41 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/signers - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:41 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.025' - X-B3-Traceid: - - 50d800fb4b92bedd1b243cbfadba6fb4 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "signers" : [ { - "_id" : "3c910dd7-65d8-4ee5-af7d-dd82de834d4b", - "createdAt" : "2024-08-19T06:37:59.951", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/3c910dd7-65d8-4ee5-af7d-dd82de834d4b" - } - } - }, { - "_id" : "7add803f-df8a-46a4-9e75-5afd75b01adc", - "createdAt" : "2024-08-19T06:36:40.976", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/7add803f-df8a-46a4-9e75-5afd75b01adc" - } - } - }, { - "_id" : "82920cfb-e1ab-4b3c-8e33-5702d86f6876", - "createdAt" : "2024-08-19T06:37:28.279", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/82920cfb-e1ab-4b3c-8e33-5702d86f6876" - } - } - }, { - "_id" : "b3de5fef-8385-4df4-a9a5-74a5aacb1277", - "createdAt" : "2024-08-19T06:35:38.891", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/b3de5fef-8385-4df4-a9a5-74a5aacb1277" - } - } - } ] - } - } - recorded_at: Mon, 19 Aug 2024 06:40:41 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml deleted file mode 100644 index f826990..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_create/creates_a_new_signer.yml +++ /dev/null @@ -1,131 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:41 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.107' - X-B3-Traceid: - - 76c69d85f495cae946b442180d524db6 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049641, - "jti" : "J/GfScnFC3pMwwgs5YDiIVP1HXo=" - } - recorded_at: Mon, 19 Aug 2024 06:40:41 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/signers - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:41 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.037' - X-B3-Traceid: - - 701352c68f255753f503b83c7fc89eba - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "2248041d-692c-4367-afc0-345cc68eab34", - "sharedSecret" : "59dh9nooefbgcqjnqtggu5s5j4", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/2248041d-692c-4367-afc0-345cc68eab34" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:41 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml deleted file mode 100644 index dc2e937..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_delete/deletes_a_signer.yml +++ /dev/null @@ -1,185 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 08:22:59 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.139' - X-B3-Traceid: - - 27d6f6696bed6e3f01e81ab3577000d5 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724055779, - "jti" : "l7k8DMT7GM5WeH61G8VGwETkteM=" - } - recorded_at: Mon, 19 Aug 2024 08:22:59 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/signers - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 08:23:00 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.041' - X-B3-Traceid: - - 6e71c1fa205231a52c7a58429b64b89b - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "92cb69c7-a830-4312-9dae-ffcf6603bba7", - "sharedSecret" : "u3v38frnqt59vka22kqaumpgft", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/92cb69c7-a830-4312-9dae-ffcf6603bba7" - } - } - } - recorded_at: Mon, 19 Aug 2024 08:23:00 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/signers/92cb69c7-a830-4312-9dae-ffcf6603bba7 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 08:23:00 GMT - Content-Length: - - '0' - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.043' - X-B3-Traceid: - - 34a99a554db99d028a1c47648840cf07 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 08:23:00 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml deleted file mode 100644 index 7b368bd..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Signer/with_signer/_destroy/deletes_a_signer.yml +++ /dev/null @@ -1,185 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:41 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.109' - X-B3-Traceid: - - d72048fff4e94acf0c52280599675dd9 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049641, - "jti" : "DjCpOBsqfphiDcCkDgpoRP4k5EM=" - } - recorded_at: Mon, 19 Aug 2024 06:40:41 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/signers - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:42 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.040' - X-B3-Traceid: - - c0ee336f1e05d262a21d2b02500caa18 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "494bf9b6-6550-486c-af70-1f6ba20efc15", - "sharedSecret" : "7i089vqpip8rp1rr8knpvtn9vf", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/signers/494bf9b6-6550-486c-af70-1f6ba20efc15" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:42 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/signers/494bf9b6-6550-486c-af70-1f6ba20efc15 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:42 GMT - Content-Length: - - '0' - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.046' - X-B3-Traceid: - - 4ff4a18a386e580d5cb7bad07cd18f96 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 06:40:42 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml deleted file mode 100644 index b3d84ca..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Token/refreshes_the_token.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=refresh_token&refresh_token= - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:42 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.068' - X-B3-Traceid: - - 763a7dd5f009d1ffbc6fbf526ebed43e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "refresh_token" : "", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049642, - "jti" : "DrMFA8sRZZLLJO+ba+Jand8vQA0=" - } - recorded_at: Mon, 19 Aug 2024 06:40:42 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml deleted file mode 100644 index 33b231f..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_authorization_code.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?code=abcde&grant_type=authorization_code - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Mon, 19 Aug 2024 06:40:42 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.065' - X-B3-Traceid: - - f7ff23495578391a48e8521e43b1713c - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "error" : "invalid_grant", - "error_description" : "Invalid authorization code: abcde" - } - recorded_at: Mon, 19 Aug 2024 06:40:42 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml b/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml deleted file mode 100644 index ef2289a..0000000 --- a/spec/vcr_cassettes/BeyondApi_Authentication_Token/retrieves_token_via_client_credentials.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:42 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.090' - X-B3-Traceid: - - 7bdb93b33bd69b735ecb9e195d0f5480 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049642, - "jti" : "0kCHmq0DeCKbXbVed8Em4P49/SM=" - } - recorded_at: Mon, 19 Aug 2024 06:40:42 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml b/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml deleted file mode 100644 index a6034cf..0000000 --- a/spec/vcr_cassettes/BeyondApi_Checkout_ShippingZone/_all/returns_all_shipping_zones.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:42 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.102' - X-B3-Traceid: - - ade04437123682156ae9bbd7667045a3 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049642, - "jti" : "xEIok9IjDV4GjerA3jFWgrvFXhE=" - } - recorded_at: Mon, 19 Aug 2024 06:40:42 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/shipping-zones - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:43 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.020' - X-B3-Traceid: - - a5f64146e475157a05c57418c445a262 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "shipping-zones" : [ ] - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shipping-zones?page=0&size=20" - } - }, - "page" : { - "size" : 20, - "totalElements" : 0, - "totalPages" : 0, - "number" : 0 - } - } - recorded_at: Mon, 19 Aug 2024 06:40:43 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml deleted file mode 100644 index 46bc703..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/_all/returns_all_categories.yml +++ /dev/null @@ -1,150 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:43 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.085' - X-B3-Traceid: - - 2e5297c116f26110752a13767ed08317 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049643, - "jti" : "52PRN2EdpqkLoCJ/CEyh6beJ2d4=" - } - recorded_at: Mon, 19 Aug 2024 06:40:43 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:43 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.024' - X-B3-Traceid: - - da4b1b865b4142c6ab107d91109bd7af - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "categories" : [ { - "_id" : "8a4a8f6a-e3d9-4616-9e89-12c42c084534", - "name" : "DO-NOT-DELETE Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" - } - } - } ] - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories?page=0&size=20" - } - }, - "page" : { - "size" : 20, - "totalElements" : 1, - "totalPages" : 1, - "number" : 0 - } - } - recorded_at: Mon, 19 Aug 2024 06:40:43 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml deleted file mode 100644 index 9131453..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_create/creates_a_new_category.yml +++ /dev/null @@ -1,187 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:43 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.091' - X-B3-Traceid: - - 9c45eb30e4575f5f4fe5cc084546e684 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049643, - "jti" : "8dcnvbvxhvyHoBbeBAKfSw03gyc=" - } - recorded_at: Mon, 19 Aug 2024 06:40:43 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 06:40:43 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.033' - X-B3-Traceid: - - af3aeca695c94c32801e0c662b63ddb9 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "464df7fc-5801-4eda-8c38-22b6ffd2a823", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:43 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/464df7fc-5801-4eda-8c38-22b6ffd2a823 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 06:40:43 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.047' - X-B3-Traceid: - - 7eeb8ed8a7b09af81f8874d37bb821d0 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 06:40:43 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml deleted file mode 100644 index 22cb4c8..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_delete/deletes_a_category.yml +++ /dev/null @@ -1,247 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 08:23:00 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.095' - X-B3-Traceid: - - 55b33c0580da9f9255ff6ffdb6f8af47 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724055780, - "jti" : "bo9G/OG2JbjIQVLDljv+XfIwu/Q=" - } - recorded_at: Mon, 19 Aug 2024 08:23:00 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 08:23:00 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.051' - X-B3-Traceid: - - a91a846530581b514551ae5ee861fdc4 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "28171a9e-43d6-4786-9f1d-780152649363", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363" - } - } - } - recorded_at: Mon, 19 Aug 2024 08:23:00 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 08:23:00 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.039' - X-B3-Traceid: - - fac194a82965a2f8226f3faa67af0b34 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 08:23:00 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/28171a9e-43d6-4786-9f1d-780152649363 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 19 Aug 2024 08:23:00 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.013' - X-B3-Traceid: - - 6ba81a6b755682d168eecfa9c913f84e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "errorId" : "resource-not-found", - "details" : { }, - "message" : "No Category found for '28171a9e-43d6-4786-9f1d-780152649363'", - "traceId" : "6ba81a6b755682d168eecfa9c913f84e" - } - recorded_at: Mon, 19 Aug 2024 08:23:00 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml deleted file mode 100644 index 028cc62..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_destroy/deletes_a_category.yml +++ /dev/null @@ -1,247 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.112' - X-B3-Traceid: - - dc5d18864eaf21f13f53b1fc42fa463a - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049645, - "jti" : "HQfYmpl2Z0QRAzP1B3ryEq8CZ4U=" - } - recorded_at: Mon, 19 Aug 2024 06:40:45 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.029' - X-B3-Traceid: - - 36495f254777047ecfac8921032839d3 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "349a769f-a19b-401f-bc29-45228f4d115a", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:45 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.040' - X-B3-Traceid: - - fb465a06f039def22ea6a2148387eeb7 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 06:40:45 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/349a769f-a19b-401f-bc29-45228f4d115a - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.016' - X-B3-Traceid: - - 1e6bd69e50fa94a8dd2392ccdcd99aa6 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "errorId" : "resource-not-found", - "details" : { }, - "message" : "No Category found for '349a769f-a19b-401f-bc29-45228f4d115a'", - "traceId" : "1e6bd69e50fa94a8dd2392ccdcd99aa6" - } - recorded_at: Mon, 19 Aug 2024 06:40:45 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml deleted file mode 100644 index c727718..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_find/returns_a_category.yml +++ /dev/null @@ -1,256 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.149' - X-B3-Traceid: - - 19f41c49ed1a0b4821d56b1f2a5199d0 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049644, - "jti" : "YTMVOzRnfL3aopdXeSQQogD61VQ=" - } - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.025' - X-B3-Traceid: - - 872ce11570a2ae1a3862dad0b48fab19 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "380c8a2b-cff2-4789-9777-53a232f4d601", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.015' - X-B3-Traceid: - - e685a6f718f5fd74732f9fcdb9c80e2a - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "380c8a2b-cff2-4789-9777-53a232f4d601", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/380c8a2b-cff2-4789-9777-53a232f4d601 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.033' - X-B3-Traceid: - - '08eca00fb3f15ee4c11470044e64e130' - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml deleted file mode 100644 index 6833082..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Category/with_category/_update/updates_an_existing_category.yml +++ /dev/null @@ -1,256 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.139' - X-B3-Traceid: - - eb47a37565c0c4d86ddfbc23d37a76c5 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049644, - "jti" : "Vy9nkOpiuE7poFaOts96U5zc7QI=" - } - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/categories - body: - encoding: UTF-8 - string: '{"name":"Team42 Category","type":"SMART","defaultSort":"HIGHEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.034' - X-B3-Traceid: - - 1dc369d96881200e2c455f732c3c021c - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "5f37b352-8c12-414f-96cf-8152e4e23d4d", - "name" : "Team42 Category", - "type" : "SMART", - "defaultSort" : "HIGHEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -- request: - method: put - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d - body: - encoding: UTF-8 - string: '{"name":"Category with lowest price first","type":"SMART","defaultSort":"LOWEST_PRICE_FIRST"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:44 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.044' - X-B3-Traceid: - - 38668d975055f9f37ede46c518c54907 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "5f37b352-8c12-414f-96cf-8152e4e23d4d", - "name" : "Category with lowest price first", - "type" : "SMART", - "defaultSort" : "LOWEST_PRICE_FIRST", - "filters" : [ ], - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" - }, - "category" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/categories/5f37b352-8c12-414f-96cf-8152e4e23d4d - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.039' - X-B3-Traceid: - - 2dd71cfed1e43d8570f1ab33ffcdf086 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 06:40:44 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml deleted file mode 100644 index 969edad..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_all/returns_all_images.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.089' - X-B3-Traceid: - - 3f6f1d5807e8bf92dca5c2e04ae7048d - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049645, - "jti" : "zq3hO+6bHPoM3k4RR8FK0e/RkmQ=" - } - recorded_at: Mon, 19 Aug 2024 06:40:45 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:45 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.023' - X-B3-Traceid: - - e0ae07b6811b4d06362a57425a0a55b0 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "images" : [ ] - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images?page=0&size=20" - } - }, - "page" : { - "size" : 20, - "totalElements" : 0, - "totalPages" : 0, - "number" : 0 - } - } - recorded_at: Mon, 19 Aug 2024 06:40:45 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml deleted file mode 100644 index 87fb499..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/_all/returns_all_products.yml +++ /dev/null @@ -1,2948 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:46 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.146' - X-B3-Traceid: - - 0ec04a3cce6cafd10f5ab15b6102e7b8 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049646, - "jti" : "mu0JswmAtn8TgH3JWCQ9j902J4I=" - } - recorded_at: Mon, 19 Aug 2024 06:40:46 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/products - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:46 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.227' - X-B3-Traceid: - - af2a97f1e8074796ca4f5bd8c27aeb0e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "products" : [ { - "_id" : "4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc", - "lastModifiedAt" : "2024-08-18T21:43:42.669", - "sku" : "1000", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/additional-descriptions" - } - } - }, { - "_id" : "cb3463f8-90b1-4d0b-a071-d577e9686696", - "lastModifiedAt" : "2024-08-19T05:59:22.945", - "sku" : "1006", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/cb3463f8-90b1-4d0b-a071-d577e9686696/additional-descriptions" - } - } - }, { - "_id" : "6c1fba11-2983-4cff-bdd1-8d485fd4e836", - "lastModifiedAt" : "2024-08-19T05:59:23.355", - "sku" : "1007", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/6c1fba11-2983-4cff-bdd1-8d485fd4e836/additional-descriptions" - } - } - }, { - "_id" : "622de456-b829-4840-ae51-908c3c4c6e72", - "lastModifiedAt" : "2024-08-19T06:13:43.612", - "sku" : "1008", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/622de456-b829-4840-ae51-908c3c4c6e72/additional-descriptions" - } - } - }, { - "_id" : "78c2e576-a3a2-4180-badc-02e9a5dbec1c", - "lastModifiedAt" : "2024-08-19T06:13:44.056", - "sku" : "1009", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/78c2e576-a3a2-4180-badc-02e9a5dbec1c/additional-descriptions" - } - } - }, { - "_id" : "d0a33d33-f629-46a5-a7d6-dbdb22dbae39", - "lastModifiedAt" : "2024-08-19T06:29:52.033", - "sku" : "1010", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d0a33d33-f629-46a5-a7d6-dbdb22dbae39/additional-descriptions" - } - } - }, { - "_id" : "4d16857a-a353-4e88-9cc7-ba0b9cf05c2b", - "lastModifiedAt" : "2024-08-19T06:29:52.458", - "sku" : "1011", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4d16857a-a353-4e88-9cc7-ba0b9cf05c2b/additional-descriptions" - } - } - }, { - "_id" : "2d9923be-cc36-41f7-8585-795883ceecdc", - "lastModifiedAt" : "2024-08-19T06:30:37.637", - "sku" : "1012", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/2d9923be-cc36-41f7-8585-795883ceecdc/additional-descriptions" - } - } - }, { - "_id" : "935f97ed-c875-4f24-9f6b-cdb6f09cbddd", - "lastModifiedAt" : "2024-08-19T06:30:38.101", - "sku" : "1013", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/935f97ed-c875-4f24-9f6b-cdb6f09cbddd/additional-descriptions" - } - } - }, { - "_id" : "7b16492b-8a5b-4597-8e9d-cd9fcd52af0c", - "lastModifiedAt" : "2024-08-19T06:31:58.649", - "sku" : "1014", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/7b16492b-8a5b-4597-8e9d-cd9fcd52af0c/additional-descriptions" - } - } - }, { - "_id" : "575da236-82ff-4e5c-84f9-a5514ef05b23", - "lastModifiedAt" : "2024-08-19T06:31:59.05", - "sku" : "1015", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/575da236-82ff-4e5c-84f9-a5514ef05b23/additional-descriptions" - } - } - }, { - "_id" : "26221231-953b-4a1c-9025-7c72e610facd", - "lastModifiedAt" : "2024-08-19T06:35:23.365", - "sku" : "1016", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/26221231-953b-4a1c-9025-7c72e610facd/additional-descriptions" - } - } - }, { - "_id" : "0b47984d-5322-4d11-9022-41137bd9ddc2", - "lastModifiedAt" : "2024-08-19T06:35:23.857", - "sku" : "1017", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0b47984d-5322-4d11-9022-41137bd9ddc2/additional-descriptions" - } - } - }, { - "_id" : "d4aa7727-aaa5-43d4-80f4-0f51bc8a688e", - "lastModifiedAt" : "2024-08-19T06:35:43.277", - "sku" : "1018", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/d4aa7727-aaa5-43d4-80f4-0f51bc8a688e/additional-descriptions" - } - } - }, { - "_id" : "b9bf2184-ae5b-4b06-be1a-f4d1140496e3", - "lastModifiedAt" : "2024-08-19T06:35:43.694", - "sku" : "1019", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/b9bf2184-ae5b-4b06-be1a-f4d1140496e3/additional-descriptions" - } - } - }, { - "_id" : "bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a", - "lastModifiedAt" : "2024-08-19T06:36:45.318", - "sku" : "1020", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/bf9665f8-0f16-449f-a6b3-4e6c4e44eb8a/additional-descriptions" - } - } - }, { - "_id" : "21cb741d-eb0c-4722-8622-a8b555d1fd03", - "lastModifiedAt" : "2024-08-19T06:36:45.749", - "sku" : "1021", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/21cb741d-eb0c-4722-8622-a8b555d1fd03/additional-descriptions" - } - } - }, { - "_id" : "687ac2a5-91a9-4d7e-917d-614fabcbc023", - "lastModifiedAt" : "2024-08-19T06:37:32.536", - "sku" : "1022", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/687ac2a5-91a9-4d7e-917d-614fabcbc023/additional-descriptions" - } - } - }, { - "_id" : "4312d633-0d56-4157-8b33-b587550cca1f", - "lastModifiedAt" : "2024-08-19T06:37:32.972", - "sku" : "1023", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4312d633-0d56-4157-8b33-b587550cca1f/additional-descriptions" - } - } - }, { - "_id" : "88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d", - "lastModifiedAt" : "2024-08-19T06:38:04.141", - "sku" : "1024", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/88fd3c94-bdfe-48a1-bfe7-801ff40d9e0d/additional-descriptions" - } - } - } ] - }, - "_links" : { - "first" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" - }, - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=0&size=20" - }, - "next" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=1&size=20" - }, - "last" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products?page=1&size=20" - }, - "search" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/search" - } - }, - "page" : { - "size" : 20, - "totalElements" : 21, - "totalPages" : 2, - "number" : 0 - } - } - recorded_at: Mon, 19 Aug 2024 06:40:46 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml deleted file mode 100644 index 88ae9c2..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_create/creates_a_new_product.yml +++ /dev/null @@ -1,265 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:46 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.156' - X-B3-Traceid: - - 226eb06e8a88b8ba020d84ad6821fed5 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049646, - "jti" : "ToaY1QbhYVnXdKVtbo9/zHGP1pY=" - } - recorded_at: Mon, 19 Aug 2024 06:40:46 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/products - body: - encoding: UTF-8 - string: '{"name":"Team42 Product","description":"Spain\nRioja Tempranillo","manufacturer":"Grape - Vineyard","essentialFeatures":"Dry. 12% alcohol. Best vine variety.","tags":["Bestseller","Red - Wine","Sale"],"productIdentifiers":[{"type":"EAN","value":"9780134308135"}],"salesPrice":{"taxModel":"GROSS","amount":8.7,"currency":"GBP"},"listPrice":{"taxModel":"GROSS","amount":10.95,"currency":"GBP"},"manufacturerPrice":{"taxModel":"GROSS","amount":11.95,"currency":"GBP"},"visible":true,"taxClass":"REGULAR","shippingWeight":{"value":1175.0,"displayUnit":"GRAMS"},"maxOrderQuantity":6,"shippingDimension":{"length":1500,"width":1000,"height":2000},"refPrice":{"refQuantity":1,"unit":"LITER","quantity":0.75,"price":{"taxModel":"GROSS","amount":11.6,"currency":"GBP"}},"shippingPeriod":{"min":2,"max":4,"displayUnit":"WEEKS"},"pickupPeriod":{"min":1,"max":2,"displayUnit":"WEEKS"},"productLabels":[{"type":"NEW","activeFrom":"2024-08-13T11:31:30.210787732","activeUntil":"2024-09-10T11:31:30.210787732"}]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 06:40:47 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.145' - X-B3-Traceid: - - 29b58716c856411ff91c828f90cfecd2 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "0c3d27de-5b4d-4432-bf7b-caf7ff289d93", - "lastModifiedAt" : "2024-08-19T06:40:47.012323725", - "sku" : "1026", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833333333333333333333, - "taxRate" : 0.2 - } - }, - "tags" : [ "Bestseller", "Red Wine", "Sale" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.210787732", - "activeUntil" : "2024-09-10T11:31:30.210787732" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/0c3d27de-5b4d-4432-bf7b-caf7ff289d93/additional-descriptions" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:46 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml deleted file mode 100644 index 111c0d4..0000000 --- a/spec/vcr_cassettes/BeyondApi_ProductManagement_Product/with_product/_find/returns_a_product.yml +++ /dev/null @@ -1,460 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:47 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.087' - X-B3-Traceid: - - f7e13b884aa50e1d56de1244c68d8652 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724049647, - "jti" : "Bm+dFIVaS5YT9k2JXpxVf0D0haE=" - } - recorded_at: Mon, 19 Aug 2024 06:40:47 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/products - body: - encoding: UTF-8 - string: '{"name":"Team42 Product","description":"Spain\nRioja Tempranillo","manufacturer":"Grape - Vineyard","essentialFeatures":"Dry. 12% alcohol. Best vine variety.","tags":["Bestseller","Red - Wine","Sale"],"productIdentifiers":[{"type":"EAN","value":"9780134308135"}],"salesPrice":{"taxModel":"GROSS","amount":8.7,"currency":"GBP"},"listPrice":{"taxModel":"GROSS","amount":10.95,"currency":"GBP"},"manufacturerPrice":{"taxModel":"GROSS","amount":11.95,"currency":"GBP"},"visible":true,"taxClass":"REGULAR","shippingWeight":{"value":1175.0,"displayUnit":"GRAMS"},"maxOrderQuantity":6,"shippingDimension":{"length":1500,"width":1000,"height":2000},"refPrice":{"refQuantity":1,"unit":"LITER","quantity":0.75,"price":{"taxModel":"GROSS","amount":11.6,"currency":"GBP"}},"shippingPeriod":{"min":2,"max":4,"displayUnit":"WEEKS"},"pickupPeriod":{"min":1,"max":2,"displayUnit":"WEEKS"},"productLabels":[{"type":"NEW","activeFrom":"2024-08-13T11:31:30.210787732","activeUntil":"2024-09-10T11:31:30.210787732"}]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 06:40:47 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.129' - X-B3-Traceid: - - 5148ada46a37287265e528a0d4a794bc - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "532065c3-5d71-44a6-8b8d-764c798f3b95", - "lastModifiedAt" : "2024-08-19T06:40:47.429253718", - "sku" : "1027", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833333333333333333333, - "taxRate" : 0.2 - } - }, - "tags" : [ "Bestseller", "Red Wine", "Sale" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.210787732", - "activeUntil" : "2024-09-10T11:31:30.210787732" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/additional-descriptions" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:47 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 06:40:47 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.035' - X-B3-Traceid: - - 7a1e8f0003d347ff5d78ddadbf098880 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "532065c3-5d71-44a6-8b8d-764c798f3b95", - "lastModifiedAt" : "2024-08-19T06:40:47.429", - "sku" : "1027", - "salesPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 8.7, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 7.25, - "taxRate" : 0.2 - } - }, - "listPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 10.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.125, - "taxRate" : 0.2 - } - }, - "manufacturerPrice" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.95, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.95833, - "taxRate" : 0.2 - } - }, - "tags" : [ "Sale", "Bestseller", "Red Wine" ], - "productIdentifiers" : [ { - "type" : "EAN", - "value" : "9780134308135" - } ], - "visible" : true, - "taxClass" : "REGULAR", - "shippingWeight" : { - "value" : 1175.0, - "displayUnit" : "GRAMS" - }, - "maxOrderQuantity" : 6, - "shippingDimension" : { - "length" : 1500, - "width" : 1000, - "height" : 2000 - }, - "refPrice" : { - "refQuantity" : 1, - "unit" : "LITER", - "quantity" : 0.75, - "price" : { - "taxModel" : "GROSS", - "currency" : "GBP", - "amount" : 11.6, - "derivedPrice" : { - "taxModel" : "NET", - "currency" : "GBP", - "amount" : 9.6667, - "taxRate" : 0.2 - } - } - }, - "shippingPeriod" : { - "min" : 2, - "max" : 4, - "displayUnit" : "WEEKS" - }, - "pickupPeriod" : { - "min" : 1, - "max" : 2, - "displayUnit" : "WEEKS" - }, - "name" : "Team42 Product", - "description" : "Spain\nRioja Tempranillo", - "manufacturer" : "Grape Vineyard", - "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.", - "variationAttributes" : [ ], - "customText" : null, - "productLabels" : [ { - "type" : "NEW", - "activeFrom" : "2024-08-13T11:31:30.211", - "activeUntil" : "2024-09-10T11:31:30.211" - } ], - "isVariationProduct" : false, - "_embedded" : { - "availability" : { - "availabilityState" : "IN_STOCK", - "availableStock" : null, - "stockThreshold" : null, - "purchasable" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" - } - } - } - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95" - }, - "availability" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/availability" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attributes" - }, - "attachments" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/attachments" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/images" - }, - "default-image" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/default-image" - }, - "videos" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/videos" - }, - "cross-sells" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/cross-sells" - }, - "multiple-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/multiple-images" - }, - "external-images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/external-images" - }, - "additional-descriptions" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/532065c3-5d71-44a6-8b8d-764c798f3b95/additional-descriptions" - } - } - } - recorded_at: Mon, 19 Aug 2024 06:40:47 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml b/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml deleted file mode 100644 index b672485..0000000 --- a/spec/vcr_cassettes/BeyondApi_Shop_Address/_get/returns_the_shop_address.yml +++ /dev/null @@ -1,146 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:29:59 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.089' - X-B3-Traceid: - - da5289c9d5b4a4f03418f74baa9563e1 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724052599, - "jti" : "+3Bi9GKMlZei8yQdrBRl8otJG9o=" - } - recorded_at: Mon, 19 Aug 2024 07:29:58 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/shop/address - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:29:59 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.139' - X-B3-Traceid: - - 6c81891217360b02b1c94ad8e223efa4 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "company" : "Team42", - "firstName" : "Team42", - "lastName" : "Team42", - "email" : "k.salazar@epages.com", - "phone" : "Team42", - "fax" : null, - "street" : "Team42", - "street2" : null, - "postalCode" : "12345", - "dependentLocality" : null, - "city" : "Somewhere", - "state" : "", - "country" : "GB", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" - }, - "address" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" - }, - "owner" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:29:59 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml b/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml deleted file mode 100644 index 3a71722..0000000 --- a/spec/vcr_cassettes/BeyondApi_Shop_Shop/_get/returns_the_shop_details.yml +++ /dev/null @@ -1,160 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:36:16 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.171' - X-B3-Traceid: - - 5d0474f38fa3cd44d8d2db510cc40b8a - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724052976, - "jti" : "fP5GZ4flKaRAKWsK77zoPkasf58=" - } - recorded_at: Mon, 19 Aug 2024 07:36:16 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/shop - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:36:17 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.026' - X-B3-Traceid: - - 2ae749c42757058dbaa58127e4426c42 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "5227687a-aa6b-487c-9c2b-afccf1573cea", - "name" : "Team42 Beyond API", - "resellerName" : "epages", - "primaryHostname" : "team42-beyond-api.beyondshop.cloud", - "fallbackHostname" : "team42-beyond-api.beyondshop.cloud", - "tax" : { - "taxModel" : "GROSS", - "vatExempted" : false, - "country" : "GB", - "supportedTaxClasses" : [ "EXEMPT", "REDUCED", "REGULAR" ] - }, - "currencies" : [ "GBP" ], - "defaultCurrency" : "GBP", - "locales" : [ "en-GB" ], - "defaultLocale" : "en-GB", - "closedByMerchant" : true, - "emailConfirmed" : true, - "socialSharingEnabled" : true, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" - }, - "shop" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" - }, - "address" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/address" - }, - "images" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images" - }, - "legal" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/legal" - }, - "attributes" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:36:16 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml deleted file mode 100644 index ef99947..0000000 --- a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/_all/returns_all_script_tags.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:16:55 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.088' - X-B3-Traceid: - - d8bb94fce645e11df41f02cdf798c48c - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724051815, - "jti" : "tZ1d2LY1w2EHdOp6Fio2ID2v6sU=" - } - recorded_at: Mon, 19 Aug 2024 07:16:55 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:16:55 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.019' - X-B3-Traceid: - - 4bb5130872df2dc70bef5c5eabcb7790 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "script-tags" : [ ] - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags?page=0&size=20" - } - }, - "page" : { - "size" : 20, - "totalElements" : 0, - "totalPages" : 0, - "number" : 0 - } - } - recorded_at: Mon, 19 Aug 2024 07:16:55 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml deleted file mode 100644 index 0adb11d..0000000 --- a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_create/creates_a_new_category.yml +++ /dev/null @@ -1,182 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:16:55 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.084' - X-B3-Traceid: - - 0c97be1daa45232d28dd92b0f670a097 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724051815, - "jti" : "oSMzgxORYBuMaGTwU6WxFQhB3PI=" - } - recorded_at: Mon, 19 Aug 2024 07:16:55 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags - body: - encoding: UTF-8 - string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 07:16:55 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.074' - X-B3-Traceid: - - ca7443df2ac52d190d47ea8d7df1ffb4 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "3bda8799-ed96-4f27-836a-4fb034e43a48", - "categories" : [ ], - "scriptUrl" : "https://example.com/scripts/exampleScript.js", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:16:55 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/3bda8799-ed96-4f27-836a-4fb034e43a48 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.026' - X-B3-Traceid: - - d943e40a62bcba3951b1f008012de45d - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:16:55 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml deleted file mode 100644 index 634ca55..0000000 --- a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_delete/deletes_a_script_tag.yml +++ /dev/null @@ -1,242 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 08:23:01 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.097' - X-B3-Traceid: - - 2cd075d0bf0e39ff6109d213e139fb9e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724055781, - "jti" : "C6UJPHY9f5Dc8FU43LVeiN2zoWw=" - } - recorded_at: Mon, 19 Aug 2024 08:23:01 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags - body: - encoding: UTF-8 - string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 08:23:01 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.096' - X-B3-Traceid: - - d1f65daa2ab4973f56910dfe9abd53c6 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "861516c1-32ce-4dfe-8bb7-f36d30194eed", - "categories" : [ ], - "scriptUrl" : "https://example.com/scripts/exampleScript.js", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed" - } - } - } - recorded_at: Mon, 19 Aug 2024 08:23:01 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 08:23:01 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.049' - X-B3-Traceid: - - a28101666148e32f48b4e2d4a98f4e39 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 08:23:01 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/861516c1-32ce-4dfe-8bb7-f36d30194eed - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 19 Aug 2024 08:23:01 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.023' - X-B3-Traceid: - - 4da97a350edaea722e1135e1570c732d - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "errorId" : "script-tag.not-found", - "details" : { }, - "message" : "script-tag with id 861516c1-32ce-4dfe-8bb7-f36d30194eed could not be found", - "traceId" : "4da97a350edaea722e1135e1570c732d" - } - recorded_at: Mon, 19 Aug 2024 08:23:01 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml deleted file mode 100644 index a4e4441..0000000 --- a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_destroy/deletes_a_script_tag.yml +++ /dev/null @@ -1,242 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.089' - X-B3-Traceid: - - a593d0cdd236de07616aef78bf6a6655 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724051816, - "jti" : "FU5e5c1fVeoVADYx6gMOUbbaE9g=" - } - recorded_at: Mon, 19 Aug 2024 07:16:56 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags - body: - encoding: UTF-8 - string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.037' - X-B3-Traceid: - - 4b85311b0c4bc77c83cbd4b03eaf43cc - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "c84ded08-d594-4124-a868-cf660c507e10", - "categories" : [ ], - "scriptUrl" : "https://example.com/scripts/exampleScript.js", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:16:56 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.049' - X-B3-Traceid: - - 7d438309bcb3899f073002e6bcaec3d9 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:16:56 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/c84ded08-d594-4124-a868-cf660c507e10 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 19 Aug 2024 07:16:57 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.027' - X-B3-Traceid: - - a3989af594a1f550cdfc565446fe21b9 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "errorId" : "script-tag.not-found", - "details" : { }, - "message" : "script-tag with id c84ded08-d594-4124-a868-cf660c507e10 could not be found", - "traceId" : "a3989af594a1f550cdfc565446fe21b9" - } - recorded_at: Mon, 19 Aug 2024 07:16:57 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml b/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml deleted file mode 100644 index 60b4c61..0000000 --- a/spec/vcr_cassettes/BeyondApi_Storefront_ScriptTag/with_script_tag/_find/returns_a_script_tag.yml +++ /dev/null @@ -1,182 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.090' - X-B3-Traceid: - - 69f92027deeb0baa1b3cc91a4fc2b0a9 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724051816, - "jti" : "fibGyoBMMp+/jt/tl0DI6Y3psV8=" - } - recorded_at: Mon, 19 Aug 2024 07:16:56 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags - body: - encoding: UTF-8 - string: '{"scriptUrl":"https://example.com/scripts/exampleScript.js"}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.030' - X-B3-Traceid: - - d76f1dd31353f4c98c74c418a4fe7fc5 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_id" : "2d427037-5968-46e6-b32a-a59f189ebfb2", - "categories" : [ ], - "scriptUrl" : "https://example.com/scripts/exampleScript.js", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:16:56 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/script-tags/2d427037-5968-46e6-b32a-a59f189ebfb2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 07:16:56 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.057' - X-B3-Traceid: - - 26a4d23f761f124c1408ca0ea977412a - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:16:56 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml deleted file mode 100644 index 394f975..0000000 --- a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/_all/returns_all_webhook_subscriptions.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:25:12 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.111' - X-B3-Traceid: - - e0b99fb5d7ea3fa4fee24a224568d657 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724052312, - "jti" : "CtoBgVKfRCv3wpVQ9i1Wt0WOr3U=" - } - recorded_at: Mon, 19 Aug 2024 07:25:12 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:25:12 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.054' - X-B3-Traceid: - - 4671d01950bc1fa1eb36536e344c3231 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "_embedded" : { - "subscriptions" : [ ] - }, - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions" - } - }, - "page" : { - "size" : 20, - "totalElements" : 0, - "totalPages" : 0, - "number" : 0 - } - } - recorded_at: Mon, 19 Aug 2024 07:25:12 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml deleted file mode 100644 index f004bef..0000000 --- a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_create/creates_a_new_webhook_subscription.yml +++ /dev/null @@ -1,186 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:25:12 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.096' - X-B3-Traceid: - - 29853db6da84b038e366c4c73a92e840 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724052312, - "jti" : "dEZQvxoGOAVa9WMsx8d3qhjUrcI=" - } - recorded_at: Mon, 19 Aug 2024 07:25:12 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions - body: - encoding: UTF-8 - string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 07:25:12 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.055' - X-B3-Traceid: - - a543aff3022f92da255ecbc32ba6f474 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "callbackUri" : "http://example.com/test", - "eventTypes" : [ "order.created", "product.created" ], - "active" : true, - "_id" : "2a3707d0-3cc1-462a-84c2-176c5e1cf689", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689" - }, - "deactivate" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689/deactivate" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:25:12 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/2a3707d0-3cc1-462a-84c2-176c5e1cf689 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.038' - X-B3-Traceid: - - fd40a1d4fc79789287c66b0ad0cc1fa2 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml deleted file mode 100644 index 53cbeb6..0000000 --- a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete/deletes_a_webhook_subscription.yml +++ /dev/null @@ -1,238 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 08:23:02 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.160' - X-B3-Traceid: - - 661b0474ff0beed08492404ba4b3246e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724055782, - "jti" : "etTNATIXyAYxSmeXKD6CSUrTCNs=" - } - recorded_at: Mon, 19 Aug 2024 08:23:02 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions - body: - encoding: UTF-8 - string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 08:23:02 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.054' - X-B3-Traceid: - - db202fddc69411adc9750a7a93eb1f36 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "callbackUri" : "http://example.com/test", - "eventTypes" : [ "product.created", "order.created" ], - "active" : true, - "_id" : "ba3d5330-ed1d-440d-abce-7ad54c3f0d08", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08" - }, - "deactivate" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08/deactivate" - } - } - } - recorded_at: Mon, 19 Aug 2024 08:23:02 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 08:23:02 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.044' - X-B3-Traceid: - - d0c2be1d708e5ef0cd3eb8dadf70b2c1 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 08:23:02 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/ba3d5330-ed1d-440d-abce-7ad54c3f0d08 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 19 Aug 2024 08:23:02 GMT - Content-Length: - - '0' - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.019' - X-B3-Traceid: - - 455eabf287b14c709350c96903b48836 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 08:23:02 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml deleted file mode 100644 index a76d87f..0000000 --- a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_destroy/deletes_a_webhook_subscription.yml +++ /dev/null @@ -1,238 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.101' - X-B3-Traceid: - - 4db8dbee6bd5eb98accdbc08e7882f9a - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724052313, - "jti" : "2ArIrBGdwUsrtgORQ3UHj53FcCk=" - } - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions - body: - encoding: UTF-8 - string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.039' - X-B3-Traceid: - - a378220db8b2d3339b2fa689ffc28cc8 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "callbackUri" : "http://example.com/test", - "eventTypes" : [ "order.created", "product.created" ], - "active" : true, - "_id" : "a6cbd477-e250-4aaf-85cc-5dc899573a6c", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c" - }, - "deactivate" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c/deactivate" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 07:25:14 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.035' - X-B3-Traceid: - - f42e017c7d27b95cff64de4d173ad537 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:25:14 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/a6cbd477-e250-4aaf-85cc-5dc899573a6c - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 19 Aug 2024 07:25:14 GMT - Content-Length: - - '0' - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.017' - X-B3-Traceid: - - e017a73d6b541d39e90ca41bf4fbca6c - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:25:14 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml deleted file mode 100644 index 67948af..0000000 --- a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_find/returns_a_webhook_subscription.yml +++ /dev/null @@ -1,254 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Basic - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Content-Type: - - application/json;charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cache-Control: - - no-store - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 ; includeSubDomains - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.084' - X-B3-Traceid: - - c962e7ebc9678a42f7470be9c81b683b - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "access_token" : "", - "token_type" : "bearer", - "expires_in" : 3599, - "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", - "tenantId" : 8542, - "iat" : 1724052313, - "jti" : "puBdyxl6qlmDmf+P8r/jL4V1F8c=" - } - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -- request: - method: post - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions - body: - encoding: UTF-8 - string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Location: - - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.033' - X-B3-Traceid: - - f87514392ebcf7dec97dd79d461f0a0e - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "callbackUri" : "http://example.com/test", - "eventTypes" : [ "order.created", "product.created" ], - "active" : true, - "_id" : "50873c4d-97da-4cbb-b221-1b6da35dd1fd", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd" - }, - "deactivate" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd/deactivate" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -- request: - method: get - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.022' - X-B3-Traceid: - - d8a9409cf4a1a9da9ff09fc8669e2bc4 - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: |- - { - "callbackUri" : "http://example.com/test", - "eventTypes" : [ "order.created", "product.created" ], - "active" : true, - "_id" : "50873c4d-97da-4cbb-b221-1b6da35dd1fd", - "_links" : { - "self" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd" - }, - "deactivate" : { - "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd/deactivate" - } - } - } - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -- request: - method: delete - uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/50873c4d-97da-4cbb-b221-1b6da35dd1fd - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Faraday v2.10.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 204 - message: No Content - headers: - Date: - - Mon, 19 Aug 2024 07:25:13 GMT - Connection: - - keep-alive - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate - Pragma: - - no-cache - Expires: - - '0' - X-Frame-Options: - - DENY - Server: - - epages-beyond - X-Request-Time: - - '0.031' - X-B3-Traceid: - - bcf9b63acbf3b35ea7c6e4e7c89d2b8c - X-Hello-Human: - - Come work with us! https://developer.epages.com/devjobs/ - body: - encoding: UTF-8 - string: '' - recorded_at: Mon, 19 Aug 2024 07:25:13 GMT -recorded_with: VCR 6.2.0 From 6a133eb05010f0afab6f3965729bd23d0d58d439 Mon Sep 17 00:00:00 2001 From: citin Date: Wed, 21 Aug 2024 09:19:32 +0200 Subject: [PATCH 48/59] update docs, fix some errors --- .env.template => .env.development.template | 1 - .env.test.template | 4 + .gitignore | 3 +- GETTING_STARTED.md | 238 ++++----------------- README.md | 53 ++++- bin/console | 12 +- lib/beyond_api/concerns/connection.rb | 2 +- lib/beyond_api/error.rb | 2 - lib/beyond_api/faraday_error.rb | 5 + 9 files changed, 96 insertions(+), 224 deletions(-) rename .env.template => .env.development.template (71%) create mode 100644 .env.test.template create mode 100644 lib/beyond_api/faraday_error.rb diff --git a/.env.template b/.env.development.template similarity index 71% rename from .env.template rename to .env.development.template index 99050d8..8ac203f 100644 --- a/.env.template +++ b/.env.development.template @@ -1,3 +1,2 @@ CLIENT_ID="" CLIENT_SECRET="" -SHOP_URL="" diff --git a/.env.test.template b/.env.test.template new file mode 100644 index 0000000..d7e1ed4 --- /dev/null +++ b/.env.test.template @@ -0,0 +1,4 @@ +API_URL="" +CLIENT_ID="" +CLIENT_SECRET="" +REFRESH_TOKEN="" diff --git a/.gitignore b/.gitignore index 9a8a687..f1cfd78 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,8 @@ .rspec_status # Environment variables -.env +.env* +!.env.*.template # Apple file system .DS_Store diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 1d252a2..95a5c44 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -1,220 +1,54 @@ # Getting started -## Authenticating a shop (the session object) +This guide will help you quickly get started with the Beyond API Ruby Client by demonstrating how to obtain and use access tokens. -### Obtaining a token from an authentication code +### Obtaining an Authentication Token ```ruby -session = BeyondApi::Session.new(api_url: "https://your-shop-name.beyondshop.cloud/api") -session.token.create("your-auth-code") +require 'beyond_api' + +api_url = '/api' + +# Initialize the client for authentication +client = BeyondApi::Authentication::Token.new(api_url:) + +# Replace 'your-auth-code' with the actual code you obtained +token = client.get("your-auth-code") + +access_token = token[:access_token] +refresh_token = token[:refresh_token] ``` > You can get an authentication code by clicking the **Test authorization** button in your test shop's cockpit on your custom app's page. Clicking the button will redirect you to the **Application Callback URL** you have specified, attaching the code as a query parameter. -### Obtaining a token from a refresh token +### Refreshing an Access Token ```ruby -session = BeyondApi::Session.new(api_url: "https://your-shop-name.beyondshop.cloud/api", - refresh_token: "your-refresh-token") -session.token.refresh +# Initialize the client for authentication +client = BeyondApi::Authentication::Token.new(api_url: api_url) + +# Use the refresh token to get a new access token +new_token = client.refresh(refresh_token) + +new_access_token = new_token[:access_token] +new_refresh_token = new_token[:refresh_token] ``` ## Consuming the API Check the [_rubydoc_ documentation](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client) for more information on the Beyond API Ruby Client. -Here you can find a list with all available methods: - -* Carts - * [`session.carts.add_line_item(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#add_line_item-instance_method) - * [`session.carts.create`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#create-instance_method) - * [`session.carts.create_order(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#create_order-instance_method) - * [`session.carts.create_payment(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#create_payment-instance_method) - * [`session.carts.create_payment_and_order(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#create_payment_and_order-instance_method) - * [`session.carts.delete(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#delete-instance_method) - * [`session.carts.delete_line_item(cart_id, line_item_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#delete_line_item-instance_method) - * [`session.carts.delete_shipping_address(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#delete_shipping_address-instance_method) - * [`session.carts.find(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#find-instance_method) - * [`session.carts.payment_method(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#payment_method-instance_method) - * [`session.carts.payment_methods(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#payment_methods-instance_method) - * [`session.carts.replace_line_item(cart_id, line_item_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#replace_line_item-instance_method) - * [`session.carts.replace_line_items(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#replace_line_items-instance_method) - * [`session.carts.set_billing_address(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#set_billing_address-instance_method) - * [`session.carts.set_payment_method(cart_id, payment_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#set_payment_method-instance_method) - * [`session.carts.set_payment_method_to_default(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#set_payment_method_to_default-instance_method) - * [`session.carts.set_shipping_address(cart_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#set_shipping_address-instance_method) - * [`session.carts.set_shipping_method(cart_id, shipping_zone_id, shipping_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#set_shipping_method-instance_method) - * [`session.carts.set_shipping_method_to_default(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#set_shipping_method_to_default-instance_method) - * [`session.carts.shipping_method(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#shipping_method-instance_method) - * [`session.carts.shipping_methods(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Carts#shipping_methods-instance_method) -* Categories view - * [`session.categories_view.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CategoriesView#all-instance_method) - * [`session.categories_view.find(category_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CategoriesView#find-instance_method) - * [`session.categories_view.products(category_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CategoriesView#products-instance_method) - * [`session.categories_view.search_by_label(label)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CategoriesView#search_by_label-instance_method) - * [`session.categories_view.search_by_product(body, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CategoriesView#search_by_product-instance_method) - * [`session.categories_view.search_by_product_id(product_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CategoriesView#search_by_product_id-instance_method) -* Categories - * [`session.categories.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Categories#all-instance_method) - * [`session.categories.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Categories#create-instance_method) - * [`session.categories.delete(category_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Categories#delete-instance_method) - * [`session.categories.find(category_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Categories#find-instance_method) - * [`session.categories.patch(category_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Categories#patch-instance_method) - * [`session.categories.update(category_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Categories#update-instance_method) -* Checkout settings - * [`session.checkout_settings.all`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CheckoutSettings#all-instance_method) - * [`session.checkout_settings.update(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/CheckoutSettings#update-instance_method) -* Token - * [`session.token.client_credentials`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Token#client_credentials-instance_method) - * [`session.token.create(code)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Token#create-instance_method) - * [`session.token.refresh`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Token#refresh-instance_method) - * [`session.token.session`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Token#session-instance_method) -* Customers - * [`session.customers.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Customers#all-instance_method) - * [`session.customers.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Customers#create-instance_method) - * [`session.customers.delete(customer_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Customers#delete-instance_method) - * [`session.customers.find(customer_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Customers#find-instance_method) - * [`session.customers.update(customer_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Customers#update-instance_method) -* Newsletter target - * [`session.newsletter_target.create(submit_url)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/NewsletterTarget#create-instance_method) - * [`session.newsletter_target.delete`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/NewsletterTarget#delete-instance_method) - * [`session.newsletter_target.find`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/NewsletterTarget#find-instance_method) - * [`session.newsletter_target.update(submit_url)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/NewsletterTarget#update-instance_method) -* Order settings - * [`session.order_settings.all`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/OrderSettings#all-instance_method) - * [`session.order_settings.update(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/OrderSettings#update-instance_method) -* Orders - * [`session.orders.active_payment_process(order_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#active_payment_process-instance_method) - * [`session.orders.active_refund_process(order_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#active_refund_process-instance_method) - * [`session.orders.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#all-instance_method) - * [`session.orders.cancel(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#cancel-instance_method) - * [`session.orders.cancelation_process(order_id, cancelation_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#cancelation_process-instance_method) - * [`session.orders.cancelation_processes(order_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#cancelation_processes-instance_method) - * [`session.orders.capture_payment_process(order_id, payment_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#capture_payment_process-instance_method) - * [`session.orders.create_cancelation_process(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#create_cancelation_process-instance_method) - * [`session.orders.create_invoice(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#create_invoice-instance_method) - * [`session.orders.create_return_process(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#create_return_process-instance_method) - * [`session.orders.create_shipping_process(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#create_shipping_process-instance_method) - * [`session.orders.events(order_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#events-instance_method) - * [`session.orders.find(order_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#find-instance_method) - * [`session.orders.mark_payment_process_as_paid(order_id, payment_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#mark_payment_process_as_paid-instance_method) - * [`session.orders.mark_payment_process_as_voided(order_id, payment_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#mark_payment_process_as_voided-instance_method) - * [`session.orders.mark_refund_process_as_paid(order_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#mark_refund_process_as_paid-instance_method) - * [`session.orders.mark_shipping_process_as_delivered(order_id, shipping_process_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#mark_shipping_process_as_delivered-instance_method) - * [`session.orders.mark_shipping_process_as_shipped(order_id, shipping_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#mark_shipping_process_as_shipped-instance_method) - * [`session.orders.payment_process(order_id, payment_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#payment_process-instance_method) - * [`session.orders.payment_processes(order_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#payment_processes-instance_method) - * [`session.orders.processes(order_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#processes-instance_method) - * [`session.orders.refund_process(order_id, refund_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#refund_process-instance_method) - * [`session.orders.refund_processes(order_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#refund_processes-instance_method) - * [`session.orders.return_process(order_id, return_process_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#return_process-instance_method) - * [`session.orders.return_processes(order_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#return_processes-instance_method) - * [`session.orders.search_by_cart_id(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#search_by_cart_id-instance_method) - * [`session.orders.search_order_number_by_cart_id(cart_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#search_order_number_by_cart_id-instance_method) - * [`session.orders.send_order_document(order_id, order_document_uri)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#send_order_document-instance_method) - * [`session.orders.shipping_process(order_id, shipping_process_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#shipping_process-instance_method) - * [`session.orders.shipping_processes(order_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#shipping_processes-instance_method) - * [`session.orders.update_billing_address(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#update_billing_address-instance_method) - * [`session.orders.update_order_note(order_id, order_note)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#update_order_note-instance_method) - * [`session.orders.update_shipping_address(order_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Orders#update_shipping_address-instance_method) -* Payment methods - * [`session.payment_methods.activate(payment_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/PaymentMethods#activate-instance_method) - * [`session.payment_methods.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/PaymentMethods#all-instance_method) - * [`session.payment_methods.deactivate(payment_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/PaymentMethods#deactivate-instance_method) - * [`session.payment_methods.find(payment_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/PaymentMethods#find-instance_method) - * [`session.payment_methods.sort(payment_method_ids)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/PaymentMethods#sort-instance_method) - * [`session.payment_methods.update(payment_method_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/PaymentMethods#update-instance_method) -* Product attribute definitions - * [`session.product_attribute_definitions.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductAttributeDefinitions#all-instance_method) - * [`session.product_attribute_definitions.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductAttributeDefinitions#create-instance_method) - * [`session.product_attribute_definitions.delete(product_attribute_name)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductAttributeDefinitions#delete-instance_method) - * [`session.product_attribute_definitions.find(product_attribute_name)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductAttributeDefinitions#find-instance_method) -* Products view - * [`session.products_view.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductsView#all-instance_method) - * [`session.products_view.available_tags`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductsView#available_tags-instance_method) - * [`session.products_view.find(product_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductsView#find-instance_method) - * [`session.products_view.search_by_tag(tag, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductsView#search_by_tag-instance_method) - * [`session.products_view.search_by_term(term, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ProductsView#search_by_term-instance_method) -* Products - * [`session.products.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#all-instance_method) - * [`session.products.assign_variation_images_differentiator(product_id, differentiator)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#assign_variation_images_differentiator-instance_method) - * [`session.products.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#create-instance_method) - * [`session.products.create_variation(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#create_variation-instance_method) - * [`session.products.delete(product_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#delete-instance_method) - * [`session.products.find(product_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#find-instance_method) - * [`session.products.find_variation(product_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#find_variation-instance_method) - * [`session.products.update(product_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#update-instance_method) - * [`session.products.update_variation(product_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Products#update_variation-instance_method) -* Script tags - * [`session.script_tags.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ScriptTags#all-instance_method) - * [`session.script_tags.create(script_tag_url)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ScriptTags#create-instance_method) - * [`session.script_tags.delete(script_tag_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ScriptTags#delete-instance_method) - * [`session.script_tags.find(script_tag_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ScriptTags#find-instance_method) - * [`session.script_tags.update(script_tag_id, script_tag_url)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ScriptTags#update-instance_method) -* Shipping zones - * [`session.shipping_zones.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#all-instance_method) - * [`session.shipping_zones.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#create-instance_method) - * [`session.shipping_zones.create_shipping_method(shipping_zone_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#create_shipping_method-instance_method) - * [`session.shipping_zones.delete(shipping_zone_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#delete-instance_method) - * [`session.shipping_zones.delete_shipping_method(shipping_zone_id, shipping_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#delete_shipping_method-instance_method) - * [`session.shipping_zones.find(shipping_zone_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#find-instance_method) - * [`session.shipping_zones.find_serviceable_countries`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#find_serviceable_countries-instance_method) - * [`session.shipping_zones.shipping_method(shipping_zone_id, shipping_method_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#shipping_method-instance_method) - * [`session.shipping_zones.shipping_methods(shipping_zone_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#shipping_methods-instance_method) - * [`session.shipping_zones.sort(shipping_zone_ids)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#sort-instance_method) - * [`session.shipping_zones.sort_shipping_methods(shipping_zone_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#sort_shipping_methods-instance_method) - * [`session.shipping_zones.update(shipping_zone_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/ShippingZones#update-instance_method) -* Shop - * [`session.shop.address`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#address-instance_method) - * [`session.shop.attribute(attribute_name)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#attribute-instance_method) - * [`session.shop.attributes(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#attributes-instance_method) - * [`session.shop.create_attribute(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#create_attribute-instance_method) - * [`session.shop.create_image(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#create_image-instance_method) - * [`session.shop.current`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#current-instance_method) - * [`session.shop.delete_attribute(attribute_name)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#delete_attribute-instance_method) - * [`session.shop.delete_image(image_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#delete_image-instance_method) - * [`session.shop.image(image_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#image-instance_method) - * [`session.shop.images(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#images-instance_method) - * [`session.shop.legal_content(legal_content_type)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#legal_content-instance_method) - * [`session.shop.legal_contents(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#legal_contents-instance_method) - * [`session.shop.legal_details`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#legal_details-instance_method) - * [`session.shop.search_images_by_label(label)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#search_images_by_label-instance_method) - * [`session.shop.update(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#update-instance_method) - * [`session.shop.update_address(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#update_address-instance_method) - * [`session.shop.update_attribute(attribute_name, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#update_attribute-instance_method) - * [`session.shop.update_legal_content(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#update_legal_content-instance_method) - * [`session.shop.update_legal_details(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#update_legal_details-instance_method) - * [`session.shop.upload_image(image_path, image_name, label)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Shop#upload_image-instance_method) -* Signers - * [`session.signers.all`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Signers#all-instance_method) - * [`session.signers.create`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Signers#create-instance_method) - * [`session.signers.delete(signer_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Signers#delete-instance_method) -* Users - * [`session.users.add_roles(user_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#add_roles-instance_method) - * [`session.users.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#all-instance_method) - * [`session.users.change_password(user_id, current_password, new_password)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#change_password-instance_method) - * [`session.users.change_username(user_id, new_username, current_password)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#change_username-instance_method) - * [`session.users.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#create-instance_method) - * [`session.users.disable_support_access`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#disable_support_access-instance_method) - * [`session.users.enable_support_access`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#enable_support_access-instance_method) - * [`session.users.find(user_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#find-instance_method) - * [`session.users.roles(user_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#roles-instance_method) - * [`session.users.search_by_username(username)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#search_by_username-instance_method) - * [`session.users.send_email_address_change(user_id, new_email, current_password, locale)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#send_email_address_change-instance_method) - * [`session.users.send_reset_password_email(email, locale)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#send_reset_password_email-instance_method) - * [`session.users.set_roles(user_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#set_roles-instance_method) - * [`session.users.support_access`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#support_access-instance_method) - * [`session.users.verify_password(password, user_role)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Users#verify_password-instance_method) -* Variations - * [`session.variations.all(product_id, params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Variations#all-instance_method) - * [`session.variations.find(product_id, variation_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Variations#find-instance_method) - * [`session.variations.update(product_id, variation_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/Variations#update-instance_method) -* Webhook subscriptions - * [`session.webhook_subscriptions.activate(webhook_subscription_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#activate-instance_method) - * [`session.webhook_subscriptions.all(params = {})`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#all-instance_method) - * [`session.webhook_subscriptions.create(body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#create-instance_method) - * [`session.webhook_subscriptions.deactivate(webhook_subscription_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#deactivate-instance_method) - * [`session.webhook_subscriptions.delete(webhook_subscription_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#delete-instance_method) - * [`session.webhook_subscriptions.find(webhook_subscription_id)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#find-instance_method) - * [`session.webhook_subscriptions.update(webhook_subscription_id, body)`](https://rubydoc.info/github/ePages-de/beyond_api-ruby_client/BeyondApi/WebhookSubscriptions#update-instance_method) +- BeyondApi::Authentication::Signer +- BeyondApi::Authentication::Token +- BeyondApi::Checkout::ShippingZone +- BeyondApi::ProductManagement::Category +- BeyondApi::ProductManagement::Image +- BeyondApi::ProductManagement::Product +- BeyondApi::ProductManagement::VariationImage +- BeyondApi::ProductManagement::Variation +- BeyondApi::ProductView::Category +- BeyondApi::Shop::Address +- BeyondApi::Shop::Shop +- BeyondApi::Storefront::ScriptTag +- BeyondApi::Webhook::Subscription diff --git a/README.md b/README.md index e010932..a05ee0b 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,9 @@ $ gem install beyond_api API methods can be accessed through the client instance methods. This gem supports the various authentication methods supported by the ePages API. ```ruby -# Initializing the client -client = BeyondApi::Token.new(api_url: 'https://team42.beyondshop.cloud/api', client_id: '', client_secret: '') +# Client for authentication +api_url = '/api' +client = BeyondApi::Authentication::Token.new(api_url:) ``` ## Generate a token from [client credentials](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_client_credentials) @@ -71,7 +72,7 @@ client = client.client_credentials ## Generate a token from [authorization code](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_authorization_code) ```ruby -client = client.get('1nBfq_') +client = client.get('') # => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} ``` @@ -79,9 +80,14 @@ client = client.get('1nBfq_') ## Generate a token from [refresh token](https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_refresh_token) ```ruby -client = client.refresh_token('') +# Client for authentication +api_url = '/api' +refresh_token = '' +client = BeyondApi::Authentication::Token.new(api_url:) -# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} +client.refresh(refresh_token) + +# => {:access_token=> "", :token_type=>"bearer", :refresh_token=> "", :expires_in=>3599, :scope=> "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd", :tenant_id=>1147, :iat=>1723453179, :jti=>"C0N0VYQUgzchp2GGo8WaINhpM8s="} ``` ## Making requests @@ -89,12 +95,33 @@ client = client.refresh_token('') After generating your token following the instructions above, you can start using this gem to access various resources available, including categories, products, orders, webhooks, and more. ```ruby -client = BeyondApi::ProductManagement::Category.new(api_url: ENV["API_URL"], access_token: '') - -# Retrieve all categories -client.all +# Define the API URL and access token +api_url = '/api' +access_token = '' + +# Create a new client instance for category management +client = BeyondApi::ProductManagement::Category.new(api_url:, access_token:) + +# Find a specific category by its ID +client.find('category-id') + +# The response is a hash representing the category details: +# => { +# :id=>"8a4a8f6a-e3d9-4616-9e89-12c42c084534", +# :name=>"DO-NOT-DELETE Category", +# :type=>"SMART", +# :default_sort=>"HIGHEST_PRICE_FIRST", +# :filters=>[], +# :links=>{ +# :self=>{ +# :href=>"https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" +# }, +# :category=>{ +# :href=>"https://team42-beyond-api.beyondshop.cloud/api/categories/8a4a8f6a-e3d9-4616-9e89-12c42c084534" +# } +# } +# } -# => {:embedded=>{:categories=>[{:id=>"539c1671-1540-4254-adaf-8b22b188d6d2", :name=>"New Category", :type=>"SMART", :default_sort=>"HIGHEST_PRICE_FIRST", :filters=>[], :links=> {:self=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}, :category=>{:href=>"https://team42.beyondshop.cloud/api/categories/539c1671-1540-4254-adaf-8b22b188d6d2"}}}]}, :links=>{:self=>{:href=>"https://team42.beyondshop.cloud/api/categories?page=0&size=20"}}, :page=>{:size=>20, :total_elements=>9, :total_pages=>1, :number=>0}} ``` ## Documentation @@ -103,10 +130,14 @@ See [GETTING_STARTED](https://github.com/ePages-de/beyond_api-ruby_client/blob/m ## Development -Check out the repo an run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +Check out the repo an run `bin/setup` to install dependencies. Rename the file `.env.development.template` to `.env.development` and fill in the necessary information. Then, you can run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. +## Test + +Rename the file `.env.test.template` to `.env.test` and fill in the necessary information. Then, run `rspec` to run the tests. + ## Contributing Please see [CONTRIBUTING](https://github.com/ePages-de/beyond_api-ruby_client/blob/master/CONTRIBUTING.md). diff --git a/bin/console b/bin/console index 89df3af..2489aea 100755 --- a/bin/console +++ b/bin/console @@ -4,13 +4,13 @@ require "bundler/setup" require "dotenv/load" require "beyond_api" +require "pry" + +Dotenv.load('.env.development') -unless ENV["CLIENT_ID"].nil? && ENV["CLIENT_SECRET"].nil? - BeyondApi.setup do |config| - config.client_id = ENV["CLIENT_ID"] - config.client_secret = ENV["CLIENT_SECRET"] - end +BeyondApi.setup do |config| + config.client_id = ENV.fetch("CLIENT_ID", nil) + config.client_secret = ENV.fetch("CLIENT_SECRET", nil) end -require "pry" Pry.start diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index fe2b5ac..fc88b2d 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -43,7 +43,7 @@ def parse_request(hash) def handle_request Response.new(yield).parse rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e - raise FaradayError, e + raise BeyondApi::FaradayError, e end def agent diff --git a/lib/beyond_api/error.rb b/lib/beyond_api/error.rb index 498cb6c..279cee6 100644 --- a/lib/beyond_api/error.rb +++ b/lib/beyond_api/error.rb @@ -10,6 +10,4 @@ def initialize(response) super end end - - class FaradayError < Error; end end diff --git a/lib/beyond_api/faraday_error.rb b/lib/beyond_api/faraday_error.rb new file mode 100644 index 0000000..934871a --- /dev/null +++ b/lib/beyond_api/faraday_error.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module BeyondApi + class FaradayError < Error; end +end From b15076734ea880def57a06001bfe85f3a616b408 Mon Sep 17 00:00:00 2001 From: Kathia Date: Wed, 21 Aug 2024 09:56:10 +0200 Subject: [PATCH 49/59] EPT-2986 Add comments (#79) * Add comments * Update documentation --- .../services/authentication/signer.rb | 30 +++++- .../services/authentication/token.rb | 29 ++++- .../services/checkout/shipping_zone.rb | 18 +++- .../services/product_management/category.rb | 54 ++++++++++ .../services/product_management/image.rb | 13 +++ .../services/product_management/product.rb | 102 ++++++++++++++++++ .../services/product_management/variation.rb | 15 +++ .../product_management/variation_image.rb | 16 +++ .../services/product_view/category.rb | 54 ++++++++++ lib/beyond_api/services/shop/address.rb | 10 ++ lib/beyond_api/services/shop/shop.rb | 10 ++ .../services/storefront/script_tag.rb | 2 + .../services/webhook/subscription.rb | 55 ++++++++++ spec/spec_helper.rb | 6 +- 14 files changed, 402 insertions(+), 12 deletions(-) diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index 7e1996a..ec3704c 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -2,15 +2,41 @@ module BeyondApi module Authentication + # @example How to instantiate a client + # @client = BeyondApi::Authentication::Signer.new(api_url: 'https://example.com/api', access_token: 'your_token') class Signer < BaseService - def all(params = {}) - get('signers', params) + # List all signers. + # + # @see https://developer.epages.com/beyond-docs/#list_signers + # + # @return [Hash] + # # + # @example + # @client.all + def all + get('signers') end + # Create a signer. + # + # @see https://developer.epages.com/beyond-docs/#create_signer + # + # @return [Hash] + # + # @example + # @client.create def create post('signers') end + # Delete a signer. If at least one signer has been created, you cannot delete the last signer. + # + # @see https://developer.epages.com/beyond-docs/#delete_signer + # + # @return [Hash] + # + # @example + # @client.delete('aa859c3c-702c-4310-9b23-638fbc468f33') def delete(id) super("signers/#{id}") # Concerns::Connection delete method end diff --git a/lib/beyond_api/services/authentication/token.rb b/lib/beyond_api/services/authentication/token.rb index c0bd137..222d84d 100644 --- a/lib/beyond_api/services/authentication/token.rb +++ b/lib/beyond_api/services/authentication/token.rb @@ -2,24 +2,47 @@ module BeyondApi module Authentication + # @example How to instantiate a client + # @client = BeyondApi::Authentication::Token.new(api_url: 'https://example.com/api') class Token < BaseService - include Concerns::Connection # @session, @authorization - def initialize(**params) super - @authorization = :basic @camelize_keys = false end + # Create a JsonWebToken from a refresh token. + # + # @see https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_refresh_token + # + # @return [Hash] + # + # @example + # @client.refresh_token('your_refresh_token') def refresh(refresh_token) post('oauth/token', {}, { grant_type: 'refresh_token', refresh_token: }) end + # Create a JsonWebToken from a refresh token. + # + # @see https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_refresh_token + # + # @return [Hash] + # + # @example + # @client.get('GY_GTp') def get(code) post('oauth/token', {}, { grant_type: 'authorization_code', code: }) end + # Create a a JsonWebToken using the client_credentials grant type. + # + # @see https://developer.epages.com/beyond-docs/#create_a_jsonwebtoken_from_client_credentials + # + # @return [Hash] + # + # @example + # @client.client_credentials def client_credentials post('oauth/token', {}, { grant_type: 'client_credentials' }) end diff --git a/lib/beyond_api/services/checkout/shipping_zone.rb b/lib/beyond_api/services/checkout/shipping_zone.rb index ab7d788..e40aae1 100644 --- a/lib/beyond_api/services/checkout/shipping_zone.rb +++ b/lib/beyond_api/services/checkout/shipping_zone.rb @@ -2,9 +2,23 @@ module BeyondApi module Checkout + # @example How to instantiate a client + # @client = BeyondApi::Checkout::ShippingZone.new(api_url: 'https://example.com/api', access_token: 'your_token') class ShippingZone < BaseService - def all - get('shipping-zones') + # List all shipping zones in a paged way. + # + # @see https://developer.epages.com/beyond-docs/#list_shipping_zones + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + fetch_all_pages('shipping-zones', params) end end end diff --git a/lib/beyond_api/services/product_management/category.rb b/lib/beyond_api/services/product_management/category.rb index 647650a..775af2d 100644 --- a/lib/beyond_api/services/product_management/category.rb +++ b/lib/beyond_api/services/product_management/category.rb @@ -2,23 +2,77 @@ module BeyondApi module ProductManagement + # @example How to instantiate a client + # @client = BeyondApi::ProductManagement::Category.new(api_url: 'https://example.com/api', access_token: 'your_token') class Category < BaseService + # Retrieve the details of a category. + # + # @see https://developer.epages.com/beyond-docs/#show_category_details + # + # @param id [String] the category UUID + # + # @return [Hash] + # + # @example + # @client.find('e97226a6-9412-481f-b1d7-e64fc58df88e') def find(id) get("categories/#{id}") end + # List all available categories in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_categories + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(params = {}) fetch_all_pages('categories', params) end + # Create a product category. + # + # @see https://developer.epages.com/beyond-docs/#create_category + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # @client.create(name: 'Power Bars', type: 'SMART', default_sort: 'NEWEST_FIRST') def create(body) post('categories', body) end + # Update all product category properties. + # + # @see https://developer.epages.com/beyond-docs/#update_all_category_properties + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # @client.update(name: 'High Protein Power Bars', type: 'SMART', default_sort: 'NEWEST_FIRST') def update(id, body) put("categories/#{id}", body) end + # Delete a product category. + # + # @see https://developer.epages.com/beyond-docs/#list_categories + # + # @param id [String] the category UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('c8cc52ec-fe57-4d4d-a2e3-f1756e767724') def delete(id) super("categories/#{id}") # Concerns::Connection delete method end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 6fd17b5..14b937d 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -2,7 +2,20 @@ module BeyondApi module ProductManagement + # @example How to instantiate a client + # @client = BeyondApi::ProductManagement::Image.new(api_url: 'https://example.com/api', access_token: 'your_token') class Image < BaseService + # Retrieve the images of a product. + # + # @see https://developer.epages.com/beyond-docs/#list_product_images + # + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(id, params = {}) get("products/#{id}/images", params) end diff --git a/lib/beyond_api/services/product_management/product.rb b/lib/beyond_api/services/product_management/product.rb index c947f3f..a30b427 100644 --- a/lib/beyond_api/services/product_management/product.rb +++ b/lib/beyond_api/services/product_management/product.rb @@ -2,15 +2,117 @@ module BeyondApi module ProductManagement + # @example How to instantiate a client + # @client = BeyondApi::ProductManagement::Product.new(api_url: 'https://example.com/api', access_token: 'your_token') class Product < BaseService + # List all products in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_products + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(params = {}) fetch_all_pages('products', params) end + # Create a product. + # + # @see https://developer.epages.com/beyond-docs/#create_product + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # product_data = { + # sku: '123456789-001', + # name: 'Rioja Castillo de Puerto (2013)', + # description: 'Spain\nRioja Tempranillo', + # manufacturer: 'Grape Vineyard', + # essential_features: 'Dry. 12% alcohol. Best vine variety.', + # tags: ['Bestseller', 'Red Wine', 'Sale'], + # product_identifiers: [ + # { + # type: 'EAN', + # value: '9780134308135' + # } + # ], + # sales_price: { + # tax_model: 'GROSS', + # amount: 8.7, + # currency: 'EUR' + # }, + # list_price: { + # tax_model: 'GROSS', + # amount: 10.95, + # currency: 'EUR' + # }, + # manufacturer_price: { + # tax_model: 'GROSS', + # amount: 11.95, + # currency: 'EUR' + # }, + # visible: true, + # tax_class: 'REGULAR', + # shipping_weight: { + # value: 1175.0, + # display_unit: 'GRAMS' + # }, + # max_order_quantity: 6, + # shipping_dimension: { + # length: 1500, + # width: 1000, + # height: 2000 + # }, + # ref_price: { + # ref_quantity: 1, + # unit: 'LITER', + # quantity: 0.75, + # price: { + # tax_model: 'GROSS', + # amount: 11.6, + # currency: 'EUR' + # } + # }, + # shipping_period: { + # min: 2, + # max: 4, + # display_unit: 'WEEKS' + # }, + # pickup_period: { + # min: 1, + # max: 2, + # display_unit: 'WEEKS' + # }, + # product_labels: [ + # { + # type: 'NEW', + # active_from: '2024-08-19T13:04:55.897122293', + # active_until: '2024-09-16T13:04:55.897122293' + # } + # ] + # } + # @client.create(product_data) def create(body) post('products', body) end + # Retrieve the details of a product. + # + # @see https://developer.epages.com/beyond-docs/#show_product_details + # + # @param id [String] the product UUID + # + # @return [Hash] + # + # @example + # @client.find('985efde9-577c-4752-9556-af5ed8a81b1b') def find(id) get("products/#{id}") end diff --git a/lib/beyond_api/services/product_management/variation.rb b/lib/beyond_api/services/product_management/variation.rb index 223b14f..f7fffaf 100644 --- a/lib/beyond_api/services/product_management/variation.rb +++ b/lib/beyond_api/services/product_management/variation.rb @@ -2,7 +2,22 @@ module BeyondApi module ProductManagement + # @example How to instantiate a client + # @client = BeyondApi::ProductManagement::Variation.new(api_url: 'https://example.com/api', access_token: 'your_token') class Variation < BaseService + # Retrieve the variations of a variation product in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_variations + # + # @param id [String] the product UUID + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(id, params = {}) get("products/#{id}/variations", params) end diff --git a/lib/beyond_api/services/product_management/variation_image.rb b/lib/beyond_api/services/product_management/variation_image.rb index fa4c9d0..62e538e 100644 --- a/lib/beyond_api/services/product_management/variation_image.rb +++ b/lib/beyond_api/services/product_management/variation_image.rb @@ -2,7 +2,23 @@ module BeyondApi module ProductManagement + # @example How to instantiate a client + # @client = BeyondApi::ProductManagement::VariationImage.new(api_url: 'https://example.com/api', access_token: 'your_token') class VariationImage < BaseService + # Retrieve the images of a single variation of a variation product in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_variation_images + # + # @param product_id [String] the product UUID + # @param variation_id [String] the variation UUID + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(product_id, variation_id, _params = {}) get("products/#{product_id}/variations/#{variation_id}/images") end diff --git a/lib/beyond_api/services/product_view/category.rb b/lib/beyond_api/services/product_view/category.rb index 9f16499..5dc7b93 100644 --- a/lib/beyond_api/services/product_view/category.rb +++ b/lib/beyond_api/services/product_view/category.rb @@ -2,15 +2,69 @@ module BeyondApi module ProductView + # @example How to instantiate a client + # @client = BeyondApi::ProductView::Category.new(api_url: 'https://example.com/api', access_token: 'your_token') class Category < BaseService + # List all product categories in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_product_categories + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(params = {}) fetch_all_pages('product-view/categories', params) end + # Retrieve the details of a category. + # + # @see https://developer.epages.com/beyond-docs/#show_product_category_details + # + # @param id [String] the category UUID + # + # @return [Hash] + # + # @example + # @client.find('823c12ed-1f1b-47c6-8fc8-51fb7338be84') def find(id) get("product-view/categories/#{id}") end + # Preview products included in category in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#preview_products_included_in_category + # + # @param body [Hash] the product filters + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # body = { + # filters: [ + # { + # key: "manufacturer", + # values: ["Grape Vineyard"] + # }, + # { + # key: "all_tags", + # values: ["Power Bar", "Bestseller", "High Protein"] + # }, + # { + # key: "price_range", + # min: 3.7, + # max: 13.7 + # } + # ] + # } + # @client.preview(body, { size: 100, page: 0 }) def preview(body, params = {}) post('product-view/categories/preview', body, params) end diff --git a/lib/beyond_api/services/shop/address.rb b/lib/beyond_api/services/shop/address.rb index 800872d..5e5470a 100644 --- a/lib/beyond_api/services/shop/address.rb +++ b/lib/beyond_api/services/shop/address.rb @@ -2,7 +2,17 @@ module BeyondApi module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Address.new(api_url: 'https://example.com/api', access_token: 'your_token') class Address < BaseService + # Retrieve the details of a shop's address. + # + # @see https://developer.epages.com/beyond-docs/#show_address_details + # + # @return [Hash] + # + # @example + # @client.show def show get('shop/address') end diff --git a/lib/beyond_api/services/shop/shop.rb b/lib/beyond_api/services/shop/shop.rb index 757c314..b722e72 100644 --- a/lib/beyond_api/services/shop/shop.rb +++ b/lib/beyond_api/services/shop/shop.rb @@ -2,7 +2,17 @@ module BeyondApi module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Shop.new(api_url: 'https://example.com/api', access_token: 'your_token') class Shop < BaseService + # Retrieve the details of a shop. + # + # @see https://developer.epages.com/beyond-docs/#show_shop_details + # + # @return [Hash] + # + # @example + # @client.show def show get('shop') end diff --git a/lib/beyond_api/services/storefront/script_tag.rb b/lib/beyond_api/services/storefront/script_tag.rb index 79ffebe..d101d7e 100644 --- a/lib/beyond_api/services/storefront/script_tag.rb +++ b/lib/beyond_api/services/storefront/script_tag.rb @@ -2,6 +2,8 @@ module BeyondApi module Storefront + # @example How to instantiate a client + # @client = BeyondApi::Storefront::ScriptTag.new(api_url: 'https://example.com/api', access_token: 'your_token') class ScriptTag < BaseService def all(params = {}) params.merge!(client_id: BeyondApi.configuration.client_id) if params[:only_own] diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 51e3a97..794584b 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -2,25 +2,80 @@ module BeyondApi module Webhook + # @example How to instantiate a client + # @client = BeyondApi::Webhook::Subscription.new(api_url: 'https://example.com/api', access_token: 'your_token') class Subscription < BaseService + # List all webhooks subscriptions in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_webhook_subscriptions + # + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) def all(params = {}) get('webhook-subscriptions', params) end + # Create a webhook subscription. + # + # @see https://developer.epages.com/beyond-docs/#create_webhook_subscription + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # webhook_data = { + # callback_uri: 'http://example.com/test', + # event_types: ['order.created', 'product.created'] + # } + # @client.create(webhook_data) def create(body) post('webhook-subscriptions', body) end + # Delete all webhook subscriptions. + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # @client.delete_all def delete_all all.dig(:embedded, :subscriptions).each do |subscription| delete(subscription[:id]) end end + # Delete a webhook subscription. + # + # @see https://developer.epages.com/beyond-docs/#delete_webhook_subscription + # + # @param id [String] the webhook subscription UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('84ce4b3a-9a10-46d0-afcd-a71bcd0c0e9a') def delete(id) super("webhook-subscriptions/#{id}") # Concerns::Connection delete method end + # Retrieve the details of a webhook subscription. + # + # @see https://developer.epages.com/beyond-docs/#show_webhook_subscription_details + # + # @param id [String] the webhook subscription UUID + # + # @return [Hash] + # + # @example + # @client.find('a2e39f0f-7728-40ca-88e4-cb8cea9ecf5e') def find(id) get("webhook-subscriptions/#{id}") end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 665b37b..aa49eab 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,11 +33,7 @@ end def auth_client - BeyondApi::Authentication::Token.new( - api_url: ENV.fetch('API_URL', nil), - client_id: ENV.fetch('CLIENT_ID', nil), - client_secret: ENV.fetch('CLIENT_SECRET', nil) - ) + BeyondApi::Authentication::Token.new(api_url: ENV.fetch('API_URL', nil)) end def beyond_access_token From 13c1056f6137a3e74a7b53972e6672b5baf212ca Mon Sep 17 00:00:00 2001 From: Kathia Date: Wed, 28 Aug 2024 16:15:48 +0200 Subject: [PATCH 50/59] EPT-2953 Add endpoints to upload images (#82) * Add endpoints to upload images * Update image upload * Update connection.rb * Update product upload * Rename methods --- Gemfile.lock | 4 + beyond_api.gemspec | 1 + lib/beyond_api.rb | 1 + lib/beyond_api/concerns/connection.rb | 22 +++ .../services/product_management/image.rb | 38 ++++ lib/beyond_api/utils.rb | 10 ++ .../services/product_management/image_spec.rb | 21 ++- spec/files/image3.png | Bin 0 -> 2720 bytes .../_upload/uploads_an_image.yml | 141 +++++++++++++++ .../_upload/uploads_multiple_images.yml | 164 ++++++++++++++++++ 10 files changed, 401 insertions(+), 1 deletion(-) create mode 100644 spec/files/image3.png create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_an_image.yml create mode 100644 spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_multiple_images.yml diff --git a/Gemfile.lock b/Gemfile.lock index dd83a2c..a06e63e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,6 +4,7 @@ PATH beyond_api (0.24.2.pre) activesupport (~> 7.0) faraday (~> 2.10.0) + faraday-multipart faraday-retry zeitwerk @@ -42,6 +43,8 @@ GEM faraday (2.10.1) faraday-net_http (>= 2.0, < 3.2) logger + faraday-multipart (1.0.4) + multipart-post (~> 2) faraday-net_http (3.1.1) net-http faraday-retry (2.2.1) @@ -56,6 +59,7 @@ GEM logger (1.6.0) method_source (1.1.0) minitest (5.24.1) + multipart-post (2.4.1) net-http (0.4.1) uri parallel (1.26.2) diff --git a/beyond_api.gemspec b/beyond_api.gemspec index 96a9bcc..8948629 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -32,6 +32,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'activesupport', '~> 7.0' spec.add_dependency 'faraday', '~> 2.10.0' + spec.add_dependency 'faraday-multipart' spec.add_dependency 'faraday-retry' spec.add_dependency 'zeitwerk' diff --git a/lib/beyond_api.rb b/lib/beyond_api.rb index 7c5c075..d2fd69a 100644 --- a/lib/beyond_api.rb +++ b/lib/beyond_api.rb @@ -3,6 +3,7 @@ require 'active_support/all' require 'faraday' require 'faraday/retry' +require 'faraday/multipart' require 'forwardable' require 'json' require 'zeitwerk' diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index fc88b2d..9109a51 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -32,6 +32,27 @@ def delete(path, params = {}) handle_request { agent.delete(path, parse_request(params)) } end + def upload_file(path, file_path, params = {}) + handle_request do + agent.post(path) do |request| + request.headers['Content-Type'] = Utils.file_content_type(file_path) + request.params = parse_request(params) + request.body = File.binread(file_path) + end + end + end + + def upload_files(path, body, params = {}) + handle_request do + agent.post(path) do |request| + request.headers['Content-Type'] = 'multipart/form-data' + request.options[:params_encoder] = Faraday::FlatParamsEncoder + request.params = parse_request(params) + request.body = body + end + end + end + private def parse_request(hash) @@ -59,6 +80,7 @@ def agent # Request options faraday.request :json # Encode request bodies as JSON faraday.request :retry, BeyondApi.configuration.retry_options + faraday.request :multipart, { flat_encode: true } # Response options faraday.response :json, content_type: 'application/json' faraday.response :logger, *logger_config { |logger| apply_filters(logger) } diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 14b937d..94360a9 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -19,6 +19,44 @@ class Image < BaseService def all(id, params = {}) get("products/#{id}/images", params) end + + # Upload an image and add it to a product. The body of the request must contain the content of the image. + # The maximum image size is 7000 × 7000 px, and the maximum file size per image is 8 MB. + # + # @see https://developer.epages.com/beyond-docs/#upload_product_image + # + # @param id [String] the product UUID + # @param id [String] the image path + # @param id [String] the image file name + # + # @return [Hash] + # + # @example + # client.upload('4125b993-49fc-47c8-b9b3-76d8871e4e06', '/home/epages/file.png', 'file.png') + def upload(product_id, image_path, image_name) + upload_file("products/#{product_id}/images", image_path, file_name: image_name) + end + + # Upload up to 10 images and add them to a product. The body of the request must contain the content of the images. + # The maximum image size is 7000 × 7000px, and the maximum file size per image is 8 MB. + # + # @see https://developer.epages.com/beyond-docs/#upload_multiple_product_images + # + # @param id [String] the product UUID + # @param id [Array] an array of strings containing the path of each image + # @param id [Array] an array of strings containing the file name of each image + # + # @return [Hash] + # + # @example + # image_paths = ['/home/epages/file1.png', '/home/epages/file2.png'] + # image_names = ['file1.png', 'file2.png'] + # client.upload('4125b993-49fc-47c8-b9b3-76d8871e4e06', image_paths, image_names) + def upload_multiple(product_id, image_paths, image_names) + upload_files("products/#{product_id}/images", + { image: Utils.faraday_file_parts(image_paths) }, # body + { file_name: Utils.encode_filenames(image_names) }) # params + end end end end diff --git a/lib/beyond_api/utils.rb b/lib/beyond_api/utils.rb index 095354c..3bdf6a1 100644 --- a/lib/beyond_api/utils.rb +++ b/lib/beyond_api/utils.rb @@ -18,5 +18,15 @@ def self.file_content_type(file_path) def self.camelize_keys(hash) hash.deep_transform_keys { |key| key.to_s.camelize(:lower) } end + + def self.faraday_file_parts(file_paths) + file_paths.map do |file_path| + Faraday::FilePart.new(File.open(file_path), Utils.file_content_type(file_path)) + end + end + + def self.encode_filenames(filenames) + filenames.map { |e| URI.encode_www_form([e]) } + end end end diff --git a/spec/beyond_api/services/product_management/image_spec.rb b/spec/beyond_api/services/product_management/image_spec.rb index 0fe5897..87e2555 100644 --- a/spec/beyond_api/services/product_management/image_spec.rb +++ b/spec/beyond_api/services/product_management/image_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe BeyondApi::ProductManagement::Image, vcr: true do +RSpec.describe BeyondApi::ProductManagement::Image, vcr: { match_requests_on: [:method, :uri] } do let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } describe '.all' do @@ -12,4 +12,23 @@ expect(response[:page]).to be_kind_of(Hash) end end + + describe '.upload' do + it 'uploads an image' do + response = client.upload('4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc', + 'spec/files/image1.png', + 'new-image.png') + + expect(response).not_to be nil + expect(response.dig(:links, :data, :href)).to include('new-image.png') + end + + it 'uploads multiple images' do + response = client.upload_multiple('4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc', + ['spec/files/image2.png', 'spec/files/image3.png'], + ['new-image2.png', 'new-image3.png']) + expect(response).not_to be nil + expect(response.dig(:embedded, :images)).to be_kind_of(Array) + end + end end diff --git a/spec/files/image3.png b/spec/files/image3.png new file mode 100644 index 0000000000000000000000000000000000000000..ae85c3de27c81506b28a3439f09e0b6f6e8b971e GIT binary patch literal 2720 zcmd5;`BxH%7G_@4Vx=}st_=Drmy9&Wt=zIK*IY6S#SJyZ6q3v>6s4IoHG(lqMA6K& zQb8R=+)%OH_bqUj+!sW1!wvK~f5Uq}ynD_)_nz;3=YHqj@0Xi!$Ie3hxcqSd03dE< zdFw6!@GoZo;HSi&4;>)SfQKjt1$f8ip4qv(l>Pnv#9Ve$-$F=IE479@Ilpe~$ACuF z;>+Dx2Q;zAme61TK%)Mi{3#hM0R#Y!gRO4exc4-jpJDr8xKYZ?H{oLWNlF?&sU%sa zP3vW!hVr0Q^(9}!j^5&cvbNlybC=cFwi|TtX@C`AZKL*vhq;lTD&To|kS+-=>wUz~ z@IdE(5s9))i(mr7HzrFx468Yd3Rp3Fh+`8jo4QiNFux3WGbVA}(i9LZrqr3gb*`i# zph+f69b#B>>=A9~|B}k|5=wr)Oc<+XUNwl^tEPT$vRL~wTp0!$J0fE{L?yR)HpuLs z(CEivt~t+6Xi|}1;i5>b+*K9oOP{}v+Kxq!6%1S`A!J5zswSSZj+|L!8*7|ktw&_! zLq&NjFZbuvx3UNGW8G_pl5?S@3*(_}<7^Ph&pjS*&fJP3J3Sw#(Z3h=fiq7Zrgs`g zr2IC}nP|(8Rj71%*ACp>>}d#WoLRAV`?xoL%vjJ^6%OYYNyxnejd{4cM+w&{?9$h| zt9v^wFwnKgy~V+7Cxr5H7F0AX#$gt1_C4X9|~6bl5=+9oK+QJ@sN?R zdfBkc_v+PWSLi#1o7^#bIuSI)F`Yb=Vt$T`_il=s8jnUE{U`ZZUfY9dE@#XiS zw|15|G5#Yt4K`w-hn5IGkTK458aYT&)U z09L}|EdSJGZtTt3Ez~D+%wx~j_8p~ zbKLbz(xS*bmXT%`_3%@9jCvjb`%d@D;0r-l{<1+Lk^<%9~6?b z5b~Vt4B%3^$19#q3$$Jcp?%#tl(`-A z7uRn{^;w(3ZB6^A-ieiT>-TPDw%ZL;6cO~NZ}(LN`>a_?|14UX^c0z7oEBd^oIR87`PXIF7b=# zKqs<}{x>zGGiw*47=Qy+C#aPIbKo848kd~-J1J$gdgS{s>o$rvvm?LMy(SMRmg<{+ z^_M>m^nr8rn`mbMH$(He;Srl{+nZS$>y4j@?pM_nNk`H8y`Zv*Sckf^YscYQ7mAB&uo1?Fr!Z!>%twk=UwZIrc z$nC00d9_sC`K#eS>~34OP%$xqoK)%MVh6R<&_NnxdGS3g4(c_T8CioHOuSAvkf(}Y z*K!`=mB((TvFDq^03W9OyC0ocendCuS~rS6g8N)^CQ`eq+NoZ|GN4wNwKCnVGK`2zr^*nHhSaAvHC=KCJd$lA%;vbUBRs@HUqlb%0!- z%a7w(gs-ti*RF82Xe%p(X-M-?ZKnT(y%3sigTyGr7uHxRROY%g#5Eg&t%QXQ5D%5T)rSQ+wY|Hnp zC@3z%hg*-~T~xM+9%#R1%ZA2JPh;}BHro`2Bj(t}ik~*Z165|=AKmu8{`g~;jXAR% z{MH$Xw9ez<=6zsSSX&i7j6FM1E4|N())c^T&q|T{Yc|Ui3^_r2z3q>dLz%!Z*wuwe zTtzfO$d1dIb&7WN7?10dq3|W>OXXK1qjkBY`>ioKmEN@1P*~*L5{nt~RbfBQI^hd5 zTh+p1Ie&NrE;Sv1jib)1%K+u-LZ41xA83qgQ7QyxpvcY2)PeH#sgRDEX0}Jdmp+9dJAz zRiKIj@wTBS#E6r~^LiIWDB!rH`Kp!zCF~-U9gzj?_nv&>D8jO}EVP$l-*hCqgo?+z z>{$7(Y?}qcQ^4d)T}v}=>9K{c22I?h<*$ipgr>YC>T`Zf_>v`QWv79u$UUiT@Hk72 ynTCz<*kN@@!x*g7#QgLu{K3cg-^R02p<;++Xa5I>cc1>5Wo2e}tI*W*&;J1RVoCh~ literal 0 HcmV?d00001 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_an_image.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_an_image.yml new file mode 100644 index 0000000..142cb3d --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_an_image.yml @@ -0,0 +1,141 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 23 Aug 2024 06:24:40 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.123' + X-B3-Traceid: + - db6726c24244f7cfd6de9de4d765d463 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724394280, + "jti" : "oFIYaozJNpVa0pp3EiLllp/To1w=" + } + recorded_at: Fri, 23 Aug 2024 06:24:40 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images?fileName=new-image.png + body: + encoding: ASCII-8BIT + string: !binary |- + iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQBAMAAABykSv/AAAAG1BMVEUAAAD///8fHx+/v7/f399/f38/Pz+fn59fX1/Ew5I3AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAD1ElEQVR4nO3Zz0/bMBTAcSvQtMeZZj+ObVWhHekO244NYj+OVBqCY4s4cKTadqfTNvFnL/Z7TlI2lihKVjR9PwcaV/GLX+zYbjAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAID/QzQKR9dnF/mxiX+cfasXYJIfNQzQktlcDz5Za5NTLfTSrPSuTv29JBw1DNCSnp3LwZV9d3eeJiNfiNPk4scXe1wjwCIk0jRAS1aaSGzfZ38HqVx6lSyzv9+1VX8T2yQcNAvQllSH1nQoH75ZUXokH/PK+vtDTaRpgJb0hyu51lruZGTdIO/rnRw/rQywfq2JNA3Qks2xJBLZW/li4YrjF1LoJX+qUzZIDuWcpgFaEtmlJJJf0TfBN6bcugeNn8VSs2mAluw9NZLIfhgDfTfU0zCJro8qAsxONZGmAVqyONJExgf6zcC6+zjS0uZJOLOX1zk1hd7QaCKVAToVZxeURDZz/cq1YZCP7Lx5xa3tD0sBVgchkcoAndrPxrMkssiHQHrr7nPpBDEN362flQJkJ2silQE6tb4JibgjMTs1/eehsJdPn7oymL5dFvXdiZpIZYAu+REgiczykZ+1qLh60aLQJVsd4saTJlIdoENj1yhJJBsPRTuK8VBqh3TJVodErqCJVAfokL+L9xPJBnvRjl7pyfZdstUh/sb/lsiDATojF6mdiOuSrQ6RB/wRJLLyu6Paibgu2eqQ2G+odp9IlC7dR/1EovTNVodMfVa7T2RPnkOdtfJ2uEnngWd1assdYmZ+xg2zVp0A3dC1uO7060q2vHPS5Xvn02/YD9VcEP1JSXmg6O5j5wtiGMc1tyjGdchlWuoSfSp2vkXZJCdemn3e1NrzZVPWtOiSgZX6J9nnh11uGje2cCSLvG9foiu2nDQvKrg1JCq6ZFCqPzR1AnQkmojN8WRS/l3khnfxu+imqODXkFKXaP2XyWQyqhWgY3V/6sqiHpWfEu9x/NQ1IZHqdwe6qE/vr3Dxo3j5YEIiZiFvc2Lfnp6+zVkVc07YZf3WJZpIZYDOaSL7cukrueHyvjAuNXoRHub7XRISqQrQOU0kSj8a9yZY7us0uTXute4oP+1qqQfRx+36IZGqAJ3TRLKN1POzz3Y40lbZr+cz+6pG/ZBI4wBtCYmY725BuNXCwP1X4G2d+nkiTQO07/Du5ygvRNd3l/88AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAj9gv2X223KqGyf0AAAAASUVORK5CYII= + headers: + Accept: + - application/json + Content-Type: + - image/png + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 23 Aug 2024 06:24:40 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/9d47a8ee-d2df-4227-acb1-ab1081777615 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.200' + X-B3-Traceid: + - abc4c43d5847237a86d1218306eef756 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "position" : 0, + "width" : 400, + "height" : 400, + "_id" : "9d47a8ee-d2df-4227-acb1-ab1081777615", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/9d47a8ee-d2df-4227-acb1-ab1081777615" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image.png?hash=54386a565cf2d7f563e8dec800be24434918438d{&width,height,upscale}", + "templated" : true + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/9d47a8ee-d2df-4227-acb1-ab1081777615" + } + } + } + recorded_at: Fri, 23 Aug 2024 06:24:40 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_multiple_images.yml b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_multiple_images.yml new file mode 100644 index 0000000..18f1794 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_ProductManagement_Image/_upload/uploads_multiple_images.yml @@ -0,0 +1,164 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 23 Aug 2024 06:24:40 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.114' + X-B3-Traceid: + - '09a5df9a5a4b44b7c177246e659cf042' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1724394280, + "jti" : "X4uDg1Wy4xZKXylhjIHJQWMRAx0=" + } + recorded_at: Fri, 23 Aug 2024 06:24:40 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images?fileName=new-image3.png + body: + encoding: ASCII-8BIT + string: !binary |- + LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LTc2MWE5ZTIzZjk5NzI2YzM2MDgyZTc2YjM0ZGIwYmEwDQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImltYWdlIjsgZmlsZW5hbWU9ImltYWdlMi5wbmciDQpDb250ZW50LUxlbmd0aDogMTc4Mw0KQ29udGVudC1UeXBlOiBpbWFnZS9wbmcNCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJpbmFyeQ0KDQqJUE5HDQoaCgAAAA1JSERSAAACWAAAAZAEAwAAAIAbA6sAAAAbUExURQAAAP///x8fH19fX5+fn7+/v9/f339/fz8/P6z6+bIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAaCSURBVHic7dvNc9NGGMdxW37TsQtJ4GgX4uGIGaA9xi2017rThB4xLbRHXNIMxxjaaf7sSqvVvmgfGZRDu858P4cQ/7Bj+/Gj1Wol93oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8L+49/zs9Kf3QfTP8zen76a9T2afLbsKbubnZ69fPOp9MkvOU6Ud/WGTbKmTw0vvXlLWwUI99G7dr57y594nsuSYWhXVstHSJIfT3s7s82XKL9awfsofd2fJOVbq10fT7MHjtS3WXKkXH3oPnih1u7cr62DsFytbq8P30+zjygulLDnFi/zF/Pani6pt4b574VLWxdJ/2NxszMWWfXtXlpy5OoijO+a3rbq7I+sgV2ETvbXxZXuWnlXcKEsb5XYck7IO5urCPc/Q9c5WvWzPkjOJmz73em1hPm8p62J1OHbF2qqT+tdB3bBSlpxZ/M7H3ic7VLdasw4m6pVXrLXXmks1bc2Ss4y3qa2/3zKfspR1sFWXY2879prZfFhSlpxMGK1Xfv1MMaWsg/VBzxVr5I9Jw+qGlCVnqH5oRlkwis30rknKOj3LS69YM3+XYj4tKUtOP37fg2BIGuuBV8o6WBSDkCvWIhiS1gdtWXIW8RYVNttEbxJSZuXBw/Np9Bd1X7piLQ/9/9wctWXJWcaf4TgYXnPdU1JmrYKJ2vZV9BdHZaldsdbB/mGre0rKkrOOR4fGlqnHDymrDYPxLFdBj2ibo6lfrHBEqv60lKUmU19EWeNj1Z+5lNm/ERwDbFXUWbmuhC1Woy9100pZcnI9+uTnZ2/c2t9CBXdZHbRk1rHXWsWx0LT5JNVbt8UahB/QqNxbSFlyJuWr+qtaRvptWmWN0VUPvVJm+a0lNJa5ty1WY/eg9x1Slpxh8aEfl8t+6+KH2bbCSlR1kjLHtZbUWGbaYYvVqISuk5QlZ6QeDpR6cVm8zQtlXnBjB6knF1LmuNaSGsvMN71infj/PaiKFWfJGavLTb3o/dTsx8IBqXj/LZmnbi2pserH2mI1BqS8HK6kLDl99dEeFRf9oVtrFR4mV8USMk/dWlJj1ZuUV6xgV2eKFWfJ6auFm9IMq7pdo1imtcTG2pon2P9izdTam1Guhcl0NcWSMl/VWlJjZfVDbbHGzcLckrPkzJT/Kmd65LhOsXRriY01qvdzN6FY/n5tqLv/Opuhbi2psYod57T65SZshv5xXbVqda1iFa11R2ostzR1E4oV9LteR2pMExbC1GERF6toLamx3NJX29RhIEwdBokWK5g564l690mpNpcay1uB3v9J6Sx8kbpjuh/uaFvpTLU3Uu//4U5fKFbnA2mtPOUcn3afuwLu/4F0o1h6StB5icY89Hfh3LZ3x/1fohkLxeq6+KeVc6zjqLUm3pi//4t/o7DfdQP1gwbJzLJynAXKOVYWtVZfvT6trVT5s7z2KqxpdV5NylLTGCt0sTqfsOjVR4VRa/VVU/nAfT1h0Rgr9Dgeng+uT4XFma+avEetJRcrPKFtToUJWWrCM83VeJw3Tqi+bck89VFhs7WyL525elT8LO8W9k3VU1KWnHC/Vr3X4LoPs8IiZX5QDeTxqOW4U2F9v9bVqR8xS87G/0TNavlSuAhEyiy33BDvEC1XrGCbNjekLDnBFH5c7Rs7X3Lklht2tNYNuOQouDDNXKo+8mZHI7MHkLKav47V3lrexWwr7yhypdqz1GTeglZmzlj4Z+A35i1KWc1fx2pvreAySTu7s1dpSllyNu5Fzusu29htc2BrJGWVcIG0tbW8Yk3cBaqL+umlLDkj+42JXLkVp/qFb2zTSFllEtzOhONGzStWsZ2d1I+1hZay5KzUwbT8N1/ZnrDfI/jbXZIuZcbF1L913NIWfrHm6uihec67u7LkDJU6fPfh6vFaHV3WWfkNla+vPn7nL35KWSXbccvxi1WMbEffXunnnO7K0mO/5/RNnB0I97vmJYx+sXqDtfljJ7uz9DxpfoGucBFcWNOefb6gWL3JOn5OKUtP/tWzZ80vXd47f/Z983uSUnZdmfCcUgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/7l/Aav8Mq93IWbxAAAAAElFTkSuQmCCDQotLS0tLS0tLS0tLS0tUnVieU11bHRpcGFydFBvc3QtNzYxYTllMjNmOTk3MjZjMzYwODJlNzZiMzRkYjBiYTANCkNvbnRlbnQtRGlzcG9zaXRpb246IGZvcm0tZGF0YTsgbmFtZT0iaW1hZ2UiOyBmaWxlbmFtZT0iaW1hZ2UzLnBuZyINCkNvbnRlbnQtTGVuZ3RoOiAyNzIwDQpDb250ZW50LVR5cGU6IGltYWdlL3BuZw0KQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmluYXJ5DQoNColQTkcNChoKAAAADUlIRFIAAAJYAAABkAQDAAAAgBsDqwAAABtQTFRFIlKr////kKjVx9PqdJLKrL7f4+n0PWe1WX3AjbhdvwAAAAlwSFlzAAAOxAAADsQBlSsOGwAACitJREFUeJztnU1j28YVRWWJKrgMq5rtkrSVNMsyitMuJdlJvSxlO83Ssmq3y6hxIi8p1U31sysSAEkA8/XAQV5GPGcnAIN3cTWYeRhiBjs7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQGLtHc461ZYShLXZ/MOdvavFFaIvVji9CW6x2fBHaYrXji9AWqx1fhLZY7fgitMVqxxehLVY7vghtsdrxRWiL1Y4vQlusdnwR2mK144vQFqsdX4S2WO34IrTFascXoS1WO74IbbHa8UVoi9WOL0JbrHZ8EdpiteOL0BarHV+Etljt+CK0xWrHF6EtVju+CG2x2vFFaIvVji9CW6x2fBHaYrXji9AWqx1fhLZY7fgitMVqxxehLVY7vghtsdrxRWiL1Y4vQlusdnwR2mK144vQFrth/A+nL47evbs4Onv+vazgx0fzgnclXx3eBhdN2qybyWDFF/8LLtd/fD5Y5+IwrGzCZv17MqjyJqyKZI8HTd5+3q3YKLSOn33WvOKDvwYU7NU9Lgu/9Hqdqln9qfGK/+gt+KPZqoVdvtqVqFm26uF1y+HVHW9nXYiNRrv4fZtXg+Gxs+Cu0yufEgWzzj16lxzYzpBN7YUeulqezBv799HFbsbm8U9cpf7hCD32xrx3Zu2vDhmeHd5eXV19/PSr1baRNfL++slfHT57/uzZo1drJe+hWf3lCda7r/fTcutDa+TJ8tRna1lo9vHTlaT7ZtbyJvyy2jw9LbfbWuC98oA3s/qu99/eT7OWHdrf63vKtMBWtabF/r+YdvYf30ezykbakFGVbo2MBUuXjV7tFLXrfplVNtJ/Nu38Od/3O2Pc63yno7e8Ob9nZk1dl1wmYDPTvjzugSsP63/2azPrw+0a/1lE+u7WhGncpLiXbJdc7H5t2FVUSU/+PYspNjbSJ4gTzyXn+01N/KV1TzCJPRtmuVe/tR7Qs96Hk82vNDGz9rz30thyH+Y2D9toXJKYWWPvvbRvqXp5a/aHNhpr507FrOIu/JPrmLz/anQAv4lwoWmZld+FQ+f4b55OjcybZy0krkjLrJOAeym/3+r5Un4Db5gMpWXWecjR58ZGa9EZmlP7YJIyqxdwFxbVr9HtmeubjKTMypssX/XIm/Lj6sbMklGISMqsa39fuFPWv9pR/aCiHpIyaxrWo50b7rhejOtMyazQJHxsaOG3zqzdoCareGSuZQm75uxLRkpm7QU20vlx1T5zd9tq1mVg7egZusOtM2tsqDEmMkPPZ+wipaRk1sTQFtkP/KSyqbdtedbA0MsZGTdzhzzP+sRSIJCEzMqvN+SJ5brZa+a35mbDWSmZtRt8Jz2YH1gbIRwYtklJyKy94EMXR9aS14lhm5SEzHpgyAhcJ61uGweX9p03CbOuAzOHsuubGUq/litcIyGzzONUJvqGWpQP3Gw2+peQWdPQNKvo+kaGQEEV00pCZk1C06xikKZ60uKHoddihWskZNZ5+H208LX2bLOomJv9ZJGQWYsjw0bRF8bU0vXLwcaXmo5Z+X0U9sAyNfhaNFrOV448pGNWX9DmGB4Ol69auV799pCOWZJBlkWWUX8QLN78a76LGkw6ZkmG7wxP0su3kTZwKx2z9g3Jkw2jWav5Fd8JRVYlpGDWnsCsRc/XSMlWs5y+bNfKp2bWcdBZzWatTd15GDKNs0E6ZuUPd7Ogsy7Mag5e9Qcrvgg7U4X7aZZp9G/OD2tuDV+GnWuNdMzKh7MeBTG2mFWbfCetXamZJcD0GFif1vnkuBux3fALm9WcMCypXdtmVnPa/jA860rHrMs4ZhkmWD88ji62G355s9ZmcZaEVq5tNKu5MEvgUMRWmrWTNSpX0Do222nWfGZh7eiQwf10zMp7w7OwrHTOoft8H2qLHb2JKbYbpGbNIsbuV+36l7fANptVX0rLq2K7zaq2Xb6pGwmZZZw4EYGb1Zxx3+tbmLX+AOQ5ezpmSUZKZaxWxPP83p2aWaNOVHxTujVzHpaOWZ0qLUfn/6knIQDp74YbvsluI5vkZrnfG0nHrChvslspfyYbuQ7CrIJidN75lk46ZkV57d93evfL3+mYFeW1fwdF1XJl8emYJXnzrw1Fq+WSkpBZiw4r7J3SVky8jWJCZk39fftGXHrv84TMCn8Pvh273hY+IbPCZ1i0wz9fPSGzwufutGTq+28kZFb4rLCWXPv+GwmZFT7fsCX5iNnIfkBCZvU7zkr9WhIyK3yOdEu84xopmTXpOHfwTktIyax8hG7WmRbvslEpmXXZsVbv7KBfh1lh4597vovZkECzOhqsDUAyWNzruIX3mtXpyHYAouRp0G0L722zOs/0PIgGi6e+FHszvL1hxyPbXnqSdijGcgNeLY67TCS2A8IXmNkpW/jOGi3vJD2R2A4QjawXPyp0NUrj/c27658BvCzih46sTzrtji69TaJIbAeYF/e1cN2p2hNvvRWJ7YBFZQkdWS/Wzp91KMWZmYjEdsBUkjsVy364X99oS9/ffYjEdkDoqofrR3fzv93zN98ysfHxjuVWyAczu2niT/xZnExsfB6Irr5IHrqoWsWpj13HyMTGZ0+W6BVvJBg/frUZPw38DZJQbHR2ZVl5saLMcCaN89RTovg6ljstEYqNjjQrz/NSea51cjBz7s8rlufBs+NHCD9B36VYUVyUZ42UHxvnOxkMXZ9NLj/HOXNHF4qNzlhWU5Yf7B05DnravJ55Y+eYgzkdBN1hQrHRuQzohdYpq5b9i9G9qeGfv+gZrB/VLt/t9nV0UrGxKR5hmt9/trQMy6plua2yr413St6NWib4ll55Z+9IxcameISpz/fLHtt66NWyH6b1d24m5malXP7C8IH71XwU73OUWGxsSqnri+lkXze/+Llktf5O/cqz00mxx2rWXaGXFY/noUIrVguxkflpeRlvP198f/Lq44u5fmv81Yek51d+W17hh9MXq+0Os+64OHt+Nd+YVcqEpLpisZFZX3vo7r+7dMIe/4dKicG7oydHR++q29xmFeVqf4es6S0XGxnDdXjif2Mu4TKrufZFHXv3upnYuPTk8cfmIg6zdnbq8+3rhC0F2EJsXH4Wx8/cV27OEP7r/M6x7Vvcm4uNi/kWccd33Ym2lYsai/a08KqV2Kg0FmoKiG+tJ28d6/lZCwmW42wjNir9bxvhD0byMh6rdipZ1XqhWddi43JT/X/VMkcz71/UNA/P/B8Kz06/qlvVTOo7EBuVLM/u5lycha6M2T9dFho+CS51l4qWOdbw4mWbD7G3EhuZbP4V+Svhvym7mn96Xvq/zRZftb8SlqqcoY1YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgLb8H3QPzteiUZ6mAAAAAElFTkSuQmCCDQotLS0tLS0tLS0tLS0tUnVieU11bHRpcGFydFBvc3QtNzYxYTllMjNmOTk3MjZjMzYwODJlNzZiMzRkYjBiYTAtLQ0K + headers: + Accept: + - application/json + Content-Type: + - multipart/form-data; boundary=-----------RubyMultipartPost-761a9e23f99726c36082e76b34db0ba0 + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Content-Length: + - '5010' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 23 Aug 2024 06:24:40 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.192' + X-B3-Traceid: + - 4e354363500d84a9d2558ccaa270f669 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "images" : [ { + "position" : 1, + "width" : 600, + "height" : 400, + "_id" : "c86a1d01-0efa-4af5-ae5e-12a9611f4cdd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/c86a1d01-0efa-4af5-ae5e-12a9611f4cdd" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image2.png?hash=69edee39d8acbbb605eb5116c46c3a2eb6b2429f{&width,height,upscale}", + "templated" : true + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/c86a1d01-0efa-4af5-ae5e-12a9611f4cdd" + } + } + }, { + "position" : 2, + "width" : 600, + "height" : 400, + "_id" : "3185b7d0-f27a-482f-85a7-cbbfaa82a114", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/3185b7d0-f27a-482f-85a7-cbbfaa82a114" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image3.png?hash=8eceffd9d90ca05a409de389a7c33669167eb423{&width,height,upscale}", + "templated" : true + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/products/4bf6d53d-dfb2-4468-b6f9-f6e6265bc0bc/images/3185b7d0-f27a-482f-85a7-cbbfaa82a114" + } + } + } ] + } + } + recorded_at: Fri, 23 Aug 2024 06:24:40 GMT +recorded_with: VCR 6.2.0 From 6dc1f65b1e25e82e8c6b111741a62a888a8c0c15 Mon Sep 17 00:00:00 2001 From: citin Date: Tue, 3 Sep 2024 16:40:00 +0200 Subject: [PATCH 51/59] adds services from authentication --- .../services/authentication/email_address.rb | 36 ++++++++ .../services/authentication/signer.rb | 2 +- .../authentication/user_and_password.rb | 92 +++++++++++++++++++ 3 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 lib/beyond_api/services/authentication/email_address.rb create mode 100644 lib/beyond_api/services/authentication/user_and_password.rb diff --git a/lib/beyond_api/services/authentication/email_address.rb b/lib/beyond_api/services/authentication/email_address.rb new file mode 100644 index 0000000..d55d6e2 --- /dev/null +++ b/lib/beyond_api/services/authentication/email_address.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module BeyondApi + module Authentication + # @example How to instantiate a client + # @client = BeyondApi::Authentication::EmailAddress.new( + # api_url: 'https://example.com/api', + # access_token: 'your_token' + # ) + class EmailAddress < BaseService + # Trigger an email address change + # + # @see https://developer.epages.com/beyond-docs/#trigger_email_address_change + # + # @option params [Integer] :user_id + # @option params [String] :locale defines the language of the confirmation email is to be sent. + # @option params [String] :current_password the current password of the user account. + # @option params [String] :new_email the new email address for the user to set. + # + # @example + # @client.trigger_change( + # "9ed8418f-d568-4327-9f20-ec1d00614398", + # "en-US", + # "GoodPassword01!;)", + # "new.email@epages.com" + # ) + def trigger_change(user_id, locale, current_password, new_email) + post( + "users/#{user_id}/change-email-request", + { current_password:, new_email: }, # body + locale # query params + ) + end + end + end +end diff --git a/lib/beyond_api/services/authentication/signer.rb b/lib/beyond_api/services/authentication/signer.rb index ec3704c..21d00eb 100644 --- a/lib/beyond_api/services/authentication/signer.rb +++ b/lib/beyond_api/services/authentication/signer.rb @@ -10,7 +10,7 @@ class Signer < BaseService # @see https://developer.epages.com/beyond-docs/#list_signers # # @return [Hash] - # # + # # @example # @client.all def all diff --git a/lib/beyond_api/services/authentication/user_and_password.rb b/lib/beyond_api/services/authentication/user_and_password.rb new file mode 100644 index 0000000..46e141f --- /dev/null +++ b/lib/beyond_api/services/authentication/user_and_password.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +module BeyondApi + module Authentication + # @example How to instantiate a client + # @client = BeyondApi::Authentication::UserAndPassword.new( + # api_url: 'https://example.com/api', + # access_token: 'your_token' + # ) + class UserAndPassword < BaseService + # Verify a password against the password guidelines. + # + # @see https://developer.epages.com/beyond-docs/#verify_password + # + # @option params [Integer] :user_role the type of user. Can be one of merchant, support, or customer. + # @option params [String] :password the password that needs to be verified. + # + # @example + # @client.verify_password( + # "merchant", + # "ValidPassword!" + # ) + def verify_password(user_role, password) + post( + 'users/verify-password', + { password: }, # body + user_role # query params + ) + end + + # Trigger an email address change + # + # @see https://developer.epages.com/beyond-docs/#change_password + # + # @option params [Integer] :user_id + # @option params [String] :current_password the current password of the user. This is verified before the password change. + # @option params [String] :new_password the new password to set in order to change the password. + # + # @example + # @client.change_password( + # "9ed8418f-d568-4327-9f20-ec1d00614398", + # "GoodPassword01!;)", + # "ValidPassword123" + # ) + def change_password(user_id, current_password, new_password) + post( + "users/#{user_id}/change-password", + { current_password:, new_password: } # body + ) + end + + # Trigger an email address change + # + # @see https://developer.epages.com/beyond-docs/#trigger_password_reset_email + # + # @option params [String] :email the email address of the user account. + # + # @example + # @client.password_reset_email( + # "baxter@example.org" + # ) + def password_reset_email(email) + post( + 'users/reset-password-request', + { email: } # body + ) + end + + # Change the username of a user. + # + # @see https://developer.epages.com/beyond-docs/#change_username + # + # @option params [Integer] :user_id the email address of the user account. + # @option params [String] :current_password The current password of the user. This is verified before the username change. + # @option params [String] :new_username The new username to set in order to change the username. + # + # @example + # @client.change_username( + # "9ed8418f-d568-4327-9f20-ec1d00614398", + # "ValidPassword123", + # "baxter2@example.org" + # ) + def change_username(user_id, current_password, new_username) + post( + "users/#{user_id}/change-username", + { current_password:, new_username: }, # body + user_role # query params + ) + end + end + end +end From e488f0d82da4e2d41fbd107b109392f0463c382c Mon Sep 17 00:00:00 2001 From: citin Date: Wed, 4 Sep 2024 13:18:54 +0200 Subject: [PATCH 52/59] [WIP] add tests --- .env.test.template | 6 ++ .../authentication/email_address_spec.rb | 22 +++++++ .../authentication/user_and_password_spec.rb | 66 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 spec/beyond_api/services/authentication/email_address_spec.rb create mode 100644 spec/beyond_api/services/authentication/user_and_password_spec.rb diff --git a/.env.test.template b/.env.test.template index d7e1ed4..9cfd31b 100644 --- a/.env.test.template +++ b/.env.test.template @@ -1,4 +1,10 @@ API_URL="" + CLIENT_ID="" CLIENT_SECRET="" REFRESH_TOKEN="" + +COCKPIT_USER_ID="" +COCKPIT_USER_NAME="" +COCKPIT_USER_EMAIL="" +COCKPIT_USER_PASSWORD="" diff --git a/spec/beyond_api/services/authentication/email_address_spec.rb b/spec/beyond_api/services/authentication/email_address_spec.rb new file mode 100644 index 0000000..0453358 --- /dev/null +++ b/spec/beyond_api/services/authentication/email_address_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Authentication::EmailAddress, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + let(:user_id) { ENV.fetch('COCKPIT_USER_ID', nil) } + let(:user_email) { ENV.fetch('COCKPIT_USER_EMAIL', nil) } + let(:user_password) { ENV.fetch('COCKPIT_USER_PASSWORD', nil) } + + let(:new_email) { 'team42-new@epages.com' } + + describe '#trigger_change' do + it 'change email address' do + # client.trigger_change(user_id, 'en-US', user_password, new_email) + end + + after do + # # Rollback email address change + # client.trigger_change(user_id, 'en-US', user_password, user_email) + end + end +end diff --git a/spec/beyond_api/services/authentication/user_and_password_spec.rb b/spec/beyond_api/services/authentication/user_and_password_spec.rb new file mode 100644 index 0000000..b3ffe90 --- /dev/null +++ b/spec/beyond_api/services/authentication/user_and_password_spec.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Authentication::UserAndPassword, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + let(:user_id) { ENV.fetch('COCKPIT_USER_ID', nil) } + let(:user_name) { ENV.fetch('COCKPIT_USER_NAME', nil) } + let(:user_email) { ENV.fetch('COCKPIT_USER_EMAIL', nil) } + let(:user_password) { ENV.fetch('COCKPIT_USER_PASSWORD', nil) } + + describe '#verify_password' do + let(:new_password) { 'ValidPassword123' } + + it 'sends a post request with the correct parameters' do + # client.verify_password('merchant', new_password) + end + end + + describe '#change_password' do + let(:new_password) { 'ValidPassword123' } + + it 'sends a post request with the correct parameters' do + # client.change_password( + # user_id, + # user_password, + # new_password + # ) + end + + after do + # # Rollback the password change + # client.change_password( + # user_id, + # new_password, + # user_password + # ) + end + end + + describe '#password_reset_email' do + it 'sends a post request with the correct parameters' do + # client.password_reset_email(user_email) + end + end + + describe '#change_username' do + let(:new_name) { 'test-user' } + + it 'sends a post request with the correct parameters' do + # client.change_username( + # user_id, + # user_password, + # new_name + # ) + end + + after do + # # Rollback the username change + # client.change_username( + # user_id, + # user_password, + # user_name + # ) + end + end +end From 8c70b3fc8ecf5eaf84cc1b3ff1cb134316e7e05a Mon Sep 17 00:00:00 2001 From: citin Date: Fri, 6 Sep 2024 11:06:26 +0200 Subject: [PATCH 53/59] fix dotenv for testing --- Gemfile | 2 ++ Gemfile.lock | 2 +- beyond_api.gemspec | 1 - .../authentication/email_address_spec.rb | 5 ++- .../authentication/user_and_password_spec.rb | 36 +++++++++---------- spec/spec_helper.rb | 2 ++ 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Gemfile b/Gemfile index 6eff208..cb3b7a1 100644 --- a/Gemfile +++ b/Gemfile @@ -17,3 +17,5 @@ group :test do gem 'vcr' gem 'webmock' end + +gem 'dotenv', groups: [:development, :test] diff --git a/Gemfile.lock b/Gemfile.lock index a06e63e..6ec50e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -141,7 +141,7 @@ PLATFORMS DEPENDENCIES beyond_api! bundler (~> 2.0) - dotenv (~> 2.7) + dotenv factory_bot faker (~> 2.2) jwt diff --git a/beyond_api.gemspec b/beyond_api.gemspec index 8948629..2b8e4c0 100644 --- a/beyond_api.gemspec +++ b/beyond_api.gemspec @@ -21,7 +21,6 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 3.3' spec.add_development_dependency 'bundler', '~> 2.0' - spec.add_development_dependency 'dotenv', '~> 2.7' spec.add_development_dependency 'faker', '~> 2.2' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0' diff --git a/spec/beyond_api/services/authentication/email_address_spec.rb b/spec/beyond_api/services/authentication/email_address_spec.rb index 0453358..c213ac6 100644 --- a/spec/beyond_api/services/authentication/email_address_spec.rb +++ b/spec/beyond_api/services/authentication/email_address_spec.rb @@ -10,9 +10,8 @@ let(:new_email) { 'team42-new@epages.com' } describe '#trigger_change' do - it 'change email address' do - # client.trigger_change(user_id, 'en-US', user_password, new_email) - end + # client.trigger_change(user_id, 'en-US', user_password, new_email) + it 'change email address' after do # # Rollback email address change diff --git a/spec/beyond_api/services/authentication/user_and_password_spec.rb b/spec/beyond_api/services/authentication/user_and_password_spec.rb index b3ffe90..248315d 100644 --- a/spec/beyond_api/services/authentication/user_and_password_spec.rb +++ b/spec/beyond_api/services/authentication/user_and_password_spec.rb @@ -11,21 +11,19 @@ describe '#verify_password' do let(:new_password) { 'ValidPassword123' } - it 'sends a post request with the correct parameters' do - # client.verify_password('merchant', new_password) - end + # client.verify_password('merchant', new_password) + it 'sends a post request with the correct parameters' end describe '#change_password' do let(:new_password) { 'ValidPassword123' } - it 'sends a post request with the correct parameters' do - # client.change_password( - # user_id, - # user_password, - # new_password - # ) - end + # client.change_password( + # user_id, + # user_password, + # new_password + # ) + it 'sends a post request with the correct parameters' after do # # Rollback the password change @@ -38,21 +36,19 @@ end describe '#password_reset_email' do - it 'sends a post request with the correct parameters' do - # client.password_reset_email(user_email) - end + # client.password_reset_email(user_email) + it 'sends a post request with the correct parameters' end describe '#change_username' do let(:new_name) { 'test-user' } - it 'sends a post request with the correct parameters' do - # client.change_username( - # user_id, - # user_password, - # new_name - # ) - end + # client.change_username( + # user_id, + # user_password, + # new_name + # ) + it 'sends a post request with the correct parameters' after do # # Rollback the username change diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aa49eab..6550c50 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,8 @@ require 'beyond_api' require 'factory_bot' +Dotenv.load('.env.test') + RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' From fdb7ba51e0e743923cdc392a6d4214e231840437 Mon Sep 17 00:00:00 2001 From: Kathia Date: Mon, 9 Sep 2024 15:10:40 +0200 Subject: [PATCH 54/59] Add customers endpoints (#84) --- lib/beyond_api/services/customer.rb | 155 +++++++ spec/beyond_api/services/customer_spec.rb | 75 ++++ spec/factories/customer_data.rb | 62 +++ .../_all/returns_all_customers.yml | 136 ++++++ .../_create/creates_a_new_customer.yml | 261 +++++++++++ .../_delete/deletes_a_customer.yml | 313 ++++++++++++++ .../returns_all_events_for_a_customer.yml | 345 +++++++++++++++ .../_find/returns_a_customer.yml | 401 +++++++++++++++++ .../_update/updates_an_existing_customer.yml | 405 ++++++++++++++++++ 9 files changed, 2153 insertions(+) create mode 100644 lib/beyond_api/services/customer.rb create mode 100644 spec/beyond_api/services/customer_spec.rb create mode 100644 spec/factories/customer_data.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml diff --git a/lib/beyond_api/services/customer.rb b/lib/beyond_api/services/customer.rb new file mode 100644 index 0000000..b24d626 --- /dev/null +++ b/lib/beyond_api/services/customer.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true + +module BeyondApi + # @example How to instantiate a client + # @client = BeyondApi::Customer.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Customer < BaseService + # Retrieve the details of a customer. + # + # @see https://developer.epages.com/beyond-docs/#show_customer_details + # + # @param id [String] the customer UUID + # + # @return [Hash] + # + # @example + # @client.find('5afcf0ce-4e39-4b4d-88bb-82d5cc07c83a') + def find(id) + get("customers/#{id}") + end + + # List all customers of the shop in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_customers + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + fetch_all_pages('customers', params) + end + + # Create a `COCKPIT` customer. + # + # @see https://developer.epages.com/beyond-docs/#create_customer + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # customer_data = { + # billing_address: { + # gender: "FEMALE", + # company: "Astrid Alster GmbH", + # first_name: "Astrid", + # last_name: "Alster", + # street: "Alsterwasserweg", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.alsterh@example.com", + # phone: "(800) 555-0102" + # }, + # email: "a.alsterh@example.com", + # customer_comment: "A reliable customer", + # shipping_address: { + # company: "ePages GmbH", + # first_name: "Chayanne", + # last_name: "Team42", + # street: "Pilatuspool", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.chayanne@example.com", + # phone: "(800) 555-0102" + # } + # } + # @client.create(customer_data) + def create(body) + post('customers', body) + end + + # Update a customer. + # + # @see https://developer.epages.com/beyond-docs/#update_customer + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # customer_data = { + # billing_address: { + # company: "ePages GmbH", + # first_name: "Chayanne", + # last_name: "Team42", + # street: "Pilatuspool", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.chayanne@example.com", + # phone: "(800) 555-0102" + # }, + # email: "a.alsterh@example.com", + # customer_comment: "A reliable customer", + # shipping_address: { + # gender: "FEMALE", + # company: "Astrid Alster GmbH", + # first_name: "Astrid", + # last_name: "Alster", + # street: "Alsterwasserweg", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.alsterh@example.com", + # phone: "(800) 555-0102" + # } + # } + # @client.update('2bdc787e-4643-4eeb-babf-06bc1d4b1c1b', customer_data) + def update(id, body) + put("customers/#{id}", body) + end + + # Delete a customer. + # + # @see https://developer.epages.com/beyond-docs/#delete_customer + # + # @param id [String] the customer UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('71b62b1d-271a-4b56-9514-77b79f8e910a') + def delete(id) + super("customers/#{id}") # Concerns::Connection delete method + end + + # List all events of a customer. + # + # @see https://developer.epages.com/beyond-docs/#list_customer_events + # + # @param id [String] the customer UUID + # + # @return [Hash] + # + # @example + # @client.events('df184f00-2367-417f-bc23-c7f927dbf636') + def events(id) + get("customers/#{id}/events") + end + end +end diff --git a/spec/beyond_api/services/customer_spec.rb b/spec/beyond_api/services/customer_spec.rb new file mode 100644 index 0000000..de27bbb --- /dev/null +++ b/spec/beyond_api/services/customer_spec.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Customer, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all customers' do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :customers)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + context 'with customer' do + before(:each) do + @customer = client.create(build(:customer_data)) + end + + describe '.create' do + it 'creates a new customer' do + expect(@customer).not_to be nil + expect(@customer.dig(:default_billing_address, :company)).to eq('ePages GmbH') + expect(@customer.dig(:default_billing_address, :first_name)).to eq('Chayanne') + expect(@customer.dig(:default_billing_address, :last_name)).to eq('Team42') + expect(@customer.dig(:default_billing_address, :street)).to eq('Pilatuspool') + expect(@customer.dig(:default_billing_address, :house_number)).to eq('2') + expect(@customer.dig(:default_billing_address, :postal_code)).to eq('20999') + expect(@customer.dig(:default_billing_address, :city)).to eq('Alsterwasser') + expect(@customer.dig(:default_billing_address, :country)).to eq('DE') + expect(@customer.dig(:default_billing_address, :state)).to eq('Hamburg') + expect(@customer.dig(:default_billing_address, :email)).to eq('chayanne@example.com') + expect(@customer.dig(:default_billing_address, :phone)).to eq('(800) 555-0102') + end + end + + describe '.find' do + it 'returns a customer' do + response = client.find(@customer[:id]) + expect(response.dig(:default_billing_address, :first_name)).to eq('Chayanne') + end + end + + describe '.update' do + it 'updates an existing customer' do + updated_customer_data = FactoryBot.build(:customer_data, :berlin_shipping) + + updated_customer = client.update(@customer[:id], updated_customer_data) + expect(updated_customer).not_to be nil + expect(updated_customer.dig(:default_shipping_address, :company)).to eq('Updated GmbH') + end + end + + describe '.events' do + it 'returns all events for a customer' do + response = client.events(@customer[:id]) + expect(response).not_to be nil + expect(response.dig(:embedded, :customer_events)).to be_kind_of(Array) + end + end + + describe '.delete' do + it 'deletes a customer' do + response = client.delete(@customer[:id]) + expect(response).to eq({}) + end + end + + after(:each) do + client.delete(@customer[:id]) + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + end +end diff --git a/spec/factories/customer_data.rb b/spec/factories/customer_data.rb new file mode 100644 index 0000000..abbc1c1 --- /dev/null +++ b/spec/factories/customer_data.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :customer_data, class: Hash do + email { 'chayanne@example.com' } + customer_comment { 'A reliable customer' } + + billing_address do + { + company: 'ePages GmbH', + first_name: 'Chayanne', + last_name: 'Team42', + street: 'Pilatuspool', + house_number: '2', + postal_code: '20999', + city: 'Alsterwasser', + country: 'DE', + state: 'Hamburg', + email: 'chayanne@example.com', + phone: '(800) 555-0102' + } + end + + shipping_address do + { + gender: 'FEMALE', + company: 'Astrid Alster GmbH', + first_name: 'Astrid', + last_name: 'Alster', + street: 'Alsterwasserweg', + house_number: '2', + postal_code: '20999', + city: 'Alsterwasser', + country: 'DE', + state: 'Hamburg', + email: 'alsterh@example.com', + phone: '(800) 555-0102' + } + end + + trait :berlin_shipping do + shipping_address do + { + gender: 'FEMALE', + company: 'Updated GmbH', + first_name: 'Astrid', + last_name: 'Alster', + street: 'Berlin Street', + house_number: '42', + postal_code: '12345', + city: 'Berlin', + country: 'DE', + state: 'Berlin', + email: 'alsterh@example.com', + phone: '(800) 555-0102' + } + end + end + + initialize_with { attributes } + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml b/spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml new file mode 100644 index 0000000..ad477b4 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.107' + X-B3-Traceid: + - 2ac530d347565da9f565d6df651e5d0c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608085, + "jti" : "WlwVZBu3mn6PxSlPXI2D8alxDgQ=" + } + recorded_at: Fri, 06 Sep 2024 07:34:45 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.079' + X-B3-Traceid: + - c080a1385acada6b51c2d311182fc97e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "customers" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Fri, 06 Sep 2024 07:34:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml new file mode 100644 index 0000000..6b406c8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml @@ -0,0 +1,261 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.100' + X-B3-Traceid: + - b03f9c28b22caaf7867420fe8b952e04 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608086, + "jti" : "G56YpddqUZJ6AD68z6ARhvLq9w4=" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.137' + X-B3-Traceid: + - c27da866a2b8e4fad235976d33b6ac0b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1008", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:46.29413293", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91/customer-groups" + } + }, + "_id" : "1877de01-eba4-4e42-805b-3408ff375b91" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.058' + X-B3-Traceid: + - 19cade8642609c0f079d8016af1c0347 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml new file mode 100644 index 0000000..4e292f8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml @@ -0,0 +1,313 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.083' + X-B3-Traceid: + - 4dc97a749e07e9c38bcba51d9995d655 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608088, + "jti" : "dYRgDKfN8buk+vVRIqFfoTSk1Zw=" + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.081' + X-B3-Traceid: + - 121adc793826d2464816c0e7534ddd89 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1012", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:48.73401719", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8/customer-groups" + } + }, + "_id" : "00abc7e5-f708-4609-9f6c-b92406c2b2f8" + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - 3cc80114aadd012741905cfc2e83f882 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.013' + X-B3-Traceid: + - f22d2ee2da14b08c9d68b8ddcdbd9b1e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml new file mode 100644 index 0000000..83acfbf --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml @@ -0,0 +1,345 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.093' + X-B3-Traceid: + - 9a2f316a96cb4e0ff1958053e01a71f3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608087, + "jti" : "mZTHMuKS0YHRRj6b8bPgAll0z08=" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.088' + X-B3-Traceid: + - d1b2c78fc9d65f14d4ed54a9e3f9ee84 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1011", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:48.128473616", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/customer-groups" + } + }, + "_id" : "fe4e14cf-06ed-43d0-86ba-b0ff40e579f1" + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/events + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - cf48748a0e1f8682193ef0112de0e412 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "customer-events" : [ { + "type" : "customer-comment-created", + "comment" : "A reliable customer", + "eventTimestamp" : "2024-09-06T07:34:48.154", + "details" : { }, + "triggeredBy" : "merchant" + }, { + "type" : "customer-created", + "comment" : null, + "eventTimestamp" : "2024-09-06T07:34:48.128", + "details" : { + "origin" : "COCKPIT" + }, + "triggeredBy" : "merchant" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/events?page=0&size=20&sort=eventTimestamp,desc" + } + }, + "page" : { + "size" : 20, + "totalElements" : 2, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.045' + X-B3-Traceid: + - 352c8beb5134c286377074729c4cb0ce + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml new file mode 100644 index 0000000..fe9e6ee --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml @@ -0,0 +1,401 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.086' + X-B3-Traceid: + - 5a26da8fcc9624a47a9a57868740fab7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608086, + "jti" : "ehrm8T60HaqIVDmHOTJqnIcxJjI=" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.082' + X-B3-Traceid: + - 449c5bdc4ef74a1acc5382fb22f940dc + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1009", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:46.820923909", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/customer-groups" + } + }, + "_id" : "f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - e2305f5a6f5cd0d68f001c651eec32d9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1009", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:46.821", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/customer-groups" + } + }, + "_id" : "f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.077' + X-B3-Traceid: + - cd16a546b3bbea02d2b3c938bb0cf041 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml new file mode 100644 index 0000000..68e1de8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml @@ -0,0 +1,405 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - daf221371168badd6c37feb412fd2b4d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608087, + "jti" : "ZTEKBBs76N9cpZnst22rXtXINiE=" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - 66c66daa14fb3f20f4a94f206fa4ed12 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1010", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:47.474604165", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/customer-groups" + } + }, + "_id" : "327dbf86-bcca-49b4-97b7-45853f684b49" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49 + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Updated GmbH","firstName":"Astrid","lastName":"Alster","street":"Berlin + Street","houseNumber":"42","postalCode":"12345","city":"Berlin","country":"DE","state":"Berlin","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.069' + X-B3-Traceid: + - 7872fda102ff05d8bf687043381d5e2b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1010", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Updated GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Berlin Street", + "houseNumber" : "42", + "street2" : null, + "addressExtension" : null, + "postalCode" : "12345", + "dependentLocality" : null, + "city" : "Berlin", + "country" : "DE", + "state" : "Berlin", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Updated GmbH", "Astrid Alster", "Berlin Street 42", "12345 Berlin", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:47.475", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/customer-groups" + } + }, + "_id" : "327dbf86-bcca-49b4-97b7-45853f684b49" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - '0950a5bd9ab975cdf726fdf3636f67ae' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +recorded_with: VCR 6.2.0 From dc83c3da806e6057da31106d11e45da5e5ac3907 Mon Sep 17 00:00:00 2001 From: Kathia Date: Thu, 3 Oct 2024 10:20:39 +0200 Subject: [PATCH 55/59] EPT-2966 Add carts endpoints (#85) * Add carts endpoints * Add cart tests * Use factories --- lib/beyond_api/services/checkout/cart.rb | 476 +++++++++++++++++ .../beyond_api/services/checkout/cart_spec.rb | 121 +++++ spec/factories/address_data.rb | 30 ++ spec/factories/payment_data.rb | 18 + ...s_the_current_payment_method_of_a_cart.yml | 482 ++++++++++++++++++ ..._the_current_pickup_option_of_the_cart.yml | 350 +++++++++++++ ...he_current_shipping_method_of_the_cart.yml | 356 +++++++++++++ ..._to_the_current_default_payment_method.yml | 454 +++++++++++++++++ ...to_the_current_default_shipping_method.yml | 454 +++++++++++++++++ .../sets_the_billing_address_of_the_cart.yml | 479 +++++++++++++++++ .../with_cart/_create/creates_a_new_cart.yml | 286 +++++++++++ .../initiates_the_creation_of_a_payment.yml | 346 +++++++++++++ ...on_of_a_payment_and_order_for_the_cart.yml | 348 +++++++++++++ .../with_cart/_delete/deletes_a_cart.yml | 336 ++++++++++++ .../removes_a_coupon_from_the_cart.yml | 346 +++++++++++++ .../_find/retrieves_the_details_of_a_cart.yml | 454 +++++++++++++++++ ...e_payment_methods_for_the_current_cart.yml | 482 ++++++++++++++++++ ...le_pickup_options_for_the_current_cart.yml | 350 +++++++++++++ .../_redeem_coupon/redeems_a_coupon.yml | 346 +++++++++++++ .../sets_the_shipping_address_of_the_cart.yml | 477 +++++++++++++++++ 20 files changed, 6991 insertions(+) create mode 100644 lib/beyond_api/services/checkout/cart.rb create mode 100644 spec/beyond_api/services/checkout/cart_spec.rb create mode 100644 spec/factories/address_data.rb create mode 100644 spec/factories/payment_data.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_payment_method/sets_the_current_payment_method_of_a_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_pickup_option/sets_the_current_pickup_option_of_the_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_shipping_method/sets_the_current_shipping_method_of_the_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_payment_method_to_default/sets_the_cart_payment_method_to_the_current_default_payment_method.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_shipping_method_to_default/sets_the_cart_shipping_method_to_the_current_default_shipping_method.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_billing_address/sets_the_billing_address_of_the_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create/creates_a_new_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment/initiates_the_creation_of_a_payment.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment_and_order/initiates_the_creation_of_a_payment_and_order_for_the_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete/deletes_a_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete_coupon/removes_a_coupon_from_the_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_find/retrieves_the_details_of_a_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_payment_methods/lists_all_applicable_payment_methods_for_the_current_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_pickup_options/lists_all_applicable_pickup_options_for_the_current_cart.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_redeem_coupon/redeems_a_coupon.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_shipping_address/sets_the_shipping_address_of_the_cart.yml diff --git a/lib/beyond_api/services/checkout/cart.rb b/lib/beyond_api/services/checkout/cart.rb new file mode 100644 index 0000000..16e87e9 --- /dev/null +++ b/lib/beyond_api/services/checkout/cart.rb @@ -0,0 +1,476 @@ +# frozen_string_literal: true + +module BeyondApi + module Checkout + # @example How to instantiate a client + # @client = BeyondApi::Checkout::Cart.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Cart < BaseService + # Create a cart. + # + # @see https://developer.epages.com/beyond-docs/#create_cart + # + # @return [Hash] + # + # @example + # @client.create + def create + post('carts') + end + + # Retrieve the details of a cart. + # + # @see https://developer.epages.com/beyond-docs/#show_cart_details + # + # @param id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.find('1b9ab4a0-c1c4-4373-b35d-ee36e004e860') + def find(id) + get("carts/#{id}") + end + + # Remove a cart. + # + # @see https://developer.epages.com/beyond-docs/#delete_cart + # + # @param id [String] the cart UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('c4368b98-d291-45b9-815c-eb5e835ea07d') + def delete(id) + super("carts/#{id}") + end + + # Create order from cart. + # + # @see https://developer.epages.com/beyond-docs/#create_order_from_cart + # + # @param id [String] the cart UUID + # @param body [Hash] the order data + # + # @return [Hash] + # + # @example + # body = { + # customer_comment: 'Please send with UPS.', + # sales_channel: 'Storefront', + # marketing_channel: 'Google Shopping', + # marketing_subchannel: 'Summer Sale', + # test_order: false, + # terms_and_conditions_explicitly_accepted: true + # } + # @client.create_order_from('bbfe107a-4583-44b0-afc8-f09e7c679996') + def create_order_from(id, body) + post("carts/#{id}/order", body) + end + + # Add a line item to the cart. Currently only product line items are supported. + # + # @see https://developer.epages.com/beyond-docs/#add_single_line_item_to_cart + # + # @param id [String] the cart UUID + # @param body [Hash] the order data + # @param body [Hash] the line item data + # + # @return [Hash] + # + # @example + # body = { + # _type: "PRODUCT", + # _ref: "068a0635-7a4a-435b-82d4-479112319b22", + # quantity: 1, + # custom_text: "John Doe" + # } + # @client.add_line_item('98db82a0-d5b8-458d-95d1-6f6cd7467320', body) + def add_line_item(id, body) + post("carts/#{id}/line-items", body) + end + + # Replace only one item in the cart. + # + # @see https://developer.epages.com/beyond-docs/#replace_single_line_item + # + # @param cart_id [String] the cart UUID + # @param line_item_id [String] the line item UUID + # @param body [Hash] the line item data + # + # @return [Hash] + # + # @example + # body = { + # _type: "PRODUCT", + # _ref: "61aeebfb-68c7-4bab-a460-64234f48c99b", + # quantity: 2 + # } + # @client.replace_line_item('a64545e4-b06e-4067-aa6a-5aa1124990fa', + # '86c72e9b-1db2-4ce0-966f-67ecbca71a7d', body) + def replace_line_item(cart_id, line_item_id, body) + put("carts/#{cart_id}/line-items/#{line_item_id}", body) + end + + # Delete a line item from the cart. + # + # @see https://developer.epages.com/beyond-docs/#delete_line_item + # + # @param cart_id [String] the cart UUID + # @param line_item_id [String] the line item UUID + # + # @return [Hash] + # + # @example + # @client.delete_line_item('7c109d12-6598-4150-810c-24006e8e6780', + # 'fb459c80-b745-46f6-83ae-f533236c9f26') + def delete_line_item(cart_id, line_item_id) + super("carts/#{cart_id}/line-items/#{line_item_id}") + end + + # Set the billing address of the cart. The billing address is mandatory for a cart being ready to order. + # + # @see https://developer.epages.com/beyond-docs/#set_cart_billing_address + # + # @param cart_id [String] the cart UUID + # @param body [Hash] the billing address data + # + # @return [Hash] + # + # @example + # body = { + # customer_data = { + # salutation: 'Mrs', + # gender: 'FEMALE', + # title: 'Dr', + # first_name: 'Astrid', + # middle_name: 'Agnes', + # last_name: 'Alster', + # street: 'Alsterwasserweg', + # house_number: '2', + # street2: 'Erdgeschoss', + # door_code: '0185', + # address_extension: 'Hinterhof', + # postal_code: '20999', + # dependent_locality: 'Seevetal', + # city: 'Alsterwasser', + # country: 'DE', + # state: 'Hamburg', + # email: 'a.alsterh@example.com', + # phone: '(800) 555-0102', + # mobile: '(800) 555-0103', + # vat_id: '123456789', + # tax_number: '123-34-6789', + # birth_date: '1985-03-20' + # } + # @client.billing_address('f1209f49-e225-4840-8897-2cf0d59268ef', body) + def billing_address(cart_id, body) + put("carts/#{cart_id}/billing-address", body) + end + + # Set the shipping address of the cart. If no shipping address is set and no pickup line item is available, it will default to the billing address. + # + # @see https://developer.epages.com/beyond-docs/#set_cart_shipping_address + # + # @param cart_id [String] the cart UUID + # @param body [Hash] the shipping address data + # + # @return [Hash] + # + # @example + # body = { + # customer_data = { + # salutation: 'Mrs', + # gender: 'FEMALE', + # title: 'Dr', + # first_name: 'Astrid', + # middle_name: 'Agnes', + # last_name: 'Alster', + # street: 'Alsterwasserweg', + # house_number: '2', + # street2: 'Erdgeschoss', + # door_code: '0185', + # address_extension: 'Hinterhof', + # postal_code: '20999', + # dependent_locality: 'Seevetal', + # city: 'Alsterwasser', + # country: 'DE', + # state: 'Hamburg', + # email: 'a.alsterh@example.com', + # phone: '(800) 555-0102', + # mobile: '(800) 555-0103', + # vat_id: '123456789', + # tax_number: '123-34-6789', + # birth_date: '1985-03-20' + # } + # @client.shipping_address('f1209f49-e225-4840-8897-2cf0d59268ef', body) + def shipping_address(cart_id, body) + put("carts/#{cart_id}/shipping-address", body) + end + + # Remove the shipping address of the cart. After deletion, the shipping address will default to the billing address. + # + # @see https://developer.epages.com/beyond-docs/#remove_cart_shipping_address + # + # @param id [String] the cart UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete_shipping_address('4aef7525-0742-4a0d-9285-dee00693fd1a') + def delete_shipping_address(id) + super("carts/#{id}/shipping-address") + end + + # List all applicable payment methods for the current cart. + # + # @see https://developer.epages.com/beyond-docs/#list_applicable_payment_methods_for_current_cart + # + # @param id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.payment_methods('e4ab6de8-9877-4552-9c6b-0544ee769f6f') + def payment_methods(id) + get("carts/#{id}/payment-methods") + end + + # Set the current payment method of a cart. + # + # @see https://developer.epages.com/beyond-docs/#set_current_cart_payment_method + # + # @param cart_id [String] the cart UUID + # @param payment_method_id [Array] the payment method id + # + # @return [Hash] + # + # @example + # @client.assign_current_payment_method('f5945d59-9d0e-4ecc-818a-6cdbfd772ae2', + # '5f9c32c4-8598-4510-a468-33d156a3570f') + def assign_current_payment_method(cart_id, payment_method_id) + body = "#{@session.api_url}/payment-methods/#{payment_method_id}" + put("carts/#{cart_id}/payment-methods/current", body) + end + + # Set the cart payment method to the current default payment method. + # + # @see https://developer.epages.com/beyond-docs/#set_cart_payment_method_to_current_default + # + # @param cart_id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.assign_payment_method_to_default('ce1f18a0-bae9-4807-bf12-964d2ad02c1c') + def assign_payment_method_to_default(cart_id) + put("carts/#{cart_id}/payment-methods/default") + end + + # Retrieve the details of the current payment method of a cart. + # + # @see https://developer.epages.com/beyond-docs/#show_current_cart_payment_method_details + # + # @param id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.payment_method('be513bae-f515-4ec4-a430-ee070f398f56') + def payment_method(id) + get("carts/#{id}/payment-methods/current") + end + + # Initiate the creation of a payment. + # + # @see https://developer.epages.com/beyond-docs/#create_payment + # + # @param id [String] the cart UUID + # @param body [Hash] the payment data + # + # @return [Hash] + # + # @example + # body = { + # return_uri: 'https://example.com/return', + # cancel_uri: 'https://example.com/cancel', + # } + # @client.create_payment('0fd2455e-f9a0-4180-b26a-032837c13ab1', body) + def create_payment(id, body) + post("carts/#{id}/create-payment", body) + end + + # Initiate the creation of a payment and order for the cart. + # + # @see https://developer.epages.com/beyond-docs/#create_payment_and_order + # + # @param id [String] the cart UUID + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # body = { + # return_uri: 'https://example.com/return', + # cancel_uri: 'https://example.com/cancel', + # customer_comment: 'Please send with UPS.', + # sales_channel: 'Storefront', + # marketing_channel: 'Google Shopping', + # marketing_subchannel: 'Summer Sale', + # test_order: false, + # terms_and_conditions_explicitly_accepted: true + # } + # @client.create_payment('0fd2455e-f9a0-4180-b26a-032837c13ab1', body) + def create_payment_and_order(id, body) + post("carts/#{id}/create-payment", body) + end + + # Set the current shipping method of the cart. + # + # @see https://developer.epages.com/beyond-docs/#set_current_cart_shipping_method + # + # @param cart_id [String] the cart UUID + # @param shipping_zone_id [String] the shipping zone UUID + # @param shipping_method_id [String] the shipping method UUID + # + # @return [Hash] + # + # @example + # @client.assign_current_shipping_method('d806c45a-c799-493a-8d91-57c51e6adc2c' + # 'bd5be855-24d9-4f38-9469-4089c0083c87', + # 'a12e4246-0b72-4ac4-943d-79ab792965dd') + def assign_current_shipping_method(cart_id, shipping_zone_id, shipping_method_id) + body = "#{@session.api_url}/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}" + put("carts/#{cart_id}/shipping-methods", body) + end + + # Set the cart shipping method to the current default shipping method. + # + # @see https://developer.epages.com/beyond-docs/#set_cart_shipping_method_to_current_default + # + # @param cart_id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.assign_shipping_method_to_default('0295ce92-9604-46b7-a995-608f9c966753') + def assign_shipping_method_to_default(cart_id) + put("carts/#{cart_id}/payment-methods/default") + end + + # Retrieve the details of the current shipping method of a cart. + # + # @see https://developer.epages.com/beyond-docs/#show_current_cart_shipping_method_details + # + # @param id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.shipping_method('fd54acab-bc23-4d81-bef2-77c8f3150a3b') + def shipping_method(id) + get("carts/#{id}/shipping-methods/current") + end + + # List all countries that are assigned to at least one shipping zone of the shop. Orders can only be shipped to such servicable countries. + # + # @see https://developer.epages.com/beyond-docs/#find_serviceable_countries + # + # @return [Hash] + # + # @example + # @client.serviceable_countries + def serviceable_countries + get('shipping-zones/search/find-all-serviceable-countries') + end + + # List all applicable pickup options for the current cart. + # + # @see https://developer.epages.com/beyond-docs/#list_applicable_pickup_options_for_current_cart + # + # @param id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.pickup_options('00954827-a00a-444e-beba-26ea3ffaf4db') + def pickup_options(id) + get("carts/#{id}/pickup-options") + end + + # Set the current pickup option of the cart. + # + # @see https://developer.epages.com/beyond-docs/#set_current_cart_pickup_option + # + # @param cart_id [String] the cart UUID + # @param pickup_option_id [String] the pickup option UUID + # + # @return [Hash] + # + # @example + # @client.assign_current_pickup_option('6d16f50b-a0f9-4797-b524-77ade8d2c14b', + # '7bb761bf-5bab-4baa-8e9d-0c86491e0850') + def assign_current_pickup_option(cart_id, pickup_option_id) + body = "#{@session.api_url}/pickup-options/#{pickup_option_id}" + put("carts/#{cart_id}/pickup-options/current", body) + end + + # Retrieve the details of the current pickup option of a cart. + # + # @see https://developer.epages.com/beyond-docs/#show_current_cart_pickup_option_details + # + # @param id [String] the cart UUID + # + # @return [Hash] + # + # @example + # @client.current_pickup_option('53e4e9d3-54d2-4eb8-ba6c-346d665d71ae') + def pickup_option(id) + get("carts/#{id}/pickup-options/current") + end + + # Remove the current pickup option from the cart. + # + # @see https://developer.epages.com/beyond-docs/#remove_current_cart_pickup_option + # + # @param id [String] the cart UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('c6d3a1e8-db98-412a-a4ca-0489d0e210f5') + def delete_current_pickup_option(id) + super("carts/#{id}/pickup-options/current") + end + + # Redeem a coupon. + # + # @see https://developer.epages.com/beyond-docs/#redeem_coupon + # + # @param id [String] the cart UUID + # @param coupon_code [String] the coupon codee + # + # @return [Hash] + # + # @example + # @client.redeem_coupon('5667fb86-69ec-4b9c-97b4-293c5132309c', 'FIRST-ORDER') + def redeem_coupon(id, coupon_code) + post("carts/#{id}/coupon", { code: coupon_code }) + end + + # Remove the current pickup option from the cart. + # + # @see https://developer.epages.com/beyond-docs/#remove_coupon_from_cart + # + # @param id [String] the cart UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('7563919e-5b00-4300-bb59-7f7cbf35f01f') + def delete_coupon(id) + super("carts/#{id}/coupon") + end + end + end +end diff --git a/spec/beyond_api/services/checkout/cart_spec.rb b/spec/beyond_api/services/checkout/cart_spec.rb new file mode 100644 index 0000000..cccb127 --- /dev/null +++ b/spec/beyond_api/services/checkout/cart_spec.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Checkout::Cart, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + context 'with cart' do + before(:each) do + @cart = client.create + end + + describe '.create' do + it 'creates a new cart' do + expect(@cart).not_to be nil + expect(@cart[:id]).to be_kind_of(String) + end + end + + describe '.find' do + it 'retrieves the details of a cart' do + cart_details = client.find(@cart[:id]) + expect(cart_details).not_to be nil + expect(cart_details[:id]).to eq(@cart[:id]) + end + end + + describe '.billing_address' do + it 'sets the billing address of the cart' do + body = build(:address_data) + billing_address = client.billing_address(@cart[:id], body) + expect(billing_address).not_to be nil + expect(billing_address[:billing_address][:first_name]).to eq(body[:first_name]) + end + end + + describe '.shipping_address' do + it 'sets the shipping address of the cart' do + body = build(:address_data) + shipping_address = client.shipping_address(@cart[:id], body) + expect(shipping_address).not_to be nil + expect(shipping_address[:shipping_address][:first_name]).to eq(body[:first_name]) + end + end + + describe '.payment_methods' do + it 'lists all applicable payment methods for the current cart' do + response = client.payment_methods(@cart[:id]) + expect(response).not_to be nil + expect(response.dig(:embedded, :payment_methods)).to be_an(Array) + end + end + + describe '.assign_payment_method_to_default' do + it 'sets the cart payment method to the current default payment method' do + response = client.assign_payment_method_to_default(@cart[:id]) + expect(response).not_to be nil + end + end + + describe '.create_payment' do + it 'initiates the creation of a payment' do + body = { + return_uri: 'https://example.com/return', + cancel_uri: 'https://example.com/cancel' + } + # There is no payment method definition associated with this payment method + expect { client.create_payment(@cart[:id], body) }.to raise_error(BeyondApi::Error) + end + end + + describe '.create_payment_and_order' do + it 'initiates the creation of a payment and order for the cart' do + body = build(:payment_data) + # There is no payment method definition associated with this payment method + expect { client.create_payment_and_order(@cart[:id], body) }.to raise_error(BeyondApi::Error) + end + end + + describe '.assign_shipping_method_to_default' do + it 'sets the cart shipping method to the current default shipping method' do + response = client.assign_shipping_method_to_default(@cart[:id]) + expect(response).not_to be nil + end + end + + describe '.pickup_options' do + it 'lists all applicable pickup options for the current cart' do + response = client.pickup_options(@cart[:id]) + expect(response).not_to be nil + expect(response.dig(:embedded, :pickup_options)).to be_an(Array) + end + end + + describe '.redeem_coupon' do + it 'redeems a coupon' do + coupon_code = 'FIRST-ORDER' + # The coupon code validation failed with following messages: Code doesn't exist + expect { client.redeem_coupon(@cart[:id], coupon_code) }.to raise_error(BeyondApi::Error) + end + end + + describe '.delete_coupon' do + it 'removes a coupon from the cart' do + coupon_code = 'FIRST-ORDER' + # The coupon code validation failed with following messages: Code doesn't exist + expect { client.redeem_coupon(@cart[:id], coupon_code) } .to raise_error(BeyondApi::Error) + end + end + + describe '.delete' do + it 'deletes a cart' do + response = client.delete(@cart[:id]) + expect(response).to eq({}) + end + end + + after(:each) do + client.delete(@cart[:id]) + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + end +end diff --git a/spec/factories/address_data.rb b/spec/factories/address_data.rb new file mode 100644 index 0000000..d5760b5 --- /dev/null +++ b/spec/factories/address_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :address_data, class: Hash do + salutation { 'Mrs' } + gender { 'FEMALE' } + title { 'Dr' } + first_name { 'Astrid' } + middle_name { 'Agnes' } + last_name { 'Alster' } + street { 'Alsterwasserweg' } + house_number { '2' } + street2 { 'Erdgeschoss' } + door_code { '0185' } + address_extension { 'Hinterhof' } + postal_code { '20999' } + dependent_locality { 'Seevetal' } + city { 'Alsterwasser' } + country { 'DE' } + state { 'Hamburg' } + email { 'a.alsterh@example.com' } + phone { '(800) 555-0102' } + mobile { '(800) 555-0103' } + vat_id { '123456789' } + tax_number { '123-34-6789' } + birth_date { '1985-03-20' } + + initialize_with { attributes } + end +end diff --git a/spec/factories/payment_data.rb b/spec/factories/payment_data.rb new file mode 100644 index 0000000..7282d12 --- /dev/null +++ b/spec/factories/payment_data.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :payment_data, class: Hash do + initialize_with { + { + return_uri: 'https://example.com/return', + cancel_uri: 'https://example.com/cancel', + customer_comment: 'Please send with UPS.', + sales_channel: 'Storefront', + marketing_channel: 'Google Shopping', + marketing_subchannel: 'Summer Sale', + test_order: false, + terms_and_conditions_explicitly_accepted: true + } + } + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_payment_method/sets_the_current_payment_method_of_a_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_payment_method/sets_the_current_payment_method_of_a_cart.yml new file mode 100644 index 0000000..24cb679 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_payment_method/sets_the_current_payment_method_of_a_cart.yml @@ -0,0 +1,482 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:04:38 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - 77f0257a5ccfbc4c32587f233fae302b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813078, + "jti" : "6M7nLBHzrTav8bpe8UCgNnPbA8s=" + } + recorded_at: Tue, 01 Oct 2024 20:04:38 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:04:38 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - dcaa001f17275403d751969870620c95 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "b32c12fe-da0a-4100-b0bb-21c35a2233ce", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:04:38 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/payment-methods + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:04:38 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.041' + X-B3-Traceid: + - fa950b00f3ae4387384668f1f4f31914 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "payment-methods" : [ { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "selectable" : true, + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "selectable" : true, + "_embedded" : { + "payment-method" : { + "_id" : "147d2711-367f-4344-8637-f4b88418b751", + "name" : "Payment in advance", + "description" : null, + "officialName" : "Payment in advance", + "officialDescription" : "You only dispatch the goods upon receipt of the customer payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 2, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/147d2711-367f-4344-8637-f4b88418b751" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/147d2711-367f-4344-8637-f4b88418b751" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/147d2711-367f-4344-8637-f4b88418b751/deactivate" + } + } + } + } + }, { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "selectable" : true, + "_embedded" : { + "payment-method" : { + "_id" : "245bf7d1-507d-442e-b9cb-7c8bca086cdf", + "name" : "Cash", + "description" : null, + "officialName" : "Cash", + "officialDescription" : "The customer pays the invoice in cash.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 3, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/245bf7d1-507d-442e-b9cb-7c8bca086cdf" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/245bf7d1-507d-442e-b9cb-7c8bca086cdf" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/245bf7d1-507d-442e-b9cb-7c8bca086cdf/deactivate" + } + } + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce/payment-methods" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:04:38 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/b32c12fe-da0a-4100-b0bb-21c35a2233ce + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:04:38 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - bef8f058d161ef5fd78ecf6d9afa31a9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:04:38 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_pickup_option/sets_the_current_pickup_option_of_the_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_pickup_option/sets_the_current_pickup_option_of_the_cart.yml new file mode 100644 index 0000000..70461d2 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_pickup_option/sets_the_current_pickup_option_of_the_cart.yml @@ -0,0 +1,350 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:07:52 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.082' + X-B3-Traceid: + - c3cf2c3bcd83e24e365631c2a2cb29d8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813272, + "jti" : "tSvKcnmWQMcJ3IT9TjTYOdjSzQY=" + } + recorded_at: Tue, 01 Oct 2024 20:07:52 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:07:52 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.081' + X-B3-Traceid: + - e8867039a94ad1f56c02cd1249c453ef + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "25cb7a7b-ca72-45f4-8408-0c3cc37d413f", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:07:52 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/pickup-options + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:07:53 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.032' + X-B3-Traceid: + - 84c1001da08c7dabd034e0b053996b62 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "pickup-options" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f/pickup-options" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:07:53 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/25cb7a7b-ca72-45f4-8408-0c3cc37d413f + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:07:53 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.066' + X-B3-Traceid: + - aacbeee416e129f1b59e12947d06bb3c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:07:53 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_shipping_method/sets_the_current_shipping_method_of_the_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_shipping_method/sets_the_current_shipping_method_of_the_cart.yml new file mode 100644 index 0000000..80dce76 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_current_shipping_method/sets_the_current_shipping_method_of_the_cart.yml @@ -0,0 +1,356 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:06:49 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.079' + X-B3-Traceid: + - 05f724f0f7b499f6b68d7a232c545943 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813209, + "jti" : "3bFpbL5cwdCZm66kdEfShzvztPw=" + } + recorded_at: Tue, 01 Oct 2024 20:06:49 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:06:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.087' + X-B3-Traceid: + - 764b1db0c32fb170524e2762be7a71e3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "a1f7f04a-92e5-4b73-b54f-6fd840132c8d", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:06:49 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shipping-zones/search/find-all-serviceable-countries + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:06:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - a2ecd77d3ff7851e2b8469c76d81fc09 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "countryCodes" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shipping-zones/search/find-all-serviceable-countries?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Tue, 01 Oct 2024 20:06:49 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/a1f7f04a-92e5-4b73-b54f-6fd840132c8d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:06:49 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 6320d2b73176dfa028469c45d0a2e888 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:06:49 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_payment_method_to_default/sets_the_cart_payment_method_to_the_current_default_payment_method.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_payment_method_to_default/sets_the_cart_payment_method_to_the_current_default_payment_method.yml new file mode 100644 index 0000000..b48372a --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_payment_method_to_default/sets_the_cart_payment_method_to_the_current_default_payment_method.yml @@ -0,0 +1,454 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:04:59 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.391' + X-B3-Traceid: + - fce230b509155b9ced2f69ba54927c2c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813099, + "jti" : "NBudFzfaMV2OWWKngrsF078fEhE=" + } + recorded_at: Tue, 01 Oct 2024 20:04:59 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:04:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.093' + X-B3-Traceid: + - 139c36d45247c14d4c7a80e92fa805dd + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "d9e2cadf-d1ea-4091-a275-7eea4cb88f84", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:04:59 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods/default + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:05:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.124' + X-B3-Traceid: + - cd9ddd4ca14720b59d577278ea5d738a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "d9e2cadf-d1ea-4091-a275-7eea4cb88f84", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:05:00 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/d9e2cadf-d1ea-4091-a275-7eea4cb88f84 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:05:00 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.160' + X-B3-Traceid: + - e6dd26b42d6802fb8bd85d7c33ca9cbb + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:05:00 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_shipping_method_to_default/sets_the_cart_shipping_method_to_the_current_default_shipping_method.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_shipping_method_to_default/sets_the_cart_shipping_method_to_the_current_default_shipping_method.yml new file mode 100644 index 0000000..398f7d9 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_assign_shipping_method_to_default/sets_the_cart_shipping_method_to_the_current_default_shipping_method.yml @@ -0,0 +1,454 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:07:23 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.102' + X-B3-Traceid: + - 34c8f2353316c212674f06be0c44a72a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813243, + "jti" : "XgcBJcZIj3i8XsnbhpizCfxtkL4=" + } + recorded_at: Tue, 01 Oct 2024 20:07:23 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:07:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.081' + X-B3-Traceid: + - fd79b030573545428a7d4798b94450f7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "46a79192-24c9-496c-bca0-1ded8375fb2f", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:07:24 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods/default + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:07:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.100' + X-B3-Traceid: + - 1bace450daac807d8a450d0941d555e4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "46a79192-24c9-496c-bca0-1ded8375fb2f", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:07:24 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/46a79192-24c9-496c-bca0-1ded8375fb2f + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:07:24 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.047' + X-B3-Traceid: + - 1586d3dbb40c1f5152a90aac1729715a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:07:24 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_billing_address/sets_the_billing_address_of_the_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_billing_address/sets_the_billing_address_of_the_cart.yml new file mode 100644 index 0000000..6226fe7 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_billing_address/sets_the_billing_address_of_the_cart.yml @@ -0,0 +1,479 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:16 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.101' + X-B3-Traceid: + - 85ec9b1cce9397312009dd3f126b3fc4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727812996, + "jti" : "5w3jsqpuSH4YCd4UHatsR438nSg=" + } + recorded_at: Tue, 01 Oct 2024 20:03:16 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:03:16 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - b6b8d86a53da625352b25d2983e41f21 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "8aa01a0c-ebda-4124-bbee-cd7ca377dcbf", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:16 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/billing-address + body: + encoding: UTF-8 + string: '{"salutation":"Mrs","gender":"FEMALE","title":"Dr","firstName":"Astrid","middleName":"Agnes","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","street2":"Erdgeschoss","doorCode":"0185","addressExtension":"Hinterhof","postalCode":"20999","dependentLocality":"Seevetal","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"a.alsterh@example.com","phone":"(800) + 555-0102","mobile":"(800) 555-0103","vatId":"123456789","taxNumber":"123-34-6789","birthDate":"1985-03-20"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:16 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.111' + X-B3-Traceid: + - 87f3d7afbac7397832ba815d3ecdc7e4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "8aa01a0c-ebda-4124-bbee-cd7ca377dcbf", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : { + "salutation" : "Mrs", + "gender" : "FEMALE", + "company" : null, + "title" : "Dr", + "firstName" : "Astrid", + "middleName" : "Agnes", + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : "Erdgeschoss", + "addressExtension" : "Hinterhof", + "postalCode" : "20999", + "dependentLocality" : "Seevetal", + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "a.alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : "(800) 555-0103", + "displayAddressLines" : [ "Astrid Agnes Alster", "Seevetal", "Alsterwasserweg 2", "Erdgeschoss", "Hinterhof", "20999 Alsterwasser", "GERMANY" ], + "vatId" : "123456789", + "taxNumber" : "123-34-6789", + "birthDate" : "1985-03-20" + }, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : false, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : true, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:16 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/8aa01a0c-ebda-4124-bbee-cd7ca377dcbf + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:16 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 44c95c385c6d21cb283b03380f7d75d8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:16 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create/creates_a_new_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create/creates_a_new_cart.yml new file mode 100644 index 0000000..76257c0 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create/creates_a_new_cart.yml @@ -0,0 +1,286 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:15 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - fd033537449745e7082e60517bfaa397 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727812995, + "jti" : "8v32vw6JOhZ7W37UlXmBl4rXWh0=" + } + recorded_at: Tue, 01 Oct 2024 20:03:15 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:03:15 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - dfd6b786ea2cbc6c8630c92a50ba7dff + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "d1de800e-b0b5-498b-819b-9ff0cc49bc61", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:15 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/d1de800e-b0b5-498b-819b-9ff0cc49bc61 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:15 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.042' + X-B3-Traceid: + - 365c452cd2d30ad8fdb3bf5be24cdd17 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:15 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment/initiates_the_creation_of_a_payment.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment/initiates_the_creation_of_a_payment.yml new file mode 100644 index 0000000..4eceb68 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment/initiates_the_creation_of_a_payment.yml @@ -0,0 +1,346 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:05:10 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.097' + X-B3-Traceid: + - 96d30f67297d71844092adac149334e5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813110, + "jti" : "1MNpkATSZ5FbBCuGnFiZ0DMj9wc=" + } + recorded_at: Tue, 01 Oct 2024 20:05:10 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:05:11 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.094' + X-B3-Traceid: + - 544df6fadc6c8162f7c19c4d2dbdf2b3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "484bb211-fd69-406a-92f5-c1ce98aacf62", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:05:11 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62/create-payment + body: + encoding: UTF-8 + string: '{"returnUri":"https://example.com/return","cancelUri":"https://example.com/cancel"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Tue, 01 Oct 2024 20:05:11 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.040' + X-B3-Traceid: + - e4c13f7e022065274abf2ae8f2c2136a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "payment-method-error", + "details" : { }, + "message" : "There is no payment method definition associated with this payment method!", + "traceId" : "e4c13f7e022065274abf2ae8f2c2136a" + } + recorded_at: Tue, 01 Oct 2024 20:05:11 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/484bb211-fd69-406a-92f5-c1ce98aacf62 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:05:11 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.051' + X-B3-Traceid: + - 754b32b2c849f4bd7a1b7f2715a3419a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:05:11 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment_and_order/initiates_the_creation_of_a_payment_and_order_for_the_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment_and_order/initiates_the_creation_of_a_payment_and_order_for_the_cart.yml new file mode 100644 index 0000000..df79645 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_create_payment_and_order/initiates_the_creation_of_a_payment_and_order_for_the_cart.yml @@ -0,0 +1,348 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:06:19 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.099' + X-B3-Traceid: + - f36ce2bf2a71478f2de2889dcce45830 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813179, + "jti" : "r8ZL54Cu4EmXWQDpeCymzQZ/geQ=" + } + recorded_at: Tue, 01 Oct 2024 20:06:19 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:06:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.122' + X-B3-Traceid: + - '08d77776ca281acbf9d51e8b77ae826b' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "350f2378-11dd-4635-a1c0-0cfcb8fc128d", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:06:19 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d/create-payment + body: + encoding: UTF-8 + string: '{"returnUri":"https://example.com/return","cancelUri":"https://example.com/cancel","customerComment":"Please + send with UPS.","salesChannel":"Storefront","marketingChannel":"Google Shopping","marketingSubchannel":"Summer + Sale","testOrder":false,"termsAndConditionsExplicitlyAccepted":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Tue, 01 Oct 2024 20:06:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.035' + X-B3-Traceid: + - ea06e638dfe86ffa059a7622edc6d0ec + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "payment-method-error", + "details" : { }, + "message" : "There is no payment method definition associated with this payment method!", + "traceId" : "ea06e638dfe86ffa059a7622edc6d0ec" + } + recorded_at: Tue, 01 Oct 2024 20:06:19 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/350f2378-11dd-4635-a1c0-0cfcb8fc128d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:06:19 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.038' + X-B3-Traceid: + - 80d8efac6e53eacbb4a3e176e40bdb2f + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:06:19 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete/deletes_a_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete/deletes_a_cart.yml new file mode 100644 index 0000000..bec2b23 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete/deletes_a_cart.yml @@ -0,0 +1,336 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:17 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.079' + X-B3-Traceid: + - 2dd0c2c1c4adb3cfa1f2c9f795490392 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727812997, + "jti" : "TNSxsfAbKA1G0B+/GzMi0aCAthU=" + } + recorded_at: Tue, 01 Oct 2024 20:03:17 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:03:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.082' + X-B3-Traceid: + - 0df83e6c15708c0949413b3e2f504883 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "ec83da0e-e467-4b68-9bfe-01d6c2662594", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:17 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:18 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.041' + X-B3-Traceid: + - 03ad1c14c8442b09ee4d048ef55db953 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:17 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/ec83da0e-e467-4b68-9bfe-01d6c2662594 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:18 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.025' + X-B3-Traceid: + - da5e20e16540b8b11f6046d8f2f25e12 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:18 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete_coupon/removes_a_coupon_from_the_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete_coupon/removes_a_coupon_from_the_cart.yml new file mode 100644 index 0000000..b029135 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_delete_coupon/removes_a_coupon_from_the_cart.yml @@ -0,0 +1,346 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:08:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.121' + X-B3-Traceid: + - 5e05b616a566f5a7dcfb16a13ee5cf4b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813325, + "jti" : "1kOHABnuzD+GtLFX/pjkjUURlzA=" + } + recorded_at: Tue, 01 Oct 2024 20:08:45 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:08:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.212' + X-B3-Traceid: + - f86d792147d371f3a08c09545f43203b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "41ea4466-3ccd-4675-842f-e3721678239b", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:08:45 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b/coupon + body: + encoding: UTF-8 + string: '{"code":"FIRST-ORDER"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Tue, 01 Oct 2024 20:08:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.030' + X-B3-Traceid: + - 823181aa2bacae8d10a4af07ce03a134 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "invalid-coupon-code", + "details" : { }, + "message" : "The coupon code validation failed with following messages: Code doesn't exist", + "traceId" : "823181aa2bacae8d10a4af07ce03a134" + } + recorded_at: Tue, 01 Oct 2024 20:08:45 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/41ea4466-3ccd-4675-842f-e3721678239b + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:08:46 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.043' + X-B3-Traceid: + - fcc87b22386ce76298cc0842c76c868f + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:08:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_find/retrieves_the_details_of_a_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_find/retrieves_the_details_of_a_cart.yml new file mode 100644 index 0000000..1583162 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_find/retrieves_the_details_of_a_cart.yml @@ -0,0 +1,454 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:15 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.091' + X-B3-Traceid: + - 75894d0f21155c965ac551b7d4d81b8a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727812995, + "jti" : "OcIliKw8V/7D0h/D9fWjtTLdb78=" + } + recorded_at: Tue, 01 Oct 2024 20:03:15 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:03:15 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.083' + X-B3-Traceid: + - 9a0557ae2058c8e6b7561597f069b117 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "bcabd1d7-b760-4d7e-8147-2154b173f5bd", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:15 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:15 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.071' + X-B3-Traceid: + - fb74825159d6dc421db0613e00ced273 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "bcabd1d7-b760-4d7e-8147-2154b173f5bd", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:15 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/bcabd1d7-b760-4d7e-8147-2154b173f5bd + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:16 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - 224850fa49e340a4f35e68cba87794a6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:16 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_payment_methods/lists_all_applicable_payment_methods_for_the_current_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_payment_methods/lists_all_applicable_payment_methods_for_the_current_cart.yml new file mode 100644 index 0000000..b2471e8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_payment_methods/lists_all_applicable_payment_methods_for_the_current_cart.yml @@ -0,0 +1,482 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:29 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.135' + X-B3-Traceid: + - c591b468bb51ab7f1bb4654191c06e62 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813009, + "jti" : "gevQXlbEKtF9jbitFeIFrVZNg6Q=" + } + recorded_at: Tue, 01 Oct 2024 20:03:29 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:03:29 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.099' + X-B3-Traceid: + - 787a4d3629fe4b1ffef8d4a3d0d530a8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "e31fc0ef-0944-4937-baed-090fda110441", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:29 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/payment-methods + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:29 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - 527514d489ad52b9621f748ca687f4a1 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "payment-methods" : [ { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "selectable" : true, + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "selectable" : true, + "_embedded" : { + "payment-method" : { + "_id" : "147d2711-367f-4344-8637-f4b88418b751", + "name" : "Payment in advance", + "description" : null, + "officialName" : "Payment in advance", + "officialDescription" : "You only dispatch the goods upon receipt of the customer payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 2, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/147d2711-367f-4344-8637-f4b88418b751" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/147d2711-367f-4344-8637-f4b88418b751" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/147d2711-367f-4344-8637-f4b88418b751/deactivate" + } + } + } + } + }, { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "selectable" : true, + "_embedded" : { + "payment-method" : { + "_id" : "245bf7d1-507d-442e-b9cb-7c8bca086cdf", + "name" : "Cash", + "description" : null, + "officialName" : "Cash", + "officialDescription" : "The customer pays the invoice in cash.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 3, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/245bf7d1-507d-442e-b9cb-7c8bca086cdf" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/245bf7d1-507d-442e-b9cb-7c8bca086cdf" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/245bf7d1-507d-442e-b9cb-7c8bca086cdf/deactivate" + } + } + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441/payment-methods" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:29 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/e31fc0ef-0944-4937-baed-090fda110441 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:29 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.048' + X-B3-Traceid: + - 7f468f3f33a7d86f23e93a30887f80ab + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:29 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_pickup_options/lists_all_applicable_pickup_options_for_the_current_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_pickup_options/lists_all_applicable_pickup_options_for_the_current_cart.yml new file mode 100644 index 0000000..65e3741 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_pickup_options/lists_all_applicable_pickup_options_for_the_current_cart.yml @@ -0,0 +1,350 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:07:29 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.083' + X-B3-Traceid: + - 40710059aaf226a115100636fad6a8c6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813249, + "jti" : "+t7QtFvMaev8FhO2At0xifij/rM=" + } + recorded_at: Tue, 01 Oct 2024 20:07:29 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:07:30 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.087' + X-B3-Traceid: + - d6c27f9e4781082809b63c8bc3e94132 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:07:30 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/pickup-options + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:07:30 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - 22f30e320ce35516706dc816133fb004 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "pickup-options" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6/pickup-options" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:07:30 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/8c1b0d17-005f-41ff-a2e4-d0f71eaba4c6 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:07:30 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.042' + X-B3-Traceid: + - 36390fd7d279742f9e7d879de5a96b25 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:07:30 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_redeem_coupon/redeems_a_coupon.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_redeem_coupon/redeems_a_coupon.yml new file mode 100644 index 0000000..b05fb48 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_redeem_coupon/redeems_a_coupon.yml @@ -0,0 +1,346 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:08:04 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.082' + X-B3-Traceid: + - 7726ba263313a7957249873046b9ff24 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727813284, + "jti" : "BOHZFXD+OcVPLwuQqmFKh+Fpgmk=" + } + recorded_at: Tue, 01 Oct 2024 20:08:04 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:08:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.093' + X-B3-Traceid: + - 2a6efcc31916544ac6435c83ae3446da + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "ed6e5f8c-7e42-415d-93fc-84b9495aeb63", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:08:04 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63/coupon + body: + encoding: UTF-8 + string: '{"code":"FIRST-ORDER"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Tue, 01 Oct 2024 20:08:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.052' + X-B3-Traceid: + - cd38557c8ee16d0614b1561cc27d2f25 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "invalid-coupon-code", + "details" : { }, + "message" : "The coupon code validation failed with following messages: Code doesn't exist", + "traceId" : "cd38557c8ee16d0614b1561cc27d2f25" + } + recorded_at: Tue, 01 Oct 2024 20:08:04 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/ed6e5f8c-7e42-415d-93fc-84b9495aeb63 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:08:04 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.063' + X-B3-Traceid: + - 27c3d43781b58f34f0991b9062e84d9b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:08:04 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_shipping_address/sets_the_shipping_address_of_the_cart.yml b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_shipping_address/sets_the_shipping_address_of_the_cart.yml new file mode 100644 index 0000000..d1a56f8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Checkout_Cart/with_cart/_shipping_address/sets_the_shipping_address_of_the_cart.yml @@ -0,0 +1,477 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:17 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.086' + X-B3-Traceid: + - 16a533e7536c1c3a95c738640c48c1e5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727812997, + "jti" : "GUQomqrrn03wFWG5AFz0SsVIz8g=" + } + recorded_at: Tue, 01 Oct 2024 20:03:16 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/carts + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 01 Oct 2024 20:03:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - dfd31feb0ee7cc629c2ce18f6f973463 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "1b243ad5-692b-4cb4-a2b8-82f4df975b68", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : null, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : true, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:17 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/shipping-address + body: + encoding: UTF-8 + string: '{"salutation":"Mrs","gender":"FEMALE","title":"Dr","firstName":"Astrid","middleName":"Agnes","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","street2":"Erdgeschoss","doorCode":"0185","addressExtension":"Hinterhof","postalCode":"20999","dependentLocality":"Seevetal","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"a.alsterh@example.com","phone":"(800) + 555-0102","mobile":"(800) 555-0103","vatId":"123456789","taxNumber":"123-34-6789","birthDate":"1985-03-20"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 01 Oct 2024 20:03:17 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.123' + X-B3-Traceid: + - 820b32519a35f8838d40eff45eea1447 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "1b243ad5-692b-4cb4-a2b8-82f4df975b68", + "lineItems" : [ ], + "shippingLineItem" : null, + "pickupLineItem" : null, + "paymentLineItem" : { + "lineItemPrice" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "lineItemTaxes" : [ ], + "_embedded" : { + "payment-method" : { + "_id" : "c5cdf11e-6947-471e-a76a-1534a6ff5809", + "name" : "Invoice", + "description" : null, + "officialName" : "Invoice", + "officialDescription" : "You issue an invoice. After receipt of the goods, the customer transfers the payment.", + "defaultPaymentNote" : null, + "taxClass" : "REGULAR", + "discountOrFee" : { + "type" : "ABSOLUTE", + "absoluteValue" : { + "taxModel" : "GROSS", + "currency" : "GBP", + "amount" : 0 + }, + "percentageValue" : null + }, + "position" : 1, + "minimumOrderValue" : null, + "activated" : true, + "activeLogoSet" : null, + "onlinePayment" : false, + "workflow" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809" + }, + "deactivate-payment-method" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/payment-methods/c5cdf11e-6947-471e-a76a-1534a6ff5809/deactivate" + } + } + } + } + }, + "couponLineItem" : null, + "billingAddress" : null, + "shippingAddress" : { + "salutation" : "Mrs", + "gender" : "FEMALE", + "company" : null, + "title" : "Dr", + "firstName" : "Astrid", + "middleName" : "Agnes", + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : "Erdgeschoss", + "addressExtension" : "Hinterhof", + "postalCode" : "20999", + "dependentLocality" : "Seevetal", + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "a.alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : "(800) 555-0103", + "displayAddressLines" : [ "Astrid Agnes Alster", "Seevetal", "Alsterwasserweg 2", "Erdgeschoss", "Hinterhof", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : "0185" + }, + "subtotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "grandTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "netTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxTotal" : { + "currency" : "GBP", + "amount" : 0 + }, + "taxes" : [ ], + "taxable" : false, + "minimumOrderValue" : { + "currency" : "GBP", + "amount" : 0 + }, + "mustAcceptTermsAndConditions" : false, + "mustEnterPhoneNumber" : false, + "weight" : 0, + "checkoutState" : { + "shippingMethodValid" : false, + "shippingMethodSelectable" : false, + "pickupOptionValid" : false, + "paymentMethodValid" : true, + "paymentMethodSelectable" : true, + "billingAddressSet" : false, + "priceValidToOrder" : true, + "paymentTransactionStatus" : "NO_APPROVAL_NEEDED", + "readyToOrder" : false + }, + "customerEmail" : null, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68" + }, + "line-items" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/line-items" + }, + "payment-method-available" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/payment-methods" + }, + "payment-method-default" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/payment-methods/default" + }, + "payment-method-current" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/payment-methods/current" + }, + "billing-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68/billing-address" + }, + "shipping-address" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/carts" + } + } + } + recorded_at: Tue, 01 Oct 2024 20:03:17 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/carts/1b243ad5-692b-4cb4-a2b8-82f4df975b68 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Tue, 01 Oct 2024 20:03:17 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 406b1c9a5ba51fc5a39ae46868eac926 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Tue, 01 Oct 2024 20:03:17 GMT +recorded_with: VCR 6.2.0 From 1ee4d0ee65a8cdf1c6c26fb5db3043dd7163b149 Mon Sep 17 00:00:00 2001 From: Kathia Date: Mon, 7 Oct 2024 09:16:03 +0200 Subject: [PATCH 56/59] Add shop endpoints (#87) --- lib/beyond_api/services/shop/feature.rb | 35 ++++ lib/beyond_api/services/shop/language.rb | 79 +++++++ spec/beyond_api/services/shop/feature_spec.rb | 22 ++ .../beyond_api/services/shop/language_spec.rb | 42 ++++ .../_all/returns_all_shop_features.yml | 139 ++++++++++++ .../_find/returns_a_shop_feature.yml | 141 +++++++++++++ .../_all/returns_all_shop_languages.yml | 158 ++++++++++++++ .../_create/creates_a_new_shop_language.yml | 132 ++++++++++++ .../_delete/deletes_a_shop_language.yml | 186 ++++++++++++++++ .../_find/returns_a_shop_language.yml | 198 ++++++++++++++++++ 10 files changed, 1132 insertions(+) create mode 100644 lib/beyond_api/services/shop/feature.rb create mode 100644 lib/beyond_api/services/shop/language.rb create mode 100644 spec/beyond_api/services/shop/feature_spec.rb create mode 100644 spec/beyond_api/services/shop/language_spec.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Feature/_all/returns_all_shop_features.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Feature/_find/returns_a_shop_feature.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Language/_all/returns_all_shop_languages.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_create/creates_a_new_shop_language.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_delete/deletes_a_shop_language.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_find/returns_a_shop_language.yml diff --git a/lib/beyond_api/services/shop/feature.rb b/lib/beyond_api/services/shop/feature.rb new file mode 100644 index 0000000..ba74be8 --- /dev/null +++ b/lib/beyond_api/services/shop/feature.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module BeyondApi + module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Feature.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Feature < BaseService + # List all features that are assigned to a specific shop identified by the current hostname. + # + # @see https://developer.epages.com/beyond-docs/#list_feature_assignments + # + # @return [Hash] + # + # @example + # @client.all + def all + get('shop/features') + end + + # Retrieve the details of a specific feature assignment of a merchant’s shop identified by the current hostname. + # + # @see https://developer.epages.com/beyond-docs/#show_feature_assignment_details + # + # @param feature_name [String] The feature name + # + # @return [Hash] + # + # @example + # @client.find('product-management.max-products') + def find(feature_name) + get("shop/features/#{feature_name}") + end + end + end +end diff --git a/lib/beyond_api/services/shop/language.rb b/lib/beyond_api/services/shop/language.rb new file mode 100644 index 0000000..dcb2f4c --- /dev/null +++ b/lib/beyond_api/services/shop/language.rb @@ -0,0 +1,79 @@ +# frozen_string_literal: true + +module BeyondApi + module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Language.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Language < BaseService + # Create a language for a specified shop. + # + # @see https://developer.epages.com/beyond-docs/#create_language + # + # @param locale [String] the locale + # + # @return [Hash] + # + # @example + # @client.create('de-DE') + def create(locale) + post('shop/languages', locale:) + end + + # Retrieve detailed information about a single language of the shop. The language is specified by its id. + # + # @see https://developer.epages.com/beyond-docs/#show_language_details + # + # @param id [String] The language UUID + # + # @return [Hash] + # + # @example + # @client.find('750958a7-7924-4028-8f44-260f8fb11cbb') + def find(id) + get("shop/languages/#{id}") + end + + # Retrieve the currently active languages of a specified shop in a paged way. + # + # @see https://developer.epages.com/beyond-docs/#list_languages + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + fetch_all_pages('shop/languages', params) + end + + # Retrieve all languages that can be created for a shop. Languages that are not on the list are not supported. + # + # @see https://developer.epages.com/beyond-docs/#list_supported_languages + # + # @return [Hash] + # + # @example + # @client.supported_languages + def supported_languages + get('shop/languages/supported') + end + + # Delete a language from a specified shop. + # + # @see https://developer.epages.com/beyond-docs/#delete_language + # + # @param id [String] the language UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('750958a7-7924-4028-8f44-260f8fb11cbb') + def delete(id) + super("shop/languages/#{id}") + end + end + end +end diff --git a/spec/beyond_api/services/shop/feature_spec.rb b/spec/beyond_api/services/shop/feature_spec.rb new file mode 100644 index 0000000..e712ee3 --- /dev/null +++ b/spec/beyond_api/services/shop/feature_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Shop::Feature, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all shop features' do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :features)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + describe '.find' do + it 'returns a shop feature' do + response = client.find('product-management.max-products') + expect(response[:name]).to eq('product-management.max-products') + end + end +end diff --git a/spec/beyond_api/services/shop/language_spec.rb b/spec/beyond_api/services/shop/language_spec.rb new file mode 100644 index 0000000..6400a9e --- /dev/null +++ b/spec/beyond_api/services/shop/language_spec.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Shop::Language, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all shop languages' do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :languages)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + context 'with language' do + before(:each) do + @response = client.create('it-IT') + end + + describe '.create' do + it 'creates a new shop language' do + expect(@response).not_to be nil + expect(@response[:locale]).to eq('it-IT') + end + end + + describe '.find' do + it 'returns a shop language' do + response = client.find(@response[:id]) + expect(response[:locale]).to eq('it-IT') + end + end + + describe '.delete' do + it 'deletes a shop language' do + response = client.delete(@response[:id]) + expect(response).to eq({}) + end + end + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Feature/_all/returns_all_shop_features.yml b/spec/vcr_cassettes/BeyondApi_Shop_Feature/_all/returns_all_shop_features.yml new file mode 100644 index 0000000..d1293fb --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Feature/_all/returns_all_shop_features.yml @@ -0,0 +1,139 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:35:49 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.116' + X-B3-Traceid: + - fa44cdc1b1ed04f1eb6fd71f2aa6daa9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727966149, + "jti" : "/vD005oJgNnKqkX0vCFmyX7uN4E=" + } + recorded_at: Thu, 03 Oct 2024 14:35:49 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/features + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:35:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.006' + X-B3-Traceid: + - d057c4f7c94b8329953d59ab4233af6c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "features" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/features?page=0&size=20" + }, + "owner" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Thu, 03 Oct 2024 14:35:49 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Feature/_find/returns_a_shop_feature.yml b/spec/vcr_cassettes/BeyondApi_Shop_Feature/_find/returns_a_shop_feature.yml new file mode 100644 index 0000000..eadaf84 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Feature/_find/returns_a_shop_feature.yml @@ -0,0 +1,141 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:35:49 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.114' + X-B3-Traceid: + - 9b9fd559577b4859295938bb62a99dfd + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727966149, + "jti" : "15+/3WWjnbld4XnafwjV6RHfvsU=" + } + recorded_at: Thu, 03 Oct 2024 14:35:49 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/features/product-management.max-products + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:35:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Content-Disposition: + - inline;filename=f.txt + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.011' + X-B3-Traceid: + - 31afcc7e8cd621053bcf55cd7e24db70 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "product-management.max-products", + "type" : "COUNTER", + "details" : { + "maxValue" : 100, + "currentValue" : 0 + }, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/features/product-management.max-products" + }, + "owner" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop" + }, + "feature-definition" : { + "href" : "https://api-shop.beyondshop.cloud/api/feature-definitions/product-management.max-products" + } + } + } + recorded_at: Thu, 03 Oct 2024 14:35:49 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Language/_all/returns_all_shop_languages.yml b/spec/vcr_cassettes/BeyondApi_Shop_Language/_all/returns_all_shop_languages.yml new file mode 100644 index 0000000..4de5307 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Language/_all/returns_all_shop_languages.yml @@ -0,0 +1,158 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 09:42:19 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.091' + X-B3-Traceid: + - 3c831c0f06f35a83daaadc6bf1d2572e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727948539, + "jti" : "i9X4RgJLGRZpgy21AGIV7W4NzrM=" + } + recorded_at: Thu, 03 Oct 2024 09:42:19 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/languages + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 09:42:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.008' + X-B3-Traceid: + - a3c1855601b9a8f87e8164e97f8fb1c8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "languages" : [ { + "_id" : "dd170cd2-8b2d-4a8e-bfdb-16023eeca398", + "locale" : "it-IT", + "deletableAt" : "2024-10-02T09:54:49.099Z", + "creatableAt" : null, + "deleted" : false, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages/dd170cd2-8b2d-4a8e-bfdb-16023eeca398" + } + } + }, { + "_id" : "413732f8-44f7-4f4a-9981-20614262c0f1", + "locale" : "nb-NO", + "deletableAt" : "2024-10-02T09:54:49.107Z", + "creatableAt" : null, + "deleted" : false, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages/413732f8-44f7-4f4a-9981-20614262c0f1" + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages?page=0&size=20&sort=createdAt,asc" + } + }, + "page" : { + "size" : 20, + "totalElements" : 2, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Thu, 03 Oct 2024 09:42:19 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_create/creates_a_new_shop_language.yml b/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_create/creates_a_new_shop_language.yml new file mode 100644 index 0000000..fd07237 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_create/creates_a_new_shop_language.yml @@ -0,0 +1,132 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:10:06 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.125' + X-B3-Traceid: + - ae7e7a9a7cd4926bbb51af05eedad4ae + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727964606, + "jti" : "VZdbLKLZ3DKJywgUWMdaG1szCPU=" + } + recorded_at: Thu, 03 Oct 2024 14:10:06 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/languages + body: + encoding: UTF-8 + string: '{"locale":"it-IT"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:10:06 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.008' + X-B3-Traceid: + - 951c00505367046cb463def0cacfd2f0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "c56b1f74-5bca-4943-98e9-c4646b5e1db8", + "locale" : "it-IT", + "deletableAt" : "2024-10-02T09:54:53.177Z", + "creatableAt" : null, + "deleted" : false, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages/c56b1f74-5bca-4943-98e9-c4646b5e1db8" + } + } + } + recorded_at: Thu, 03 Oct 2024 14:10:06 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_delete/deletes_a_shop_language.yml b/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_delete/deletes_a_shop_language.yml new file mode 100644 index 0000000..f20c811 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_delete/deletes_a_shop_language.yml @@ -0,0 +1,186 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:24:09 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.103' + X-B3-Traceid: + - 9c5853c17768bd61ea33f1bf3e8d768c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727965449, + "jti" : "lzxLLtsyXFMbTxn86B/78ZMg7lo=" + } + recorded_at: Thu, 03 Oct 2024 14:24:09 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/languages + body: + encoding: UTF-8 + string: '{"locale":"it-IT"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:24:09 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.008' + X-B3-Traceid: + - d0674316fc606ae32d06a1ad84248efa + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "c56b1f74-5bca-4943-98e9-c4646b5e1db8", + "locale" : "it-IT", + "deletableAt" : "2024-10-02T09:54:53.177Z", + "creatableAt" : null, + "deleted" : false, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages/c56b1f74-5bca-4943-98e9-c4646b5e1db8" + } + } + } + recorded_at: Thu, 03 Oct 2024 14:24:09 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/languages/c56b1f74-5bca-4943-98e9-c4646b5e1db8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:24:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.008' + X-B3-Traceid: + - d0674316fc606ae32d06a1ad84248efa + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 14:24:10 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_find/returns_a_shop_language.yml b/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_find/returns_a_shop_language.yml new file mode 100644 index 0000000..73d5ca8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Language/with_language/_find/returns_a_shop_language.yml @@ -0,0 +1,198 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:24:09 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.103' + X-B3-Traceid: + - 9c5853c17768bd61ea33f1bf3e8d768c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727965449, + "jti" : "lzxLLtsyXFMbTxn86B/78ZMg7lo=" + } + recorded_at: Thu, 03 Oct 2024 14:24:09 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/languages + body: + encoding: UTF-8 + string: '{"locale":"it-IT"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:24:09 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.008' + X-B3-Traceid: + - d0674316fc606ae32d06a1ad84248efa + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "c56b1f74-5bca-4943-98e9-c4646b5e1db8", + "locale" : "it-IT", + "deletableAt" : "2024-10-02T09:54:53.177Z", + "creatableAt" : null, + "deleted" : false, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages/c56b1f74-5bca-4943-98e9-c4646b5e1db8" + } + } + } + recorded_at: Thu, 03 Oct 2024 14:24:09 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/languages/c56b1f74-5bca-4943-98e9-c4646b5e1db8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 14:24:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.008' + X-B3-Traceid: + - d0674316fc606ae32d06a1ad84248efa + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "c56b1f74-5bca-4943-98e9-c4646b5e1db8", + "locale" : "it-IT", + "deletableAt" : "2024-10-02T09:54:53.177Z", + "creatableAt" : null, + "deleted" : false, + "_links" : { + "self" : { + "href" : "https://api-shop.beyondshop.cloud/api/shop/languages/c56b1f74-5bca-4943-98e9-c4646b5e1db8" + } + } + } + recorded_at: Thu, 03 Oct 2024 14:24:10 GMT +recorded_with: VCR 6.2.0 From 3e7ccbf09204762cf94dc97ce0322a8f32f469e1 Mon Sep 17 00:00:00 2001 From: Kathia Date: Mon, 7 Oct 2024 09:16:12 +0200 Subject: [PATCH 57/59] Add webhooks endpoints (#86) --- .../services/webhook/subscription.rb | 79 +++++- .../services/webhook/subscription_spec.rb | 40 +++ .../activates_a_webhook_subscription.yml | 254 +++++++++++++++++ .../deactivates_a_webhook_subscription.yml | 254 +++++++++++++++++ .../deletes_a_webhook_failure.yml | 250 +++++++++++++++++ ...d_deliveries_of_a_webhook_subscription.yml | 256 ++++++++++++++++++ .../retries_a_failed_webhook_delivery.yml | 238 ++++++++++++++++ 7 files changed, 1370 insertions(+), 1 deletion(-) create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_activate/activates_a_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_deactivate/deactivates_a_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete_failure/deletes_a_webhook_failure.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_failures/lists_all_failed_deliveries_of_a_webhook_subscription.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_retry/retries_a_failed_webhook_delivery.yml diff --git a/lib/beyond_api/services/webhook/subscription.rb b/lib/beyond_api/services/webhook/subscription.rb index 794584b..1b8016d 100644 --- a/lib/beyond_api/services/webhook/subscription.rb +++ b/lib/beyond_api/services/webhook/subscription.rb @@ -63,7 +63,7 @@ def delete_all # @example # @client.delete('84ce4b3a-9a10-46d0-afcd-a71bcd0c0e9a') def delete(id) - super("webhook-subscriptions/#{id}") # Concerns::Connection delete method + super("webhook-subscriptions/#{id}") end # Retrieve the details of a webhook subscription. @@ -79,6 +79,83 @@ def delete(id) def find(id) get("webhook-subscriptions/#{id}") end + + # Activate a webhook subscription. You might want to use this request for a deactivated webhook. + # + # @see https://developer.epages.com/beyond-docs/#activate_webhook_subscription + # + # @param id [String] the webhook subscription UUID + # + # @return [Hash] + # + # @example + # @client.activate('1d61c1b4-49aa-4827-bd04-b1c4374f3499') + def activate(id) + post("webhook-subscriptions/#{id}/activate") + end + + # Deactivate a webhook subscription. You might want to use this request for a currently active webhook. + # + # @see https://developer.epages.com/beyond-docs/#deactivate_webhook_subscription + # + # @param id [String] the webhook subscription UUID + # + # @return [Hash] + # + # @example + # @client.deactivate('8517ab39-db0e-417a-87ed-f96e437c03e4') + def deactivate(id) + post("webhook-subscriptions/#{id}/deactivate") + end + + # List all failed deliveries of a webhook subscription in a paged way. + # + # @see https://developer.epages.com/beyond-docs/#list_failed_webhook_deliveries + # + # @param id [String] the webhook subscription UUID + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.failures('a3dd55a4-dbc3-4f20-8a5e-d0fe4ba59afd', { size: 100, page: 0 }) + def failures(id, params = {}) + fetch_all_pages("webhook-subscriptions/#{id}/failures", params) + end + + # Retry a failed webhook delivery. + # + # @see https://developer.epages.com/beyond-docs/#retry_failed_webhook_delivery + # + # @param webhook_id [String] the webhook subscription UUID + # @param failure_id [String] the failure UUID + # + # @return [Hash] + # + # @example + # @client.retry('d9828fba-3922-4750-a70c-174daeeb37e4', + # 'b21146e0-16b9-468f-806b-a23c8e04a7fc') + def retry(webhook_id, failure_id) + post("webhook-subscriptions/#{webhook_id}/failures/#{failure_id}/retry") + end + + # Delete a webhook failure. + # + # @see https://developer.epages.com/beyond-docs/#delete_webhook_delivery_failure + # + # @param webhook_id [String] the webhook subscription UUID + # @param failure_id [String] the failure UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete_failure('cbcebfc4-9dee-4344-83b2-8c25b2287a60', + # 'f090610b-19da-4e40-a986-3c9562fefeab') + def delete_failure(webhook_id, failure_id) + delete("webhook-subscriptions/#{webhook_id}/failures/#{failure_id}") + end end end end diff --git a/spec/beyond_api/services/webhook/subscription_spec.rb b/spec/beyond_api/services/webhook/subscription_spec.rb index 3a045e3..91dcab8 100644 --- a/spec/beyond_api/services/webhook/subscription_spec.rb +++ b/spec/beyond_api/services/webhook/subscription_spec.rb @@ -40,6 +40,46 @@ end end + describe '.deactivate' do + it 'deactivates a webhook subscription' do + response = client.deactivate(@webhook_subscription[:id]) + expect(response).not_to be nil + expect(response[:active]).to eq(false) + end + end + + describe '.activate' do + it 'activates a webhook subscription' do + response = client.activate(@webhook_subscription[:id]) + expect(response).not_to be nil + expect(response[:active]).to eq(true) + end + end + + describe '.failures' do + it 'lists all failed deliveries of a webhook subscription' do + response = client.failures(@webhook_subscription[:id], { size: 100, page: 0 }) + expect(response).not_to be nil + expect(response.dig(:embedded, :failures)).to be_kind_of(Array) + end + end + + describe '.retry' do + it 'retries a failed webhook delivery' do + failure_id = '987e6543-e21b-45d3-b123-654321098765' + # Non existing failure ID will raise an error + expect { client.retry(@webhook_subscription[:id], failure_id) }.to raise_error(BeyondApi::Error) + end + end + + describe '.delete_failure' do + it 'deletes a webhook failure' do + failure_id = '123e4567-e89b-12d3-a456-426614174000' + # Non existing failure ID will raise an error + expect { client.delete_failure(@webhook_subscription[:id], failure_id) }.to raise_error(BeyondApi::Error) + end + end + after(:each) do client.delete(@webhook_subscription[:id]) rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_activate/activates_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_activate/activates_a_webhook_subscription.yml new file mode 100644 index 0000000..93a6346 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_activate/activates_a_webhook_subscription.yml @@ -0,0 +1,254 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.111' + X-B3-Traceid: + - e3d66d2aa31912e7b0b504fcb4cf21c1 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727938728, + "jti" : "vitZ488XJwzufv9LHJgiyHRiAzM=" + } + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.069' + X-B3-Traceid: + - 2d1a762ad3d611a96e94a2123847b6f8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "735d9365-7795-496e-bfb7-7156433dd525", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525/deactivate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525/activate + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.027' + X-B3-Traceid: + - 904d76b8aba432e0ff0c17a0624fbcf5 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "735d9365-7795-496e-bfb7-7156433dd525", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525/deactivate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/735d9365-7795-496e-bfb7-7156433dd525 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.043' + X-B3-Traceid: + - 21e2dda7d41c1dd2bd6f82cc7279cfe9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_deactivate/deactivates_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_deactivate/deactivates_a_webhook_subscription.yml new file mode 100644 index 0000000..4c5a8c4 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_deactivate/deactivates_a_webhook_subscription.yml @@ -0,0 +1,254 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.107' + X-B3-Traceid: + - 93421d636b7e092cc7a76bedb577e104 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727938728, + "jti" : "GRGUemmcTlUrNdm6vnUA2fS2B3E=" + } + recorded_at: Thu, 03 Oct 2024 06:58:47 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.055' + X-B3-Traceid: + - aa578b3abd60b6584917ef2ba3132052 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "5a8bba3b-5e7c-4f02-8876-d777af2d9659", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659/deactivate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659/deactivate + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.044' + X-B3-Traceid: + - 376b1c8a5c9d1069eaca08a061003094 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : false, + "_id" : "5a8bba3b-5e7c-4f02-8876-d777af2d9659", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659" + }, + "activate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659/activate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/5a8bba3b-5e7c-4f02-8876-d777af2d9659 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 03 Oct 2024 06:58:48 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.039' + X-B3-Traceid: + - f1d312c7dae8eb40f6420031c734634e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 06:58:48 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete_failure/deletes_a_webhook_failure.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete_failure/deletes_a_webhook_failure.yml new file mode 100644 index 0000000..84fa6e4 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_delete_failure/deletes_a_webhook_failure.yml @@ -0,0 +1,250 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:50 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.075' + X-B3-Traceid: + - 326eaf6eb08d2a384ab8f6f8401d9f0d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727938730, + "jti" : "hd/XTyQyv33SG4JeSrywaAmJico=" + } + recorded_at: Thu, 03 Oct 2024 06:58:50 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 03 Oct 2024 06:58:50 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/38d82a29-4ad6-49fa-83cd-70350517a472 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.052' + X-B3-Traceid: + - e063e94d034a0a2135b479c9f036c291 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "38d82a29-4ad6-49fa-83cd-70350517a472", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/38d82a29-4ad6-49fa-83cd-70350517a472" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/38d82a29-4ad6-49fa-83cd-70350517a472/deactivate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:50 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/webhook-subscriptions/38d82a29-4ad6-49fa-83cd-70350517a472/failures/123e4567-e89b-12d3-a456-426614174000 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 500 + message: Server Error + headers: + Date: + - Thu, 03 Oct 2024 06:58:50 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.018' + X-B3-Traceid: + - 259b55a05b6bfd44abd906464d51489a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "errorId" : "internal-error", + "details" : { }, + "message" : "No static resource webhook-subscriptions/webhook-subscriptions/38d82a29-4ad6-49fa-83cd-70350517a472/failures/123e4567-e89b-12d3-a456-426614174000.", + "traceId" : "259b55a05b6bfd44abd906464d51489a" + } + recorded_at: Thu, 03 Oct 2024 06:58:50 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/38d82a29-4ad6-49fa-83cd-70350517a472 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 03 Oct 2024 06:58:50 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.036' + X-B3-Traceid: + - 70c15805665504105f8478af5129ccf6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 06:58:50 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_failures/lists_all_failed_deliveries_of_a_webhook_subscription.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_failures/lists_all_failed_deliveries_of_a_webhook_subscription.yml new file mode 100644 index 0000000..116dda6 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_failures/lists_all_failed_deliveries_of_a_webhook_subscription.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.089' + X-B3-Traceid: + - 3dda588eafcbb357100ef4ef04af1bf8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727938729, + "jti" : "T/v4oieL2/5IZv6TqGvqp7aiXSM=" + } + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/57c659f9-3706-439f-8388-3b6fbb026c9b + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.034' + X-B3-Traceid: + - edff24a91abd9b6bb9d5de0f6e610385 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "57c659f9-3706-439f-8388-3b6fbb026c9b", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/57c659f9-3706-439f-8388-3b6fbb026c9b" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/57c659f9-3706-439f-8388-3b6fbb026c9b/deactivate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/57c659f9-3706-439f-8388-3b6fbb026c9b/failures?page=0&size=100 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.022' + X-B3-Traceid: + - 8495ad4960eb203745452af09a0a4335 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "failures" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/57c659f9-3706-439f-8388-3b6fbb026c9b/failures?page=0&size=100&sort=createdAt,desc" + } + }, + "page" : { + "size" : 100, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/57c659f9-3706-439f-8388-3b6fbb026c9b + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.028' + X-B3-Traceid: + - 7cbaa1ac44a6dc8120b1c5f6bfc0ce13 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_retry/retries_a_failed_webhook_delivery.yml b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_retry/retries_a_failed_webhook_delivery.yml new file mode 100644 index 0000000..2a8eea1 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Webhook_Subscription/with_webhook_subscription/_retry/retries_a_failed_webhook_delivery.yml @@ -0,0 +1,238 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.081' + X-B3-Traceid: + - 2c6d053ea44a5654591358694fc35f81 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1727938729, + "jti" : "IsJ4kGGsEUTDD7kri+ON7+SLEe8=" + } + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions + body: + encoding: UTF-8 + string: '{"callbackUri":"http://example.com/test","eventTypes":["order.created","product.created"]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/6ea2623c-4ef2-40fb-8f05-9683ba8d5e71 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.043' + X-B3-Traceid: + - 4a6df15f0cc1641ee0dea4b4e52419f8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "callbackUri" : "http://example.com/test", + "eventTypes" : [ "product.created", "order.created" ], + "active" : true, + "_id" : "6ea2623c-4ef2-40fb-8f05-9683ba8d5e71", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/6ea2623c-4ef2-40fb-8f05-9683ba8d5e71" + }, + "deactivate" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/6ea2623c-4ef2-40fb-8f05-9683ba8d5e71/deactivate" + } + } + } + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/6ea2623c-4ef2-40fb-8f05-9683ba8d5e71/failures/987e6543-e21b-45d3-b123-654321098765/retry + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Thu, 03 Oct 2024 06:58:49 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.019' + X-B3-Traceid: + - fe923707345224b9199ee1185b7ff8a4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 06:58:49 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/webhook-subscriptions/6ea2623c-4ef2-40fb-8f05-9683ba8d5e71 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 03 Oct 2024 06:58:50 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - '0' + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.031' + X-B3-Traceid: + - 31be1c834ab966a4aa654059e5441133 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 03 Oct 2024 06:58:50 GMT +recorded_with: VCR 6.2.0 From 5df83ed5767ff26bd728bd0bd38453e1f1a9ede8 Mon Sep 17 00:00:00 2001 From: Kathia Date: Tue, 15 Oct 2024 08:13:25 +0200 Subject: [PATCH 58/59] Add endpoints for shop attributes and images (#89) * Add endpoints for shop attributes and images * Fix content type images * Add missing blank line --- lib/beyond_api/concerns/connection.rb | 4 +- .../services/product_management/image.rb | 15 +- lib/beyond_api/services/shop/attribute.rb | 85 ++++++ lib/beyond_api/services/shop/image.rb | 100 +++++++ .../services/shop/attribute_spec.rb | 58 ++++ spec/beyond_api/services/shop/image_spec.rb | 59 ++++ .../_all/returns_all_shop_attributes.yml | 150 ++++++++++ .../_create/creates_a_new_shop_attribute.yml | 187 ++++++++++++ .../_delete/deletes_a_shop_attribute.yml | 237 ++++++++++++++++ .../_find/returns_a_shop_attribute.yml | 256 +++++++++++++++++ .../updates_an_existing_shop_attribute.yml | 256 +++++++++++++++++ .../_all/returns_all_shop_images.yml | 153 ++++++++++ .../finds_a_shop_image_by_label.yml | 153 ++++++++++ .../_upload_test/uploads_an_image.yml | 143 ++++++++++ .../_delete/deletes_a_shop_image.yml | 245 ++++++++++++++++ .../_find/finds_a_shop_image.yml | 265 ++++++++++++++++++ .../_upload/uploads_an_image.yml | 193 +++++++++++++ 17 files changed, 2551 insertions(+), 8 deletions(-) create mode 100644 lib/beyond_api/services/shop/attribute.rb create mode 100644 lib/beyond_api/services/shop/image.rb create mode 100644 spec/beyond_api/services/shop/attribute_spec.rb create mode 100644 spec/beyond_api/services/shop/image_spec.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Attribute/_all/returns_all_shop_attributes.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_create/creates_a_new_shop_attribute.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_delete/deletes_a_shop_attribute.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_find/returns_a_shop_attribute.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_update/updates_an_existing_shop_attribute.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Image/_all/returns_all_shop_images.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Image/_find_by_label/finds_a_shop_image_by_label.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Image/_upload_test/uploads_an_image.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_delete/deletes_a_shop_image.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_find/finds_a_shop_image.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_upload/uploads_an_image.yml diff --git a/lib/beyond_api/concerns/connection.rb b/lib/beyond_api/concerns/connection.rb index 9109a51..7581096 100644 --- a/lib/beyond_api/concerns/connection.rb +++ b/lib/beyond_api/concerns/connection.rb @@ -32,10 +32,10 @@ def delete(path, params = {}) handle_request { agent.delete(path, parse_request(params)) } end - def upload_file(path, file_path, params = {}) + def upload_file(path, file_path, content_type, params = {}) handle_request do agent.post(path) do |request| - request.headers['Content-Type'] = Utils.file_content_type(file_path) + request.headers['Content-Type'] = content_type request.params = parse_request(params) request.body = File.binread(file_path) end diff --git a/lib/beyond_api/services/product_management/image.rb b/lib/beyond_api/services/product_management/image.rb index 94360a9..b681d9f 100644 --- a/lib/beyond_api/services/product_management/image.rb +++ b/lib/beyond_api/services/product_management/image.rb @@ -25,16 +25,19 @@ def all(id, params = {}) # # @see https://developer.epages.com/beyond-docs/#upload_product_image # - # @param id [String] the product UUID - # @param id [String] the image path - # @param id [String] the image file name + # @param product_id [String] the product UUID + # @param image_path [String] the image path + # @param image_name [String] the image file name # # @return [Hash] # # @example - # client.upload('4125b993-49fc-47c8-b9b3-76d8871e4e06', '/home/epages/file.png', 'file.png') + # @client.upload('4125b993-49fc-47c8-b9b3-76d8871e4e06', '/home/epages/file.png', 'file.png') def upload(product_id, image_path, image_name) - upload_file("products/#{product_id}/images", image_path, file_name: image_name) + upload_file("products/#{product_id}/images", + image_path, + Utils.file_content_type(image_path), + file_name: image_name) end # Upload up to 10 images and add them to a product. The body of the request must contain the content of the images. @@ -51,7 +54,7 @@ def upload(product_id, image_path, image_name) # @example # image_paths = ['/home/epages/file1.png', '/home/epages/file2.png'] # image_names = ['file1.png', 'file2.png'] - # client.upload('4125b993-49fc-47c8-b9b3-76d8871e4e06', image_paths, image_names) + # @client.upload('4125b993-49fc-47c8-b9b3-76d8871e4e06', image_paths, image_names) def upload_multiple(product_id, image_paths, image_names) upload_files("products/#{product_id}/images", { image: Utils.faraday_file_parts(image_paths) }, # body diff --git a/lib/beyond_api/services/shop/attribute.rb b/lib/beyond_api/services/shop/attribute.rb new file mode 100644 index 0000000..2070a77 --- /dev/null +++ b/lib/beyond_api/services/shop/attribute.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +module BeyondApi + module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Attribute.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Attribute < BaseService + # Create a shop attribute. + # + # @see https://developer.epages.com/beyond-docs/#create_shop_attribute + # + # @param name [String] the attribute name + # @param value [String] the attribute value + # @param public [Boolean] flag to indicate if the attribute is public + # + # @return [Hash] + # + # @example + # @client.create('createSku', 'autogenerateSku', true) + def create(name, value, public) + post('shop/attributes', { name:, value:, public: }) + end + + # List of all shop attributes. + # + # @see https://developer.epages.com/beyond-docs/#list_shop_attributes + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + fetch_all_pages('shop/attributes', params) + end + + # Retrieve a particular shop attribute by its name. + # + # @see https://developer.epages.com/beyond-docs/#show_shop_attribute_details + # + # @param name [String] the attribute name + # + # @return [Hash] + # + # @example + # @client.find('createSku') + def find(name) + get("shop/attributes/#{name}") + end + + # Update a shop attribute. This operation is idempotent and will create a new shop attribute if required. + # + # @see https://developer.epages.com/beyond-docs/#update_shop_attribute + # + # @param name [String] the attribute name + # @param value [String] the attribute value + # @param public [Boolean] flag to indicate if the attribute is public + # + # @return [Hash] + # + # @example + # @client.update('createSku', 'autogenerateSku', false) + def update(name, value, public) + put("shop/attributes/#{name}", { value:, public: }) + end + + # Delete a shop attribute. + # + # @see https://developer.epages.com/beyond-docs/#delete_shop_attribute + # + # @param name [String] the attribute name + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('createSku') + def delete(name) + super("shop/attributes/#{name}") + end + end + end +end diff --git a/lib/beyond_api/services/shop/image.rb b/lib/beyond_api/services/shop/image.rb new file mode 100644 index 0000000..c4d4c32 --- /dev/null +++ b/lib/beyond_api/services/shop/image.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +module BeyondApi + module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Image.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Image < BaseService + # Create a shop image. + # + # @see https://developer.epages.com/beyond-docs/#create_shop_image + # + # @param body [String] the request body + # + # @return [Hash] + # + # @example + # @client.create(data_uri: 'file.png?hash=212-2323-4343', width: 250, height: 300, label: 'logo') + def create(body) + post('shop/images', body) + end + + # Retrieve the images of a shop. + # + # @see https://developer.epages.com/beyond-docs/#list_shop_images + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + fetch_all_pages('shop/images', params) + end + + # Search for shop images by label. + # + # @see https://developer.epages.com/beyond-docs/#find_shop_images_by_label + # + # @param label [String] the label to search for + # + # @return [Hash] + # + # @example + # @client.find_by_label('logo') + def find_by_label(label) + get('shop/images/search/find-by-label', label:) + end + + # Retrieve a single shop image. + # + # @see https://developer.epages.com/beyond-docs/#show_shop_image_details + # + # @param id [String] the image UUID + # + # @return [Hash] + # + # @example + # @client.find('de5eaacf-8e85-46cf-8bea-d629e52cf987') + def find(id) + get("shop/images/#{id}") + end + + # Upload a shop image. The request body must contain the content of the shop image. The maximum image size for shop images is 8 MB. + # + # @see https://developer.epages.com/beyond-docs/#upload_shop_image + # + # @param image_path [String] the image path + # @param image_name [String] the image file name + # @param label [String] the image label + # + # @return [Hash] + # + # @example + # @client.upload('/home/epages/file.png', 'file.png', 'logo') + def upload(image_path, image_name, label) + upload_file('shop/images', + image_path, + 'multipart/form-data', + { file_name: image_name, label: }) + end + + # Delete a shop image. + # + # @see https://developer.epages.com/beyond-docs/#delete_shop_image + # + # @param id [String] the image UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('ec535cb3-3155-4c8f-b3cc-2bb94db7c530') + def delete(id) + super("shop/images/#{id}") + end + end + end +end diff --git a/spec/beyond_api/services/shop/attribute_spec.rb b/spec/beyond_api/services/shop/attribute_spec.rb new file mode 100644 index 0000000..43366ab --- /dev/null +++ b/spec/beyond_api/services/shop/attribute_spec.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Shop::Attribute, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all shop attributes' do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :attributes)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + context 'with shop attribute' do + before(:each) do + @shop_attribute = client.create('createSku', 'autogenerateSku', true) + end + + describe '.create' do + it 'creates a new shop attribute' do + expect(@shop_attribute).not_to be nil + expect(@shop_attribute[:name]).to eq('createSku') + expect(@shop_attribute[:value]).to eq('autogenerateSku') + expect(@shop_attribute[:public]).to eq(true) + end + end + + describe '.find' do + it 'returns a shop attribute' do + response = client.find('createSku') + expect(response[:value]).to eq('autogenerateSku') + end + end + + describe '.update' do + it 'updates an existing shop attribute' do + response = client.update('createSku', 'autogenerateSku', false) + expect(response).not_to be nil + expect(response[:name]).to eq('createSku') + expect(response[:value]).to eq('autogenerateSku') + expect(response[:public]).to eq(false) + end + end + + describe '.delete' do + it 'deletes a shop attribute' do + expect(client.delete('createSku')).to eq({}) + end + end + + after(:each) do + client.delete('createSku') + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + end +end diff --git a/spec/beyond_api/services/shop/image_spec.rb b/spec/beyond_api/services/shop/image_spec.rb new file mode 100644 index 0000000..2249447 --- /dev/null +++ b/spec/beyond_api/services/shop/image_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Shop::Image, vcr: { match_requests_on: [:method, :uri] } do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all shop images' do + response = client.all + puts response.dig(:embedded, :images).first[:id] + + expect(response).not_to be nil + puts response.dig(:embedded, :images) + expect(response.dig(:embedded, :images)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + describe '.find_by_label' do + it 'finds a shop image by label' do + response = client.find_by_label('logo') + + expect(response).not_to be nil + expect(response.dig(:embedded, :images)).to be_kind_of(Array) + end + end + + context 'with a shop image' do + before(:each) do + @image = client.upload('spec/files/image1.png', 'new-image.png', 'logo') + end + + describe '.upload' do + it 'uploads an image' do + expect(@image).not_to be nil + expect(@image.dig(:links, :data, :href)).to include('new-image.png') + end + end + + describe '.find' do + it 'finds a shop image' do + response = client.find(@image[:id]) + + expect(response).not_to be nil + expect(response[:id]).to eq(@image[:id]) + end + end + + describe '.delete' do + it 'deletes a shop image' do + expect(client.delete(@image[:id])).to eq({}) + end + end + + after(:each) do + client.delete(@image[:id]) + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Attribute/_all/returns_all_shop_attributes.yml b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/_all/returns_all_shop_attributes.yml new file mode 100644 index 0000000..d55f7c6 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/_all/returns_all_shop_attributes.yml @@ -0,0 +1,150 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:25 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.119' + X-B3-Traceid: + - 8061fb12abaaaed969b01e87ebb70d3f + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728307585, + "jti" : "S2OvWnGiX3IS8Vy8xozQLNpT0Vw=" + } + recorded_at: Mon, 07 Oct 2024 13:26:25 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.207' + X-B3-Traceid: + - 193217d6206c887afd0b7124e2cf54a8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "attributes" : [ { + "name" : "ecommerce:disabled", + "value" : "true", + "public" : true, + "readOnly" : true, + "owner" : "cockpit", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/ecommerce:disabled" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 1, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Mon, 07 Oct 2024 13:26:25 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_create/creates_a_new_shop_attribute.yml b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_create/creates_a_new_shop_attribute.yml new file mode 100644 index 0000000..c3436f7 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_create/creates_a_new_shop_attribute.yml @@ -0,0 +1,187 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:25 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.112' + X-B3-Traceid: + - 21a8957760d94780732768d41a857dc0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728307585, + "jti" : "yWoz0EMkisjH/6gDxvfSlCLDeS4=" + } + recorded_at: Mon, 07 Oct 2024 13:26:25 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes + body: + encoding: UTF-8 + string: '{"name":"createSku","value":"autogenerateSku","public":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 13:26:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.208' + X-B3-Traceid: + - d875c07eaa14d112deea30d14ee43f91 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "createSku", + "value" : "autogenerateSku", + "public" : true, + "readOnly" : false, + "owner" : "ea9423f8-9969-4b0b-b83c-1f4e1ca13bfd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 07 Oct 2024 13:26:26 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 13:26:26 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.202' + X-B3-Traceid: + - 60d7f72a94f2551603db4d7be6067ec6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 13:26:26 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_delete/deletes_a_shop_attribute.yml b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_delete/deletes_a_shop_attribute.yml new file mode 100644 index 0000000..3277186 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_delete/deletes_a_shop_attribute.yml @@ -0,0 +1,237 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:29 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.134' + X-B3-Traceid: + - 27498e04a98671ce64f297e146eaf723 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728307589, + "jti" : "glJyw4D/ZD6mizXfRm+LEj0mNsw=" + } + recorded_at: Mon, 07 Oct 2024 13:26:28 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes + body: + encoding: UTF-8 + string: '{"name":"createSku","value":"autogenerateSku","public":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 13:26:29 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.173' + X-B3-Traceid: + - 3be4c542f3eb80439cb4cb005dc02d38 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "createSku", + "value" : "autogenerateSku", + "public" : true, + "readOnly" : false, + "owner" : "ea9423f8-9969-4b0b-b83c-1f4e1ca13bfd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 07 Oct 2024 13:26:29 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 13:26:29 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.181' + X-B3-Traceid: + - 8d062fbd066e494dfa88ea3e45fffb8d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 13:26:29 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 13:26:29 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.178' + X-B3-Traceid: + - fa723e03c37975230baf25b59f1db5f4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 13:26:29 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_find/returns_a_shop_attribute.yml b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_find/returns_a_shop_attribute.yml new file mode 100644 index 0000000..4af3c9a --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_find/returns_a_shop_attribute.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:26 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.106' + X-B3-Traceid: + - 000ded4eccef126b9a897f5aae802a79 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728307586, + "jti" : "gzd6nSZWYtGyJmR1lAKgemldHB0=" + } + recorded_at: Mon, 07 Oct 2024 13:26:26 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes + body: + encoding: UTF-8 + string: '{"name":"createSku","value":"autogenerateSku","public":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 13:26:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.190' + X-B3-Traceid: + - d0cd310231424bd144ffff75ebc92ef2 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "createSku", + "value" : "autogenerateSku", + "public" : true, + "readOnly" : false, + "owner" : "ea9423f8-9969-4b0b-b83c-1f4e1ca13bfd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 07 Oct 2024 13:26:26 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:27 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.193' + X-B3-Traceid: + - 496496367788b532d3db9f32667fedfa + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "createSku", + "value" : "autogenerateSku", + "public" : true, + "readOnly" : false, + "owner" : "ea9423f8-9969-4b0b-b83c-1f4e1ca13bfd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 07 Oct 2024 13:26:27 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 13:26:27 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.213' + X-B3-Traceid: + - ef23fb78830fecdf3833a10bde410450 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 13:26:27 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_update/updates_an_existing_shop_attribute.yml b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_update/updates_an_existing_shop_attribute.yml new file mode 100644 index 0000000..fcc6d82 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Attribute/with_shop_attribute/_update/updates_an_existing_shop_attribute.yml @@ -0,0 +1,256 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:27 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.127' + X-B3-Traceid: + - 5dbd1a808402666a12fe5013190439e8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728307587, + "jti" : "Wc5DG2H6ucrWbgK/HG/kl6ahon0=" + } + recorded_at: Mon, 07 Oct 2024 13:26:27 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes + body: + encoding: UTF-8 + string: '{"name":"createSku","value":"autogenerateSku","public":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 13:26:28 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.252' + X-B3-Traceid: + - bae8f8609a69f4ba4d641ef9691c15cd + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "createSku", + "value" : "autogenerateSku", + "public" : true, + "readOnly" : false, + "owner" : "ea9423f8-9969-4b0b-b83c-1f4e1ca13bfd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 07 Oct 2024 13:26:28 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: UTF-8 + string: '{"value":"autogenerateSku","public":false}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 13:26:28 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.214' + X-B3-Traceid: + - 7667e5211a5dddda7ed58fc69c29573d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "name" : "createSku", + "value" : "autogenerateSku", + "public" : false, + "readOnly" : false, + "owner" : "ea9423f8-9969-4b0b-b83c-1f4e1ca13bfd", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku" + }, + "owner" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop" + } + } + } + recorded_at: Mon, 07 Oct 2024 13:26:28 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/attributes/createSku + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 13:26:28 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.322' + X-B3-Traceid: + - 2a674e744b82b42c6e331abe21ff4758 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 13:26:28 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Image/_all/returns_all_shop_images.yml b/spec/vcr_cassettes/BeyondApi_Shop_Image/_all/returns_all_shop_images.yml new file mode 100644 index 0000000..9963871 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Image/_all/returns_all_shop_images.yml @@ -0,0 +1,153 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 19:02:03 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.159' + X-B3-Traceid: + - 9fa4b5497c2d2627a2c6e02e7d2c56f4 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728327723, + "jti" : "rvLiOICi0krh2q8oUCmmj4tYixI=" + } + recorded_at: Mon, 07 Oct 2024 19:02:03 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 19:02:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.020' + X-B3-Traceid: + - a6eaa8d55b5fb060f31804d759b87edc + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "images" : [ { + "_id" : "5c4fcf2b-3297-4d6d-b97e-ca1b4584e5d9", + "label" : "invoice logo", + "width" : 1140, + "height" : 420, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/5c4fcf2b-3297-4d6d-b97e-ca1b4584e5d9" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/5c4fcf2b-3297-4d6d-b97e-ca1b4584e5d9" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/logo.png?hash=e4f3d85e586988cb6acc53da319ee8c9d0f3c697{&width,height,upscale}", + "templated" : true + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 1, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Mon, 07 Oct 2024 19:02:04 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Image/_find_by_label/finds_a_shop_image_by_label.yml b/spec/vcr_cassettes/BeyondApi_Shop_Image/_find_by_label/finds_a_shop_image_by_label.yml new file mode 100644 index 0000000..bfe1492 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Image/_find_by_label/finds_a_shop_image_by_label.yml @@ -0,0 +1,153 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 11 Oct 2024 08:57:35 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.093' + X-B3-Traceid: + - beb2caaff28153fea3a51b881cb3a55a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728637055, + "jti" : "PKkxY2Rg0G39s9Zi7bheFh6myiE=" + } + recorded_at: Fri, 11 Oct 2024 08:57:35 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images/search/find-by-label?label=logo + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 11 Oct 2024 08:57:35 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.015' + X-B3-Traceid: + - 694a309ec0393f6bf310a965823d53b6 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "images" : [ { + "_id" : "0fde5629-ba76-412d-898c-f127b733958b", + "label" : "logo", + "width" : 400, + "height" : 400, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/0fde5629-ba76-412d-898c-f127b733958b" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/0fde5629-ba76-412d-898c-f127b733958b" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image.png?hash=54386a565cf2d7f563e8dec800be24434918438d{&width,height,upscale}", + "templated" : true + } + } + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/search/find-by-label?label=logo&page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 1, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Fri, 11 Oct 2024 08:57:35 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Image/_upload_test/uploads_an_image.yml b/spec/vcr_cassettes/BeyondApi_Shop_Image/_upload_test/uploads_an_image.yml new file mode 100644 index 0000000..c42f6f2 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Image/_upload_test/uploads_an_image.yml @@ -0,0 +1,143 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 08 Oct 2024 12:30:55 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.069' + X-B3-Traceid: + - ae2d798ba684d58f600ebf34e6c42ddd + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728390655, + "jti" : "qNz1tE3wjWryHTCXHSa+Xx41emM=" + } + recorded_at: Tue, 08 Oct 2024 12:30:55 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images?fileName=new-image-2.png&label=test + body: + encoding: ASCII-8BIT + string: !binary |- + LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LTE3MWRhY2Q5NGQxOGJlOWE5NTFkODc4OTNhNzY0MmI0DQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImltYWdlIjsgZmlsZW5hbWU9ImltYWdlMi5wbmciDQpDb250ZW50LUxlbmd0aDogMTc4Mw0KQ29udGVudC1UeXBlOiBpbWFnZS9wbmcNCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJpbmFyeQ0KDQqJUE5HDQoaCgAAAA1JSERSAAACWAAAAZAEAwAAAIAbA6sAAAAbUExURQAAAP///x8fH19fX5+fn7+/v9/f339/fz8/P6z6+bIAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAaCSURBVHic7dvNc9NGGMdxW37TsQtJ4GgX4uGIGaA9xi2017rThB4xLbRHXNIMxxjaaf7sSqvVvmgfGZRDu858P4cQ/7Bj+/Gj1Wol93oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8L+49/zs9Kf3QfTP8zen76a9T2afLbsKbubnZ69fPOp9MkvOU6Ud/WGTbKmTw0vvXlLWwUI99G7dr57y594nsuSYWhXVstHSJIfT3s7s82XKL9awfsofd2fJOVbq10fT7MHjtS3WXKkXH3oPnih1u7cr62DsFytbq8P30+zjygulLDnFi/zF/Pani6pt4b574VLWxdJ/2NxszMWWfXtXlpy5OoijO+a3rbq7I+sgV2ETvbXxZXuWnlXcKEsb5XYck7IO5urCPc/Q9c5WvWzPkjOJmz73em1hPm8p62J1OHbF2qqT+tdB3bBSlpxZ/M7H3ic7VLdasw4m6pVXrLXXmks1bc2Ss4y3qa2/3zKfspR1sFWXY2879prZfFhSlpxMGK1Xfv1MMaWsg/VBzxVr5I9Jw+qGlCVnqH5oRlkwis30rknKOj3LS69YM3+XYj4tKUtOP37fg2BIGuuBV8o6WBSDkCvWIhiS1gdtWXIW8RYVNttEbxJSZuXBw/Np9Bd1X7piLQ/9/9wctWXJWcaf4TgYXnPdU1JmrYKJ2vZV9BdHZaldsdbB/mGre0rKkrOOR4fGlqnHDymrDYPxLFdBj2ibo6lfrHBEqv60lKUmU19EWeNj1Z+5lNm/ERwDbFXUWbmuhC1Woy9100pZcnI9+uTnZ2/c2t9CBXdZHbRk1rHXWsWx0LT5JNVbt8UahB/QqNxbSFlyJuWr+qtaRvptWmWN0VUPvVJm+a0lNJa5ty1WY/eg9x1Slpxh8aEfl8t+6+KH2bbCSlR1kjLHtZbUWGbaYYvVqISuk5QlZ6QeDpR6cVm8zQtlXnBjB6knF1LmuNaSGsvMN71infj/PaiKFWfJGavLTb3o/dTsx8IBqXj/LZmnbi2pserH2mI1BqS8HK6kLDl99dEeFRf9oVtrFR4mV8USMk/dWlJj1ZuUV6xgV2eKFWfJ6auFm9IMq7pdo1imtcTG2pon2P9izdTam1Guhcl0NcWSMl/VWlJjZfVDbbHGzcLckrPkzJT/Kmd65LhOsXRriY01qvdzN6FY/n5tqLv/Opuhbi2psYod57T65SZshv5xXbVqda1iFa11R2ostzR1E4oV9LteR2pMExbC1GERF6toLamx3NJX29RhIEwdBokWK5g564l690mpNpcay1uB3v9J6Sx8kbpjuh/uaFvpTLU3Uu//4U5fKFbnA2mtPOUcn3afuwLu/4F0o1h6StB5icY89Hfh3LZ3x/1fohkLxeq6+KeVc6zjqLUm3pi//4t/o7DfdQP1gwbJzLJynAXKOVYWtVZfvT6trVT5s7z2KqxpdV5NylLTGCt0sTqfsOjVR4VRa/VVU/nAfT1h0Rgr9Dgeng+uT4XFma+avEetJRcrPKFtToUJWWrCM83VeJw3Tqi+bck89VFhs7WyL525elT8LO8W9k3VU1KWnHC/Vr3X4LoPs8IiZX5QDeTxqOW4U2F9v9bVqR8xS87G/0TNavlSuAhEyiy33BDvEC1XrGCbNjekLDnBFH5c7Rs7X3Lklht2tNYNuOQouDDNXKo+8mZHI7MHkLKav47V3lrexWwr7yhypdqz1GTeglZmzlj4Z+A35i1KWc1fx2pvreAySTu7s1dpSllyNu5Fzusu29htc2BrJGWVcIG0tbW8Yk3cBaqL+umlLDkj+42JXLkVp/qFb2zTSFllEtzOhONGzStWsZ2d1I+1hZay5KzUwbT8N1/ZnrDfI/jbXZIuZcbF1L913NIWfrHm6uihec67u7LkDJU6fPfh6vFaHV3WWfkNla+vPn7nL35KWSXbccvxi1WMbEffXunnnO7K0mO/5/RNnB0I97vmJYx+sXqDtfljJ7uz9DxpfoGucBFcWNOefb6gWL3JOn5OKUtP/tWzZ80vXd47f/Z983uSUnZdmfCcUgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/7l/Aav8Mq93IWbxAAAAAElFTkSuQmCCDQotLS0tLS0tLS0tLS0tUnVieU11bHRpcGFydFBvc3QtMTcxZGFjZDk0ZDE4YmU5YTk1MWQ4Nzg5M2E3NjQyYjQtLQ0K + headers: + Accept: + - application/json + Content-Type: + - multipart/form-data; boundary=-----------RubyMultipartPost-171dacd94d18be9a951d87893a7642b4 + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Content-Length: + - '2070' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 08 Oct 2024 12:30:56 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/images/ff1a5fbd-67ed-49a8-8026-a6e5df02d05c + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.168' + X-B3-Traceid: + - 600a3aac128d942a1c52cf2fcdce2e6e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "ff1a5fbd-67ed-49a8-8026-a6e5df02d05c", + "label" : "test", + "width" : 600, + "height" : 400, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/ff1a5fbd-67ed-49a8-8026-a6e5df02d05c" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/ff1a5fbd-67ed-49a8-8026-a6e5df02d05c" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image-2.png?hash=69edee39d8acbbb605eb5116c46c3a2eb6b2429f{&width,height,upscale}", + "templated" : true + } + } + } + recorded_at: Tue, 08 Oct 2024 12:30:56 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_delete/deletes_a_shop_image.yml b/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_delete/deletes_a_shop_image.yml new file mode 100644 index 0000000..a40d9a6 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_delete/deletes_a_shop_image.yml @@ -0,0 +1,245 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 19:02:06 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.175' + X-B3-Traceid: + - 3c7df241da651b776ed71288e7759a17 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728327726, + "jti" : "Po9mxmRGMwTEPxx+cSBNg6t0Y0k=" + } + recorded_at: Mon, 07 Oct 2024 19:02:06 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images?fileName=new-image.png&label=logo + body: + encoding: ASCII-8BIT + string: !binary |- + LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LWNkNzVmZWQwMTk2NmYyNGUwMzc5YTUwMzY0NjczNzI3DQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImltYWdlIjsgZmlsZW5hbWU9ImltYWdlMS5wbmciDQpDb250ZW50LUxlbmd0aDogMTA5Nw0KQ29udGVudC1UeXBlOiBpbWFnZS9wbmcNCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJpbmFyeQ0KDQqJUE5HDQoaCgAAAA1JSERSAAABkAAAAZAEAwAAAHKRK/8AAAAbUExURQAAAP///x8fH7+/v9/f339/fz8/P5+fn19fX8TDkjcAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAPUSURBVHic7dnPT9swFMBxK9C0x5lmP45tVaEd6Q7bjg1iP45UGoJjizhwpNp2p9M28Wcv9ntOUjaWKEpWNH0/BxpX8Ytf7NhuMAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP9DNApH12cX+bGJf5x9qxdgkh81DNCS2VwPPllrk1Mt9NKs9K5O/b0kHDUM0JKencvBlX13d54mI1+I0+Tixxd7XCPAIiTSNEBLVppIbN9nfwepXHqVLLO/37VVfxPbJBw0C9CWVIfWdCgfvllReiQf88r6+0NNpGmAlvSHK7nWWu5kZN0g7+udHD+tDLB+rYk0DdCSzbEkEtlb+WLhiuMXUuglf6pTNkgO5ZymAVoS2aUkkl/RN8E3pty6B42fxVKzaYCW7D01ksh+GAN9N9TTMImujyoCzE41kaYBWrI40kTGB/rNwLr7ONLS5kk4s5fXOTWF3tBoIpUBOhVnF5RENnP9yrVhkI/svHnFre0PSwFWByGRygCd2s/GsySyyIdAeuvuc+kEMQ3frZ+VAmQnayKVATq1vgmJuCMxOzX956Gwl0+fujKYvl0W9d2JmkhlgC75ESCJzPKRn7WouHrRotAlWx3ixpMmUh2gQ2PXKEkkGw9FO4rxUGqHdMlWh0SuoIlUB+iQv4v3E8kGe9GOXunJ9l2y1SH+xv+WyIMBOiMXqZ2I65KtDpEH/BEksvK7o9qJuC7Z6pDYb6h2n0iULt1H/USi9M1Wh0x9VrtPZE+eQ5218na4SeeBZ3Vqyx1iZn7GDbNWnQDd0LW47vTrSra8c9Lle+fTb9gP1VwQ/UlJeaDo7mPnC2IYxzW3KMZ1yGVa6hJ9Kna+RdkkJ16afd7U2vNlU9a06JKBlfon2eeHXW4aN7ZwJIu8b1+iK7acNC8quDUkKrpkUKo/NHUCdCSaiM3xZFL+XeSGd/G76Kao4NeQUpdo/ZfJZDKqFaBjdX/qyqIelZ8S73H81DUhkep3B7qoT++vcPGjePlgQiJmIW9zYt+enr7NWRVzTthl/dYlmkhlgM5pIvty6Su54fK+MC41ehEe5vtdEhKpCtA5TSRKPxr3Jlju6zS5Ne617ig/7WqpB9HH7fohkaoAndNEso3U87PPdjjSVtmv5zP7qkb9kEjjAG0JiZjvbkG41cLA/VfgbZ36eSJNA7Tv8O7nKC9E13eX/zwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACP2C/ZfbbcqobJ/QAAAABJRU5ErkJggg0KLS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LWNkNzVmZWQwMTk2NmYyNGUwMzc5YTUwMzY0NjczNzI3LS0NCg== + headers: + Accept: + - application/json + Content-Type: + - multipart/form-data; boundary=-----------RubyMultipartPost-cd75fed01966f24e0379a50364673727 + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Content-Length: + - '1384' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 19:02:06 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/images/59b627d7-7738-4ac0-b051-4cfcc39cb06c + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.120' + X-B3-Traceid: + - 2949e8a078daefd5893c933b0ce1f988 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "59b627d7-7738-4ac0-b051-4cfcc39cb06c", + "label" : "logo", + "width" : 400, + "height" : 400, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/59b627d7-7738-4ac0-b051-4cfcc39cb06c" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/59b627d7-7738-4ac0-b051-4cfcc39cb06c" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image.png?hash=54386a565cf2d7f563e8dec800be24434918438d{&width,height,upscale}", + "templated" : true + } + } + } + recorded_at: Mon, 07 Oct 2024 19:02:06 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images/59b627d7-7738-4ac0-b051-4cfcc39cb06c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 19:02:06 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.045' + X-B3-Traceid: + - 5e5b2cbd79b920e3d51b62562b058896 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 19:02:06 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images/59b627d7-7738-4ac0-b051-4cfcc39cb06c + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 07 Oct 2024 19:02:06 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.053' + X-B3-Traceid: + - '000438f00875295a1a3b0100b32bf884' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 19:02:06 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_find/finds_a_shop_image.yml b/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_find/finds_a_shop_image.yml new file mode 100644 index 0000000..71c38b1 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_find/finds_a_shop_image.yml @@ -0,0 +1,265 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 19:02:05 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.124' + X-B3-Traceid: + - eaa0da0a77b0ba2e678922f41a644afe + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728327725, + "jti" : "ehLS8L/42F6CJBOoyVeqXKJiWZA=" + } + recorded_at: Mon, 07 Oct 2024 19:02:05 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images?fileName=new-image.png&label=logo + body: + encoding: ASCII-8BIT + string: !binary |- + LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LTgzN2E2ZGZiMjE2NDgxMjNmMTE4NDhhZmIxOGI0NmUwDQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImltYWdlIjsgZmlsZW5hbWU9ImltYWdlMS5wbmciDQpDb250ZW50LUxlbmd0aDogMTA5Nw0KQ29udGVudC1UeXBlOiBpbWFnZS9wbmcNCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJpbmFyeQ0KDQqJUE5HDQoaCgAAAA1JSERSAAABkAAAAZAEAwAAAHKRK/8AAAAbUExURQAAAP///x8fH7+/v9/f339/fz8/P5+fn19fX8TDkjcAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAPUSURBVHic7dnPT9swFMBxK9C0x5lmP45tVaEd6Q7bjg1iP45UGoJjizhwpNp2p9M28Wcv9ntOUjaWKEpWNH0/BxpX8Ytf7NhuMAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP9DNApH12cX+bGJf5x9qxdgkh81DNCS2VwPPllrk1Mt9NKs9K5O/b0kHDUM0JKencvBlX13d54mI1+I0+Tixxd7XCPAIiTSNEBLVppIbN9nfwepXHqVLLO/37VVfxPbJBw0C9CWVIfWdCgfvllReiQf88r6+0NNpGmAlvSHK7nWWu5kZN0g7+udHD+tDLB+rYk0DdCSzbEkEtlb+WLhiuMXUuglf6pTNkgO5ZymAVoS2aUkkl/RN8E3pty6B42fxVKzaYCW7D01ksh+GAN9N9TTMImujyoCzE41kaYBWrI40kTGB/rNwLr7ONLS5kk4s5fXOTWF3tBoIpUBOhVnF5RENnP9yrVhkI/svHnFre0PSwFWByGRygCd2s/GsySyyIdAeuvuc+kEMQ3frZ+VAmQnayKVATq1vgmJuCMxOzX956Gwl0+fujKYvl0W9d2JmkhlgC75ESCJzPKRn7WouHrRotAlWx3ixpMmUh2gQ2PXKEkkGw9FO4rxUGqHdMlWh0SuoIlUB+iQv4v3E8kGe9GOXunJ9l2y1SH+xv+WyIMBOiMXqZ2I65KtDpEH/BEksvK7o9qJuC7Z6pDYb6h2n0iULt1H/USi9M1Wh0x9VrtPZE+eQ5218na4SeeBZ3Vqyx1iZn7GDbNWnQDd0LW47vTrSra8c9Lle+fTb9gP1VwQ/UlJeaDo7mPnC2IYxzW3KMZ1yGVa6hJ9Kna+RdkkJ16afd7U2vNlU9a06JKBlfon2eeHXW4aN7ZwJIu8b1+iK7acNC8quDUkKrpkUKo/NHUCdCSaiM3xZFL+XeSGd/G76Kao4NeQUpdo/ZfJZDKqFaBjdX/qyqIelZ8S73H81DUhkep3B7qoT++vcPGjePlgQiJmIW9zYt+enr7NWRVzTthl/dYlmkhlgM5pIvty6Su54fK+MC41ehEe5vtdEhKpCtA5TSRKPxr3Jlju6zS5Ne617ig/7WqpB9HH7fohkaoAndNEso3U87PPdjjSVtmv5zP7qkb9kEjjAG0JiZjvbkG41cLA/VfgbZ36eSJNA7Tv8O7nKC9E13eX/zwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACP2C/ZfbbcqobJ/QAAAABJRU5ErkJggg0KLS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LTgzN2E2ZGZiMjE2NDgxMjNmMTE4NDhhZmIxOGI0NmUwLS0NCg== + headers: + Accept: + - application/json + Content-Type: + - multipart/form-data; boundary=-----------RubyMultipartPost-837a6dfb21648123f11848afb18b46e0 + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Content-Length: + - '1384' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 19:02:05 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/images/80952e3a-4561-44e5-b62e-8c9b0237512d + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.136' + X-B3-Traceid: + - 5f6b99a61cae04f37fef367afb673a46 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "80952e3a-4561-44e5-b62e-8c9b0237512d", + "label" : "logo", + "width" : 400, + "height" : 400, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/80952e3a-4561-44e5-b62e-8c9b0237512d" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/80952e3a-4561-44e5-b62e-8c9b0237512d" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image.png?hash=54386a565cf2d7f563e8dec800be24434918438d{&width,height,upscale}", + "templated" : true + } + } + } + recorded_at: Mon, 07 Oct 2024 19:02:05 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images/80952e3a-4561-44e5-b62e-8c9b0237512d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 19:02:05 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - 4c869d42aa484663f42c8fdeb3c9e7ce + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "80952e3a-4561-44e5-b62e-8c9b0237512d", + "label" : "logo", + "width" : 400, + "height" : 400, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/80952e3a-4561-44e5-b62e-8c9b0237512d" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/80952e3a-4561-44e5-b62e-8c9b0237512d" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image.png?hash=54386a565cf2d7f563e8dec800be24434918438d{&width,height,upscale}", + "templated" : true + } + } + } + recorded_at: Mon, 07 Oct 2024 19:02:05 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images/80952e3a-4561-44e5-b62e-8c9b0237512d + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 19:02:05 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.038' + X-B3-Traceid: + - 85eccf9257d41ae655b3c7405f57cf08 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 19:02:05 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_upload/uploads_an_image.yml b/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_upload/uploads_an_image.yml new file mode 100644 index 0000000..66388c6 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Image/with_a_shop_image/_upload/uploads_an_image.yml @@ -0,0 +1,193 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 07 Oct 2024 19:02:04 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.096' + X-B3-Traceid: + - a6e693b690fa848bc1cfd7a85a9594f7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728327724, + "jti" : "0IogORUK/whqV/Hoz0rUJIbuBs4=" + } + recorded_at: Mon, 07 Oct 2024 19:02:04 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images?fileName=new-image.png&label=logo + body: + encoding: ASCII-8BIT + string: !binary |- + LS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LWQ2NGRjMDJhZGYxOTBhZmI4OGRmMTM0MTkxZTY2NzkxDQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImltYWdlIjsgZmlsZW5hbWU9ImltYWdlMS5wbmciDQpDb250ZW50LUxlbmd0aDogMTA5Nw0KQ29udGVudC1UeXBlOiBpbWFnZS9wbmcNCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IGJpbmFyeQ0KDQqJUE5HDQoaCgAAAA1JSERSAAABkAAAAZAEAwAAAHKRK/8AAAAbUExURQAAAP///x8fH7+/v9/f339/fz8/P5+fn19fX8TDkjcAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAPUSURBVHic7dnPT9swFMBxK9C0x5lmP45tVaEd6Q7bjg1iP45UGoJjizhwpNp2p9M28Wcv9ntOUjaWKEpWNH0/BxpX8Ytf7NhuMAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgP9DNApH12cX+bGJf5x9qxdgkh81DNCS2VwPPllrk1Mt9NKs9K5O/b0kHDUM0JKencvBlX13d54mI1+I0+Tixxd7XCPAIiTSNEBLVppIbN9nfwepXHqVLLO/37VVfxPbJBw0C9CWVIfWdCgfvllReiQf88r6+0NNpGmAlvSHK7nWWu5kZN0g7+udHD+tDLB+rYk0DdCSzbEkEtlb+WLhiuMXUuglf6pTNkgO5ZymAVoS2aUkkl/RN8E3pty6B42fxVKzaYCW7D01ksh+GAN9N9TTMImujyoCzE41kaYBWrI40kTGB/rNwLr7ONLS5kk4s5fXOTWF3tBoIpUBOhVnF5RENnP9yrVhkI/svHnFre0PSwFWByGRygCd2s/GsySyyIdAeuvuc+kEMQ3frZ+VAmQnayKVATq1vgmJuCMxOzX956Gwl0+fujKYvl0W9d2JmkhlgC75ESCJzPKRn7WouHrRotAlWx3ixpMmUh2gQ2PXKEkkGw9FO4rxUGqHdMlWh0SuoIlUB+iQv4v3E8kGe9GOXunJ9l2y1SH+xv+WyIMBOiMXqZ2I65KtDpEH/BEksvK7o9qJuC7Z6pDYb6h2n0iULt1H/USi9M1Wh0x9VrtPZE+eQ5218na4SeeBZ3Vqyx1iZn7GDbNWnQDd0LW47vTrSra8c9Lle+fTb9gP1VwQ/UlJeaDo7mPnC2IYxzW3KMZ1yGVa6hJ9Kna+RdkkJ16afd7U2vNlU9a06JKBlfon2eeHXW4aN7ZwJIu8b1+iK7acNC8quDUkKrpkUKo/NHUCdCSaiM3xZFL+XeSGd/G76Kao4NeQUpdo/ZfJZDKqFaBjdX/qyqIelZ8S73H81DUhkep3B7qoT++vcPGjePlgQiJmIW9zYt+enr7NWRVzTthl/dYlmkhlgM5pIvty6Su54fK+MC41ehEe5vtdEhKpCtA5TSRKPxr3Jlju6zS5Ne617ig/7WqpB9HH7fohkaoAndNEso3U87PPdjjSVtmv5zP7qkb9kEjjAG0JiZjvbkG41cLA/VfgbZ36eSJNA7Tv8O7nKC9E13eX/zwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACP2C/ZfbbcqobJ/QAAAABJRU5ErkJggg0KLS0tLS0tLS0tLS0tLVJ1YnlNdWx0aXBhcnRQb3N0LWQ2NGRjMDJhZGYxOTBhZmI4OGRmMTM0MTkxZTY2NzkxLS0NCg== + headers: + Accept: + - application/json + Content-Type: + - multipart/form-data; boundary=-----------RubyMultipartPost-d64dc02adf190afb88df134191e66791 + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Content-Length: + - '1384' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 07 Oct 2024 19:02:05 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/images/0121a830-6643-4793-b174-e85ea905f518 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.293' + X-B3-Traceid: + - 84eef16d400978968d166ce4590ff8e0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "0121a830-6643-4793-b174-e85ea905f518", + "label" : "logo", + "width" : 400, + "height" : 400, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/0121a830-6643-4793-b174-e85ea905f518" + }, + "image" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/images/0121a830-6643-4793-b174-e85ea905f518" + }, + "data" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/core-storage/images/new-image.png?hash=54386a565cf2d7f563e8dec800be24434918438d{&width,height,upscale}", + "templated" : true + } + } + } + recorded_at: Mon, 07 Oct 2024 19:02:05 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/images/0121a830-6643-4793-b174-e85ea905f518 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Mon, 07 Oct 2024 19:02:05 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - b04208975f7ae95f6385c1f28b01e475 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Mon, 07 Oct 2024 19:02:05 GMT +recorded_with: VCR 6.2.0 From 3bdb42a6f035037c457aea20ba3ab67add9ed0e2 Mon Sep 17 00:00:00 2001 From: Kenneth Gallego Date: Tue, 15 Oct 2024 08:14:16 +0200 Subject: [PATCH 59/59] Add locations endpoint (#88) --- lib/beyond_api/services/shop/location.rb | 123 +++++++ .../product_management/category_spec.rb | 10 +- .../beyond_api/services/shop/location_spec.rb | 57 +++ spec/factories/location_data.rb | 72 ++++ .../_all/returns_all_shop_locations.yml | 136 ++++++++ .../_create/creates_a_new_shop_location.yml | 222 ++++++++++++ .../_delete/deletes_a_shop_location.yml | 274 +++++++++++++++ .../_find/returns_a_shop_location.yml | 324 +++++++++++++++++ .../_update/updates_a_shop_location.yml | 326 ++++++++++++++++++ 9 files changed, 1539 insertions(+), 5 deletions(-) create mode 100644 lib/beyond_api/services/shop/location.rb create mode 100644 spec/beyond_api/services/shop/location_spec.rb create mode 100644 spec/factories/location_data.rb create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Location/_all/returns_all_shop_locations.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_create/creates_a_new_shop_location.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_delete/deletes_a_shop_location.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_find/returns_a_shop_location.yml create mode 100644 spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_update/updates_a_shop_location.yml diff --git a/lib/beyond_api/services/shop/location.rb b/lib/beyond_api/services/shop/location.rb new file mode 100644 index 0000000..04bf509 --- /dev/null +++ b/lib/beyond_api/services/shop/location.rb @@ -0,0 +1,123 @@ +# frozen_string_literal: true + +module BeyondApi + module Shop + # @example How to instantiate a client + # @client = BeyondApi::Shop::Location.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Location < BaseService + # Create a location. + # + # @see https://developer.epages.com/beyond-docs/#create_location + # + # param body [Hash] the request body + # + # return [hash] + # + # @example + # body = { + # "languageCode": "de", + # "storeCode": "MLC-St-Ives", + # "companyName": "My little Cornershop - St.Ives", + # "primaryPhone": "(800) 555-0102", + # "address": { + # "postalCode": "90999", + # "street": "Hudson Way", + # "houseNumber": "27", + # "city": "St.Ives", + # "country": "GB", + # "dependentLocality": "", + # "state": "Cornwall" + # }, + # "googleStatus": "ACTIVE", + # "googlePrimaryCategory": { + # "categoryId": "gcid:storefood", + # "displayName": "Food" + # }, + # "googleAdditionalCategories": [ { + # "displayName": "Drinks", + # "categoryId": "gcid:storedrinks" + # } ], + # "regularHours": { + # "periods": [ { + # "openDay": "MONDAY", + # "openTime": "08:00", + # "closeDay": "MONDAY", + # "closeTime": "17:00" + # }, { + # "openDay": "SATURDAY", + # "openTime": "10:00", + # "closeDay": "SATURDAY", + # "closeTime": "16:00" + # } ] + # }, + # "latLng": { + # "latitude": 53.5847424, + # "longitude": 9.968901 + # } + # } + # @client.create(body) + def create(body) + post('shop/locations', body) + end + + # Retrieve a list of all locations for the current shop + # + # @see https://developer.epages.com/beyond-docs/#list_locations + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + get('shop/locations', params) + end + + # Retrieve details of a location + # + # @see https://developer.epages.com/beyond-docs/#show_location_details + # + # @param id [String] the location UUID + # + # @return [Hash] + # + # @example + # @client.find('869fe0f1-e5ce-491c-914e-5160a4b1cf2f') + def find(location_id) + get("shop/locations/#{location_id}") + end + + # Update a location + # + # @see https://developer.epages.com/beyond-docs/#update_location + # + # @param id [String] The language UUID + # param body [Hash] the request body + # + # @return [Hash] + # + # @example + # @client.update('869fe0f1-e5ce-491c-914e-5160a4b1cf2f', body) + def update(location_id, body) + put("shop/locations/#{location_id}", body) + end + + # Delete a location + # + # @see https://developer.epages.com/beyond-docs/#delete_location + # + # @param id [String] The language UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('869fe0f1-e5ce-491c-914e-5160a4b1cf2f') + def delete(location_id) + super("shop/locations/#{location_id}") + end + end + end +end diff --git a/spec/beyond_api/services/product_management/category_spec.rb b/spec/beyond_api/services/product_management/category_spec.rb index 21504d6..fae10b8 100644 --- a/spec/beyond_api/services/product_management/category_spec.rb +++ b/spec/beyond_api/services/product_management/category_spec.rb @@ -18,6 +18,11 @@ @category = client.create(build(:category_data)) end + after(:each) do + client.delete(@category[:id]) + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + describe '.create' do it 'creates a new category' do expect(@category).not_to be nil @@ -51,10 +56,5 @@ expect(response).to eq({}) end end - - after(:each) do - client.delete(@category[:id]) - rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException - end end end diff --git a/spec/beyond_api/services/shop/location_spec.rb b/spec/beyond_api/services/shop/location_spec.rb new file mode 100644 index 0000000..45ada88 --- /dev/null +++ b/spec/beyond_api/services/shop/location_spec.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Shop::Location, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all shop locations' do + response = client.all + + expect(response).to be_present + expect(response.dig(:embedded, :locations)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + context 'with location' do + before(:each) do + @location = client.create(build(:location_data)) + end + + after(:each) do + client.delete(@location[:id]) + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + + describe '.create' do + it 'creates a new shop location' do + expect(@location).to be_present + expect(@location[:store_code]).to eq('MLC-St-Ives') + end + end + + describe '.find' do + it 'returns a shop location' do + response = client.find(@location[:id]) + expect(response[:store_code]).to eq('MLC-St-Ives') + end + end + + describe '.update' do + it 'updates a shop location' do + updated_location_data = FactoryBot.build(:location_data, :alternative_name) + response = client.update(@location[:id], updated_location_data) + + expect(response).to be_present + expect(response[:company_name]).to eq('Updated Cornershop') + end + end + + describe '.delete' do + it 'deletes a shop location' do + response = client.delete(@location[:id]) + expect(response).to eq({}) + end + end + end +end diff --git a/spec/factories/location_data.rb b/spec/factories/location_data.rb new file mode 100644 index 0000000..8cd1d28 --- /dev/null +++ b/spec/factories/location_data.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :location_data, class: Hash do + language_code { 'en' } + store_code { 'MLC-St-Ives' } + company_name { 'My little Cornershop - St.Ives' } + primary_phone { '(800) 555-0102' } + + address do + { + postal_code: '90999', + street: 'Hudson Way', + house_number: '27', + city: 'St.Ives', + country: 'GB', + dependent_locality: '', + state: 'Cornwall' + } + end + + google_status { 'ACTIVE' } + + google_primary_category do + { + category_id: 'gcid:storefood', + display_name: 'Food' + } + end + + google_additional_categories do + [ + { + display_name: 'Drinks', + category_id: 'gcid:storedrinks' + } + ] + end + + regular_hours do + { + periods: [ + { + open_day: 'MONDAY', + open_time: '08:00', + close_day: 'MONDAY', + close_time: '17:00' + }, + { + open_day: 'SATURDAY', + open_time: '10:00', + close_day: 'SATURDAY', + close_time: '16:00' + } + ] + } + end + + lat_lng do + { + latitude: 53.5847424, + longitude: 9.968901 + } + end + + trait :alternative_name do + company_name { 'Updated Cornershop' } + end + + initialize_with { attributes } + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Location/_all/returns_all_shop_locations.yml b/spec/vcr_cassettes/BeyondApi_Shop_Location/_all/returns_all_shop_locations.yml new file mode 100644 index 0000000..5b6b33c --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Location/_all/returns_all_shop_locations.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:18 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.211' + X-B3-Traceid: + - eefbcf59fcd29941d3044a86650abcb2 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728571998, + "jti" : "EqWcFgvfMZ7j6HoHkvv+lsezTGI=" + } + recorded_at: Thu, 10 Oct 2024 14:53:18 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:18 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.087' + X-B3-Traceid: + - 61dc504d7a69fe05c4998f455275f405 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "locations" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations?page=0&size=20&sort=createdAt,asc" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Thu, 10 Oct 2024 14:53:18 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_create/creates_a_new_shop_location.yml b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_create/creates_a_new_shop_location.yml new file mode 100644 index 0000000..743055a --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_create/creates_a_new_shop_location.yml @@ -0,0 +1,222 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:18 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.120' + X-B3-Traceid: + - f387c0f33009487fa59ca22b547bad28 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728571998, + "jti" : "JdpG0j3tesmecsjHCH9GnyuPPsw=" + } + recorded_at: Thu, 10 Oct 2024 14:53:18 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations + body: + encoding: UTF-8 + string: '{"languageCode":"en","storeCode":"MLC-St-Ives","companyName":"My little + Cornershop - St.Ives","primaryPhone":"(800) 555-0102","address":{"postalCode":"90999","street":"Hudson + Way","houseNumber":"27","city":"St.Ives","country":"GB","dependentLocality":"","state":"Cornwall"},"googleStatus":"ACTIVE","googlePrimaryCategory":{"categoryId":"gcid:storefood","displayName":"Food"},"googleAdditionalCategories":[{"displayName":"Drinks","categoryId":"gcid:storedrinks"}],"regularHours":{"periods":[{"openDay":"MONDAY","openTime":"08:00","closeDay":"MONDAY","closeTime":"17:00"},{"openDay":"SATURDAY","openTime":"10:00","closeDay":"SATURDAY","closeTime":"16:00"}]},"latLng":{"latitude":53.5847424,"longitude":9.968901}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 10 Oct 2024 14:53:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/locations/b5ca0a65-b15b-44b6-93b5-99a86dfecba6 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.090' + X-B3-Traceid: + - 53e5c924c5cec8dbd06d7c8154262166 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "b5ca0a65-b15b-44b6-93b5-99a86dfecba6", + "storeCode" : "MLC-St-Ives", + "languageCode" : "en", + "address" : { + "street" : "Hudson Way", + "houseNumber" : "27", + "postalCode" : "90999", + "city" : "St.Ives", + "country" : "GB", + "dependentLocality" : "", + "state" : "Cornwall", + "displayAddressLines" : [ "27 Hudson Way", "ST.IVES", "90999", "UNITED KINGDOM" ] + }, + "companyName" : "My little Cornershop - St.Ives", + "primaryPhone" : "(800) 555-0102", + "googleStatus" : "ACTIVE", + "googlePrimaryCategory" : { + "displayName" : "Food", + "categoryId" : "gcid:storefood" + }, + "googleAdditionalCategories" : [ { + "displayName" : "Drinks", + "categoryId" : "gcid:storedrinks" + } ], + "latLng" : { + "latitude" : 53.5847424, + "longitude" : 9.968901 + }, + "regularHours" : { + "periods" : [ { + "openDay" : "MONDAY", + "openTime" : "08:00", + "closeDay" : "MONDAY", + "closeTime" : "17:00" + }, { + "openDay" : "SATURDAY", + "openTime" : "10:00", + "closeDay" : "SATURDAY", + "closeTime" : "16:00" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations/b5ca0a65-b15b-44b6-93b5-99a86dfecba6" + } + } + } + recorded_at: Thu, 10 Oct 2024 14:53:19 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/b5ca0a65-b15b-44b6-93b5-99a86dfecba6 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 10 Oct 2024 14:53:19 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.056' + X-B3-Traceid: + - 0beabd9e843630d6e38e45f61804baa0 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 10 Oct 2024 14:53:19 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_delete/deletes_a_shop_location.yml b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_delete/deletes_a_shop_location.yml new file mode 100644 index 0000000..308ea95 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_delete/deletes_a_shop_location.yml @@ -0,0 +1,274 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:21 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.131' + X-B3-Traceid: + - 9a937df50e5c4e91a56a9b278161012c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728572001, + "jti" : "d+nVa4xkMmsYZygYWfY4v+y2dJI=" + } + recorded_at: Thu, 10 Oct 2024 14:53:21 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations + body: + encoding: UTF-8 + string: '{"languageCode":"en","storeCode":"MLC-St-Ives","companyName":"My little + Cornershop - St.Ives","primaryPhone":"(800) 555-0102","address":{"postalCode":"90999","street":"Hudson + Way","houseNumber":"27","city":"St.Ives","country":"GB","dependentLocality":"","state":"Cornwall"},"googleStatus":"ACTIVE","googlePrimaryCategory":{"categoryId":"gcid:storefood","displayName":"Food"},"googleAdditionalCategories":[{"displayName":"Drinks","categoryId":"gcid:storedrinks"}],"regularHours":{"periods":[{"openDay":"MONDAY","openTime":"08:00","closeDay":"MONDAY","closeTime":"17:00"},{"openDay":"SATURDAY","openTime":"10:00","closeDay":"SATURDAY","closeTime":"16:00"}]},"latLng":{"latitude":53.5847424,"longitude":9.968901}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 10 Oct 2024 14:53:21 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/locations/20840fc4-aa39-4571-bd62-13d15f01f249 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.054' + X-B3-Traceid: + - 02f94379b9a014ac81fefac8c25c82a9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "20840fc4-aa39-4571-bd62-13d15f01f249", + "storeCode" : "MLC-St-Ives", + "languageCode" : "en", + "address" : { + "street" : "Hudson Way", + "houseNumber" : "27", + "postalCode" : "90999", + "city" : "St.Ives", + "country" : "GB", + "dependentLocality" : "", + "state" : "Cornwall", + "displayAddressLines" : [ "27 Hudson Way", "ST.IVES", "90999", "UNITED KINGDOM" ] + }, + "companyName" : "My little Cornershop - St.Ives", + "primaryPhone" : "(800) 555-0102", + "googleStatus" : "ACTIVE", + "googlePrimaryCategory" : { + "displayName" : "Food", + "categoryId" : "gcid:storefood" + }, + "googleAdditionalCategories" : [ { + "displayName" : "Drinks", + "categoryId" : "gcid:storedrinks" + } ], + "latLng" : { + "latitude" : 53.5847424, + "longitude" : 9.968901 + }, + "regularHours" : { + "periods" : [ { + "openDay" : "MONDAY", + "openTime" : "08:00", + "closeDay" : "MONDAY", + "closeTime" : "17:00" + }, { + "openDay" : "SATURDAY", + "openTime" : "10:00", + "closeDay" : "SATURDAY", + "closeTime" : "16:00" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations/20840fc4-aa39-4571-bd62-13d15f01f249" + } + } + } + recorded_at: Thu, 10 Oct 2024 14:53:21 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/20840fc4-aa39-4571-bd62-13d15f01f249 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 10 Oct 2024 14:53:21 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.052' + X-B3-Traceid: + - f2af1fec575148c96fae7d920f8b5749 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 10 Oct 2024 14:53:21 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/20840fc4-aa39-4571-bd62-13d15f01f249 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Thu, 10 Oct 2024 14:53:21 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.015' + X-B3-Traceid: + - f496317e9c7d50d5f7aef92a7fc71001 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 10 Oct 2024 14:53:21 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_find/returns_a_shop_location.yml b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_find/returns_a_shop_location.yml new file mode 100644 index 0000000..72f0d03 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_find/returns_a_shop_location.yml @@ -0,0 +1,324 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:19 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.099' + X-B3-Traceid: + - 78645c4ac81e4ed07b2665a50f8f0dae + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728571999, + "jti" : "2zmmYhwZMMJH2I/DndPH0A8sYKk=" + } + recorded_at: Thu, 10 Oct 2024 14:53:19 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations + body: + encoding: UTF-8 + string: '{"languageCode":"en","storeCode":"MLC-St-Ives","companyName":"My little + Cornershop - St.Ives","primaryPhone":"(800) 555-0102","address":{"postalCode":"90999","street":"Hudson + Way","houseNumber":"27","city":"St.Ives","country":"GB","dependentLocality":"","state":"Cornwall"},"googleStatus":"ACTIVE","googlePrimaryCategory":{"categoryId":"gcid:storefood","displayName":"Food"},"googleAdditionalCategories":[{"displayName":"Drinks","categoryId":"gcid:storedrinks"}],"regularHours":{"periods":[{"openDay":"MONDAY","openTime":"08:00","closeDay":"MONDAY","closeTime":"17:00"},{"openDay":"SATURDAY","openTime":"10:00","closeDay":"SATURDAY","closeTime":"16:00"}]},"latLng":{"latitude":53.5847424,"longitude":9.968901}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 10 Oct 2024 14:53:19 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/locations/952797f5-b36d-4808-9c38-b4fd4e498190 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.045' + X-B3-Traceid: + - 88177eb05756b661bdb2f1cd99562961 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "952797f5-b36d-4808-9c38-b4fd4e498190", + "storeCode" : "MLC-St-Ives", + "languageCode" : "en", + "address" : { + "street" : "Hudson Way", + "houseNumber" : "27", + "postalCode" : "90999", + "city" : "St.Ives", + "country" : "GB", + "dependentLocality" : "", + "state" : "Cornwall", + "displayAddressLines" : [ "27 Hudson Way", "ST.IVES", "90999", "UNITED KINGDOM" ] + }, + "companyName" : "My little Cornershop - St.Ives", + "primaryPhone" : "(800) 555-0102", + "googleStatus" : "ACTIVE", + "googlePrimaryCategory" : { + "displayName" : "Food", + "categoryId" : "gcid:storefood" + }, + "googleAdditionalCategories" : [ { + "displayName" : "Drinks", + "categoryId" : "gcid:storedrinks" + } ], + "latLng" : { + "latitude" : 53.5847424, + "longitude" : 9.968901 + }, + "regularHours" : { + "periods" : [ { + "openDay" : "MONDAY", + "openTime" : "08:00", + "closeDay" : "MONDAY", + "closeTime" : "17:00" + }, { + "openDay" : "SATURDAY", + "openTime" : "10:00", + "closeDay" : "SATURDAY", + "closeTime" : "16:00" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations/952797f5-b36d-4808-9c38-b4fd4e498190" + } + } + } + recorded_at: Thu, 10 Oct 2024 14:53:19 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/952797f5-b36d-4808-9c38-b4fd4e498190 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.049' + X-B3-Traceid: + - 1ad2d92a822cd8684ea86b3f0191bf85 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "952797f5-b36d-4808-9c38-b4fd4e498190", + "storeCode" : "MLC-St-Ives", + "languageCode" : "en", + "address" : { + "street" : "Hudson Way", + "houseNumber" : "27", + "postalCode" : "90999", + "city" : "St.Ives", + "country" : "GB", + "dependentLocality" : "", + "state" : "Cornwall", + "displayAddressLines" : [ "27 Hudson Way", "ST.IVES", "90999", "UNITED KINGDOM" ] + }, + "companyName" : "My little Cornershop - St.Ives", + "primaryPhone" : "(800) 555-0102", + "googleStatus" : "ACTIVE", + "googlePrimaryCategory" : { + "displayName" : "Food", + "categoryId" : "gcid:storefood" + }, + "googleAdditionalCategories" : [ { + "displayName" : "Drinks", + "categoryId" : "gcid:storedrinks" + } ], + "latLng" : { + "latitude" : 53.5847424, + "longitude" : 9.968901 + }, + "regularHours" : { + "periods" : [ { + "openDay" : "MONDAY", + "openTime" : "08:00", + "closeDay" : "MONDAY", + "closeTime" : "17:00" + }, { + "openDay" : "SATURDAY", + "openTime" : "10:00", + "closeDay" : "SATURDAY", + "closeTime" : "16:00" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations/952797f5-b36d-4808-9c38-b4fd4e498190" + } + } + } + recorded_at: Thu, 10 Oct 2024 14:53:19 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/952797f5-b36d-4808-9c38-b4fd4e498190 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 10 Oct 2024 14:53:20 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.049' + X-B3-Traceid: + - 24c9814ac54e1f6927b5099cc07dee6b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 10 Oct 2024 14:53:20 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_update/updates_a_shop_location.yml b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_update/updates_a_shop_location.yml new file mode 100644 index 0000000..4cbcc68 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Shop_Location/with_location/_update/updates_a_shop_location.yml @@ -0,0 +1,326 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:20 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.104' + X-B3-Traceid: + - 1d26a32ed743bc965773c38dc508604e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1728572000, + "jti" : "fV/S1GqKoBkytwszksGTzzh/qFI=" + } + recorded_at: Thu, 10 Oct 2024 14:53:20 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations + body: + encoding: UTF-8 + string: '{"languageCode":"en","storeCode":"MLC-St-Ives","companyName":"My little + Cornershop - St.Ives","primaryPhone":"(800) 555-0102","address":{"postalCode":"90999","street":"Hudson + Way","houseNumber":"27","city":"St.Ives","country":"GB","dependentLocality":"","state":"Cornwall"},"googleStatus":"ACTIVE","googlePrimaryCategory":{"categoryId":"gcid:storefood","displayName":"Food"},"googleAdditionalCategories":[{"displayName":"Drinks","categoryId":"gcid:storedrinks"}],"regularHours":{"periods":[{"openDay":"MONDAY","openTime":"08:00","closeDay":"MONDAY","closeTime":"17:00"},{"openDay":"SATURDAY","openTime":"10:00","closeDay":"SATURDAY","closeTime":"16:00"}]},"latLng":{"latitude":53.5847424,"longitude":9.968901}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 10 Oct 2024 14:53:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/shop/locations/ca139c15-93d7-4abb-b315-c624e7f77ea8 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - 884d6a5019102a351e66e0a04a8f76f8 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "ca139c15-93d7-4abb-b315-c624e7f77ea8", + "storeCode" : "MLC-St-Ives", + "languageCode" : "en", + "address" : { + "street" : "Hudson Way", + "houseNumber" : "27", + "postalCode" : "90999", + "city" : "St.Ives", + "country" : "GB", + "dependentLocality" : "", + "state" : "Cornwall", + "displayAddressLines" : [ "27 Hudson Way", "ST.IVES", "90999", "UNITED KINGDOM" ] + }, + "companyName" : "My little Cornershop - St.Ives", + "primaryPhone" : "(800) 555-0102", + "googleStatus" : "ACTIVE", + "googlePrimaryCategory" : { + "displayName" : "Food", + "categoryId" : "gcid:storefood" + }, + "googleAdditionalCategories" : [ { + "displayName" : "Drinks", + "categoryId" : "gcid:storedrinks" + } ], + "latLng" : { + "latitude" : 53.5847424, + "longitude" : 9.968901 + }, + "regularHours" : { + "periods" : [ { + "openDay" : "MONDAY", + "openTime" : "08:00", + "closeDay" : "MONDAY", + "closeTime" : "17:00" + }, { + "openDay" : "SATURDAY", + "openTime" : "10:00", + "closeDay" : "SATURDAY", + "closeTime" : "16:00" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations/ca139c15-93d7-4abb-b315-c624e7f77ea8" + } + } + } + recorded_at: Thu, 10 Oct 2024 14:53:20 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/ca139c15-93d7-4abb-b315-c624e7f77ea8 + body: + encoding: UTF-8 + string: '{"languageCode":"en","storeCode":"MLC-St-Ives","companyName":"Updated + Cornershop","primaryPhone":"(800) 555-0102","address":{"postalCode":"90999","street":"Hudson + Way","houseNumber":"27","city":"St.Ives","country":"GB","dependentLocality":"","state":"Cornwall"},"googleStatus":"ACTIVE","googlePrimaryCategory":{"categoryId":"gcid:storefood","displayName":"Food"},"googleAdditionalCategories":[{"displayName":"Drinks","categoryId":"gcid:storedrinks"}],"regularHours":{"periods":[{"openDay":"MONDAY","openTime":"08:00","closeDay":"MONDAY","closeTime":"17:00"},{"openDay":"SATURDAY","openTime":"10:00","closeDay":"SATURDAY","closeTime":"16:00"}]},"latLng":{"latitude":53.5847424,"longitude":9.968901}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 10 Oct 2024 14:53:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.054' + X-B3-Traceid: + - b6769cba57e4732b78c2c5407b184c4a + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_id" : "ca139c15-93d7-4abb-b315-c624e7f77ea8", + "storeCode" : "MLC-St-Ives", + "languageCode" : "en", + "address" : { + "street" : "Hudson Way", + "houseNumber" : "27", + "postalCode" : "90999", + "city" : "St.Ives", + "country" : "GB", + "dependentLocality" : "", + "state" : "Cornwall", + "displayAddressLines" : [ "27 Hudson Way", "ST.IVES", "90999", "UNITED KINGDOM" ] + }, + "companyName" : "Updated Cornershop", + "primaryPhone" : "(800) 555-0102", + "googleStatus" : "ACTIVE", + "googlePrimaryCategory" : { + "displayName" : "Food", + "categoryId" : "gcid:storefood" + }, + "googleAdditionalCategories" : [ { + "displayName" : "Drinks", + "categoryId" : "gcid:storedrinks" + } ], + "latLng" : { + "latitude" : 53.5847424, + "longitude" : 9.968901 + }, + "regularHours" : { + "periods" : [ { + "openDay" : "MONDAY", + "openTime" : "08:00", + "closeDay" : "MONDAY", + "closeTime" : "17:00" + }, { + "openDay" : "SATURDAY", + "openTime" : "10:00", + "closeDay" : "SATURDAY", + "closeTime" : "16:00" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/shop/locations/ca139c15-93d7-4abb-b315-c624e7f77ea8" + } + } + } + recorded_at: Thu, 10 Oct 2024 14:53:20 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/shop/locations/ca139c15-93d7-4abb-b315-c624e7f77ea8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Thu, 10 Oct 2024 14:53:21 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.047' + X-B3-Traceid: + - 6b389ffff2b29cc702455515224f9c90 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Thu, 10 Oct 2024 14:53:21 GMT +recorded_with: VCR 6.2.0