flex_commerce_api 0.6.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.example +6 -0
- data/.gitignore +14 -0
- data/.rspec +4 -0
- data/.rubocop.yml +1065 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +1 -0
- data/app/models/address.rb +41 -0
- data/app/models/asset_file.rb +26 -0
- data/app/models/asset_folder.rb +14 -0
- data/app/models/bundle.rb +20 -0
- data/app/models/bundle_group.rb +15 -0
- data/app/models/cart.rb +136 -0
- data/app/models/category.rb +70 -0
- data/app/models/category_tree.rb +11 -0
- data/app/models/component.rb +8 -0
- data/app/models/container_coupon.rb +12 -0
- data/app/models/country.rb +11 -0
- data/app/models/coupon.rb +18 -0
- data/app/models/customer_account.rb +96 -0
- data/app/models/customer_account_authentication.rb +5 -0
- data/app/models/customer_segment.rb +6 -0
- data/app/models/customer_segment_member.rb +6 -0
- data/app/models/data_attribute.rb +6 -0
- data/app/models/data_store_record.rb +9 -0
- data/app/models/data_store_type.rb +9 -0
- data/app/models/discount_summary.rb +12 -0
- data/app/models/email.rb +5 -0
- data/app/models/ewis_opt_in.rb +8 -0
- data/app/models/external_url.rb +6 -0
- data/app/models/free_shipping_promotion.rb +12 -0
- data/app/models/import.rb +6 -0
- data/app/models/import_entry.rb +6 -0
- data/app/models/line_item.rb +34 -0
- data/app/models/line_item_discount.rb +7 -0
- data/app/models/markdown_price.rb +11 -0
- data/app/models/menu.rb +36 -0
- data/app/models/menu_item.rb +7 -0
- data/app/models/menu_item_item.rb +5 -0
- data/app/models/note.rb +18 -0
- data/app/models/order.rb +38 -0
- data/app/models/password_recovery.rb +20 -0
- data/app/models/payment_address_verification.rb +13 -0
- data/app/models/payment_process.rb +13 -0
- data/app/models/payment_provider.rb +15 -0
- data/app/models/payment_transaction.rb +13 -0
- data/app/models/product.rb +99 -0
- data/app/models/product_asset_file.rb +12 -0
- data/app/models/promotion.rb +19 -0
- data/app/models/promotion_qualifying_product_exclusion.rb +8 -0
- data/app/models/redirect.rb +14 -0
- data/app/models/refund.rb +14 -0
- data/app/models/remote_address.rb +22 -0
- data/app/models/remote_line_item.rb +11 -0
- data/app/models/remote_order.rb +15 -0
- data/app/models/remote_shipping_method.rb +12 -0
- data/app/models/report.rb +18 -0
- data/app/models/report_invocation.rb +18 -0
- data/app/models/retail_store.rb +18 -0
- data/app/models/role.rb +6 -0
- data/app/models/search_suggestion.rb +17 -0
- data/app/models/section.rb +9 -0
- data/app/models/session.rb +8 -0
- data/app/models/shipping_method.rb +26 -0
- data/app/models/slug.rb +19 -0
- data/app/models/static_page.rb +60 -0
- data/app/models/static_page_folder.rb +8 -0
- data/app/models/stock_level.rb +21 -0
- data/app/models/tax_code.rb +6 -0
- data/app/models/taxonomy.rb +5 -0
- data/app/models/template.rb +9 -0
- data/app/models/template_component.rb +11 -0
- data/app/models/template_definition.rb +12 -0
- data/app/models/template_section.rb +12 -0
- data/app/models/user.rb +8 -0
- data/app/models/user_profile.rb +6 -0
- data/app/models/v2/create_order.rb +10 -0
- data/app/models/v2/deallocate_order.rb +10 -0
- data/app/models/v2/line_item.rb +9 -0
- data/app/models/v2/order.rb +9 -0
- data/app/models/v2/unallocate_order.rb +10 -0
- data/app/models/variant.rb +18 -0
- data/app/models/webhook.rb +17 -0
- data/app/services/param_to_shql.rb +72 -0
- data/app/services/surrogate_keys.rb +44 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/config/locales/payments.en.yml +3 -0
- data/flex-commerce-api.gemspec +41 -0
- data/lib/flex_commerce.rb +95 -0
- data/lib/flex_commerce_api.rb +21 -0
- data/lib/flex_commerce_api/api_base.rb +11 -0
- data/lib/flex_commerce_api/base_resource.rb +250 -0
- data/lib/flex_commerce_api/config.rb +55 -0
- data/lib/flex_commerce_api/error/access_denied.rb +6 -0
- data/lib/flex_commerce_api/error/bad_request.rb +10 -0
- data/lib/flex_commerce_api/error/base.rb +12 -0
- data/lib/flex_commerce_api/error/client_error.rb +7 -0
- data/lib/flex_commerce_api/error/connection_error.rb +6 -0
- data/lib/flex_commerce_api/error/internal_server.rb +37 -0
- data/lib/flex_commerce_api/error/not_found.rb +13 -0
- data/lib/flex_commerce_api/error/record_invalid.rb +16 -0
- data/lib/flex_commerce_api/error/unexpected_status.rb +7 -0
- data/lib/flex_commerce_api/errors.rb +13 -0
- data/lib/flex_commerce_api/json_api_client_extension/builder.rb +28 -0
- data/lib/flex_commerce_api/json_api_client_extension/capture_surrogate_keys_middleware.rb +16 -0
- data/lib/flex_commerce_api/json_api_client_extension/flexible_connection.rb +59 -0
- data/lib/flex_commerce_api/json_api_client_extension/has_many_association_proxy.rb +60 -0
- data/lib/flex_commerce_api/json_api_client_extension/included_data.rb +27 -0
- data/lib/flex_commerce_api/json_api_client_extension/json_format_middleware.rb +20 -0
- data/lib/flex_commerce_api/json_api_client_extension/logging_middleware.rb +24 -0
- data/lib/flex_commerce_api/json_api_client_extension/paginator.rb +26 -0
- data/lib/flex_commerce_api/json_api_client_extension/parse_json.rb +23 -0
- data/lib/flex_commerce_api/json_api_client_extension/parsers/parser.rb +16 -0
- data/lib/flex_commerce_api/json_api_client_extension/previewed_request_middleware.rb +17 -0
- data/lib/flex_commerce_api/json_api_client_extension/remote_builder.rb +29 -0
- data/lib/flex_commerce_api/json_api_client_extension/requestor.rb +42 -0
- data/lib/flex_commerce_api/json_api_client_extension/save_request_body_middleware.rb +20 -0
- data/lib/flex_commerce_api/json_api_client_extension/status_middleware.rb +40 -0
- data/lib/flex_commerce_api/v2/api_base.rb +13 -0
- data/lib/flex_commerce_api/version.rb +3 -0
- data/lib/json_erb.rb +9 -0
- data/lib/json_struct.rb +73 -0
- data/lib/patches.rb +4 -0
- data/lib/patches/json_api_client/resource.rb +50 -0
- data/lib/paypal_express.rb +3 -0
- data/lib/paypal_express/additional_info.rb +45 -0
- data/lib/paypal_express/api.rb +86 -0
- data/lib/paypal_express/auth.rb +83 -0
- data/lib/paypal_express/cart_shipping_method.rb +38 -0
- data/lib/paypal_express/exception/access_denied.rb +10 -0
- data/lib/paypal_express/exception/connection_error.rb +10 -0
- data/lib/paypal_express/exception/not_authorized.rb +10 -0
- data/lib/paypal_express/exception/transaction.rb +15 -0
- data/lib/paypal_express/generate_summary.rb +118 -0
- data/lib/paypal_express/process/paypal_params.rb +123 -0
- data/lib/paypal_express/process/response_parser.rb +146 -0
- data/lib/paypal_express/setup.rb +94 -0
- data/lib/paypal_express/shipping_methods_for_cart.rb +46 -0
- data/lib/retry.rb +20 -0
- data/schemas/jsonapi/schema.json +370 -0
- data/schemas/shift/v1/documents/collection/address.json +45 -0
- data/schemas/shift/v1/documents/collection/asset_file.json +43 -0
- data/schemas/shift/v1/documents/collection/asset_folder.json +43 -0
- data/schemas/shift/v1/documents/collection/customer_account.json +50 -0
- data/schemas/shift/v1/documents/collection/markdown_price.json +43 -0
- data/schemas/shift/v1/documents/collection/product.json +43 -0
- data/schemas/shift/v1/documents/collection/variant.json +43 -0
- data/schemas/shift/v1/documents/member/address.json +39 -0
- data/schemas/shift/v1/documents/member/asset_file.json +37 -0
- data/schemas/shift/v1/documents/member/asset_folder.json +39 -0
- data/schemas/shift/v1/documents/member/customer_account.json +44 -0
- data/schemas/shift/v1/documents/member/markdown_price.json +37 -0
- data/schemas/shift/v1/documents/member/product.json +39 -0
- data/schemas/shift/v1/documents/member/variant.json +46 -0
- data/schemas/shift/v1/resources/address.json +130 -0
- data/schemas/shift/v1/resources/asset_file.json +146 -0
- data/schemas/shift/v1/resources/asset_folder.json +188 -0
- data/schemas/shift/v1/resources/customer_account.json +339 -0
- data/schemas/shift/v1/resources/markdown_price.json +52 -0
- data/schemas/shift/v1/resources/product.json +230 -0
- data/schemas/shift/v1/resources/variant.json +298 -0
- data/tasks/json_schema.thor +275 -0
- data/todo.md +8 -0
- metadata +470 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce payment address verification model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce address verification service
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
class PaymentAddressVerification < FlexCommerceApi::ApiBase
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce PaymentProcess model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce "process order" resource
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
class PaymentProcess < FlexCommerceApi::ApiBase
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce PaymentProvider model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce PaymentProvider which is used to
|
|
7
|
+
# define a payment gateway and provide instructions to the front end application
|
|
8
|
+
# on how to set up the gateway in a browser (i.e. redirect to paypal etc..)
|
|
9
|
+
#
|
|
10
|
+
#
|
|
11
|
+
#
|
|
12
|
+
class PaymentProvider < FlexCommerceApi::ApiBase
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Order Transaction model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce order transaction
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
class PaymentTransaction < FlexCommerceApi::ApiBase
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Product model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce products.
|
|
7
|
+
# As managing the products is the job of the administration panel, this
|
|
8
|
+
# model is read only.
|
|
9
|
+
#
|
|
10
|
+
# It is used much like an active record model.
|
|
11
|
+
#
|
|
12
|
+
# Examples:
|
|
13
|
+
#
|
|
14
|
+
#
|
|
15
|
+
#
|
|
16
|
+
# # Fetching all products
|
|
17
|
+
#
|
|
18
|
+
# FlexCommerce::Product.all #fetches all products(actually the first page in case there are thousands)
|
|
19
|
+
#
|
|
20
|
+
# # Pagination
|
|
21
|
+
#
|
|
22
|
+
# FlexCommerce::Product.paginate(page:2).all # Fetches page 2 of products.
|
|
23
|
+
# The page size is predefined on the server side
|
|
24
|
+
#
|
|
25
|
+
# # Finding products
|
|
26
|
+
#
|
|
27
|
+
# FlexCommerce::Product.find("my-product-slug") # Finds the product with this unique id
|
|
28
|
+
#
|
|
29
|
+
# # Finding nested variants of the product
|
|
30
|
+
#
|
|
31
|
+
# FlexCommerce::Product.find("my-product-slug").variants
|
|
32
|
+
#
|
|
33
|
+
#
|
|
34
|
+
class Product < FlexCommerceApi::ApiBase
|
|
35
|
+
# @method find
|
|
36
|
+
# @param [String] spec
|
|
37
|
+
# Finds a product
|
|
38
|
+
# @return [FlexCommerce::Product] product The product
|
|
39
|
+
# @raise [FlexCommerceApi::Error::NotFound] If not found
|
|
40
|
+
|
|
41
|
+
# @method all
|
|
42
|
+
# Returns all products
|
|
43
|
+
# @return [FlexCommerce::Product[]] An array of products or an empty array
|
|
44
|
+
|
|
45
|
+
# @method paginate
|
|
46
|
+
# Paginates the list of products by a preset page size
|
|
47
|
+
# @param [Hash] options The options to paginate with
|
|
48
|
+
# @param options [Numeric|String] :page The page to fetch
|
|
49
|
+
|
|
50
|
+
# @method variants
|
|
51
|
+
# Provides a list of associated variants
|
|
52
|
+
# @return [FlexCommerce::Variant[]]
|
|
53
|
+
|
|
54
|
+
# @TODO Document other popular methods that we will support
|
|
55
|
+
|
|
56
|
+
has_many :variants, class_name: "::FlexCommerce::Variant"
|
|
57
|
+
has_many :asset_files, class_name: "::FlexCommerce::AssetFile"
|
|
58
|
+
has_many :bundles, class_name: "::FlexCommerce::Bundle"
|
|
59
|
+
has_many :bundle_group, class_name: "::FlexCommerce::BundleGroup"
|
|
60
|
+
has_many :slugs, class_name: "::FlexCommerce::Slug"
|
|
61
|
+
has_one :template_definition, class_name: "::FlexCommerce::TemplateDefinition"
|
|
62
|
+
has_one :template, class_name: "::FlexCommerce::Template"
|
|
63
|
+
|
|
64
|
+
# TODO Decide where sku really comes from - its in the variant but not at product level like in matalan direct appears to be
|
|
65
|
+
def sku
|
|
66
|
+
reference
|
|
67
|
+
end
|
|
68
|
+
self.query_builder = ::FlexCommerceApi::JsonApiClientExtension::Builder
|
|
69
|
+
class << self
|
|
70
|
+
def_delegators :_new_scope, :temp_search
|
|
71
|
+
def path(params, *args)
|
|
72
|
+
if params[:filter] && params[:filter].key?(:category_id) && params[:filter].key?(:category_tree_id)
|
|
73
|
+
category_tree_id = params[:filter].delete(:category_tree_id)
|
|
74
|
+
category_id = params[:filter].delete(:category_id)
|
|
75
|
+
params.delete(:filter) if params[:filter].empty?
|
|
76
|
+
"category_trees/#{category_tree_id}/categories/#{category_id}/products"
|
|
77
|
+
else
|
|
78
|
+
super
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def current_max_price
|
|
84
|
+
variants.map(&:current_price).max
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def current_min_price
|
|
88
|
+
variants.map(&:current_price).min
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Relationship accessors
|
|
92
|
+
def add_asset_files(asset_files)
|
|
93
|
+
self.class.requestor.custom("relationships/asset_files", {request_method: :post}, {id: id, data: asset_files.map(&:as_relation)})
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# End of relationship accessors
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Product asset file model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce product asset files.
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
class ProductAssetFile < FlexCommerceApi::ApiBase
|
|
10
|
+
belongs_to :product, class_name: "FlexCommerce::Product"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Promotion model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce promotion
|
|
7
|
+
#
|
|
8
|
+
class Promotion < FlexCommerceApi::ApiBase
|
|
9
|
+
# This adds the ability to call archive method on Promotion
|
|
10
|
+
#
|
|
11
|
+
# @usage FlexCommerce::Promotion.find(<id>).archive
|
|
12
|
+
custom_endpoint :archive, on: :member, request_method: :patch
|
|
13
|
+
|
|
14
|
+
# This adds the ability to call unarchive method on Promotion
|
|
15
|
+
#
|
|
16
|
+
# @usage FlexCommerce::Promotion.find(<id>).unarchive
|
|
17
|
+
custom_endpoint :unarchive, on: :member, request_method: :patch
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Redirect model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce redirect
|
|
7
|
+
#
|
|
8
|
+
class Redirect < FlexCommerceApi::ApiBase
|
|
9
|
+
|
|
10
|
+
def self.find_by_path(source_path: )
|
|
11
|
+
where(source_path: source_path).first
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce RemoteAddress model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce remote addresses
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
#
|
|
14
|
+
# # Fetching all addresses for a customer account
|
|
15
|
+
#
|
|
16
|
+
# customer_account.addresses.all #fetches all addresses(actually the first page in case there are thousands)
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
class RemoteAddress < FlexCommerceApi::ApiBase
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Report model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the Shift Reports feature.
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
# # Fetch all reports, paginated
|
|
13
|
+
# FlexCommerce::Report.all
|
|
14
|
+
#
|
|
15
|
+
class Report < FlexCommerceApi::ApiBase
|
|
16
|
+
has_many :invocations, class_name: "::FlexCommerce::ReportInvocation"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Report Invocation model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the Shift Report Invocations feature.
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
# # List the invocations of the first report
|
|
13
|
+
# FlexCommerce::Report.first.invocations
|
|
14
|
+
#
|
|
15
|
+
class ReportInvocation < FlexCommerceApi::ApiBase
|
|
16
|
+
has_one :report, class_name: "::FlexCommerce::Report"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce RetailStore model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the Shift Retail Stores feature.
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
# # Fetch all retail stores
|
|
13
|
+
# FlexCommerce::RetailStore.all
|
|
14
|
+
#
|
|
15
|
+
class RetailStore < FlexCommerceApi::ApiBase
|
|
16
|
+
has_many :slugs, class_name: "::FlexCommerce::Slug"
|
|
17
|
+
end
|
|
18
|
+
end
|
data/app/models/role.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce SearchSuggestion model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the Shift Suggestive Search feature.
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
# # Fetch words matching the suggestion 'sh'
|
|
13
|
+
# FlexCommerce::SearchSuggestion.where(q: “sh”).all
|
|
14
|
+
#
|
|
15
|
+
class SearchSuggestion < FlexCommerceApi::ApiBase
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce OrderShippingMethod model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce order shipping methods
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
#
|
|
14
|
+
# # Fetching all order shipping methods for a customer account
|
|
15
|
+
#
|
|
16
|
+
# FlexCommerce::ShippingMethod.all #fetches all order shipping methods(actually the first page in case there are thousands)
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
class ShippingMethod < FlexCommerceApi::ApiBase
|
|
20
|
+
|
|
21
|
+
# @method all
|
|
22
|
+
# Returns all order shipping methods
|
|
23
|
+
# @return [FlexCommerce::OrderShippingMethod[]] An array of order shipping methods or an empty array
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
data/app/models/slug.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
|
|
3
|
+
module FlexCommerce
|
|
4
|
+
#
|
|
5
|
+
# A flex commerce Slug model
|
|
6
|
+
#
|
|
7
|
+
# This model provides access to flex commerce slugs
|
|
8
|
+
#
|
|
9
|
+
# It is used much like an active record model.
|
|
10
|
+
#
|
|
11
|
+
# Examples:
|
|
12
|
+
#
|
|
13
|
+
# # Fetching a slug
|
|
14
|
+
# FlexCommerce::Slug.find(computed_slug:'some-computed-slug')
|
|
15
|
+
#
|
|
16
|
+
class Slug < FlexCommerceApi::ApiBase
|
|
17
|
+
has_one :resource
|
|
18
|
+
end
|
|
19
|
+
end
|