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,12 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce ContainerCoupon model
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
class ContainerCoupon < FlexCommerceApi::ApiBase
|
|
8
|
+
has_one :promotion, class_name: "FlexCommerce::Promotion"
|
|
9
|
+
belongs_to :order, class_name: "FlexCommerce::Order"
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Coupon model
|
|
5
|
+
#
|
|
6
|
+
# A coupon can be created with a cart id the path
|
|
7
|
+
#
|
|
8
|
+
# It is used much like an active record model.
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
#
|
|
12
|
+
# FlexCommerce::Coupon.create(coupon_code: "coupon1", path: { cart_id: current_cart.id })
|
|
13
|
+
#
|
|
14
|
+
class Coupon < FlexCommerceApi::ApiBase
|
|
15
|
+
belongs_to :cart, class_name: "FlexCommerce::Cart"
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Customer Account model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce customer account and associated cart.
|
|
7
|
+
# It is used much like an active record model.
|
|
8
|
+
#
|
|
9
|
+
# Examples:
|
|
10
|
+
#
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
# # Creating an account
|
|
14
|
+
#
|
|
15
|
+
# FlexCommerce::CustomerAccount.create #creates and returns a new account ready for use
|
|
16
|
+
#
|
|
17
|
+
# # Fetching its cart
|
|
18
|
+
#
|
|
19
|
+
# account.cart
|
|
20
|
+
#
|
|
21
|
+
# # Finding an account
|
|
22
|
+
#
|
|
23
|
+
# FlexCommerce::CustomerAccount.find(<<customer_account_id>>) # Finds the account with this unique id
|
|
24
|
+
#
|
|
25
|
+
#
|
|
26
|
+
class CustomerAccount < FlexCommerceApi::ApiBase
|
|
27
|
+
# @method find
|
|
28
|
+
# @param [String] spec
|
|
29
|
+
# Finds an account
|
|
30
|
+
# @return [FlexCommerce::CustomerAccount] customer_account The customer account
|
|
31
|
+
# @raise [FlexCommerceApi::Error::NotFound] If not found
|
|
32
|
+
|
|
33
|
+
# @method cart
|
|
34
|
+
# Provides access to the customers cart
|
|
35
|
+
# @return FlexCommerce::Cart
|
|
36
|
+
|
|
37
|
+
# @TODO Document other popular methods that we will support
|
|
38
|
+
|
|
39
|
+
has_one :cart, class_name: "::FlexCommerce::Cart"
|
|
40
|
+
has_many :addresses, class_name: "::FlexCommerce::Address"
|
|
41
|
+
has_many :customer_segments, class_name: "::FlexCommerce::CustomerSegment"
|
|
42
|
+
has_many :notes, class_name: "::FlexCommerce::Note"
|
|
43
|
+
has_many :orders, class_name: "::FlexCommerce::RemoteOrder"
|
|
44
|
+
has_one :password_recovery, class_name: "::FlexCommerce::PasswordRecovery"
|
|
45
|
+
|
|
46
|
+
property :email, type: :string
|
|
47
|
+
property :reference, type: :string
|
|
48
|
+
property :password, type: :string
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def self.authenticate(attributes = {})
|
|
52
|
+
FlexCommerce::CustomerAccountAuthentication.create(attributes).customer_account
|
|
53
|
+
rescue ::FlexCommerceApi::Error::NotFound
|
|
54
|
+
nil
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.find_by_email(email)
|
|
58
|
+
requestor.custom("email:#{URI.encode_www_form_component(email)}", {request_method: :get}, {}).first
|
|
59
|
+
rescue ::FlexCommerceApi::Error::NotFound
|
|
60
|
+
nil
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.find_by_reference(reference)
|
|
64
|
+
requestor.custom("reference:#{reference}", {request_method: :get}, {}).first
|
|
65
|
+
rescue ::FlexCommerceApi::Error::NotFound
|
|
66
|
+
nil
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Find customer account by password reset token provided in email's link
|
|
70
|
+
# Used in reset password scenario
|
|
71
|
+
def self.find_by_token(token)
|
|
72
|
+
requestor.custom("token:#{token}", {request_method: :get}, {}).first
|
|
73
|
+
rescue ::FlexCommerceApi::Error::NotFound
|
|
74
|
+
nil
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def generate_token(attributes)
|
|
78
|
+
::FlexCommerce::PasswordRecovery.create(attributes.merge(customer_account_id: id))
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def reset_password(attributes)
|
|
82
|
+
password_recovery.id = nil # because it is singletone resource, otherwise id is injected into path
|
|
83
|
+
password_recovery.update(attributes.merge(customer_account_id: id))
|
|
84
|
+
password_recovery
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def orders
|
|
88
|
+
return super if relationships[:orders].key?("data")
|
|
89
|
+
get_related(:orders)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def create_note(attributes = {})
|
|
93
|
+
::FlexCommerce::Note.create(attributes.merge(attached_to_id: self.id, attached_to_type: self.class.name.demodulize))
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce discount summary model
|
|
5
|
+
#
|
|
6
|
+
# This model is used by the Cart model as an association so is not
|
|
7
|
+
# usable directly on the API as there is no corresponding URL
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
class DiscountSummary < FlexCommerceApi::ApiBase
|
|
11
|
+
end
|
|
12
|
+
end
|
data/app/models/email.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex Free Shipping Promotion summary model
|
|
5
|
+
#
|
|
6
|
+
# This model is used by the Cart model as an association so is not
|
|
7
|
+
# usable directly on the API as there is no corresponding URL
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
class FreeShippingPromotion < FlexCommerceApi::ApiBase
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce LineItem model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce cart's line_items.
|
|
7
|
+
# This model allows you to create a line_item, update its contents, delete a line_item or list the line items for a specific cart.
|
|
8
|
+
#
|
|
9
|
+
# It is used much like an active record model.
|
|
10
|
+
#
|
|
11
|
+
# Examples:
|
|
12
|
+
#
|
|
13
|
+
#
|
|
14
|
+
#
|
|
15
|
+
# # Creating a line item for a specific cart
|
|
16
|
+
#
|
|
17
|
+
# FlexCommerce::LineItem.create container: cart, item: variant, unit_quantity: 3 #creates and returns a new line item ready for use
|
|
18
|
+
#
|
|
19
|
+
class LineItem < FlexCommerceApi::ApiBase
|
|
20
|
+
|
|
21
|
+
# @method item
|
|
22
|
+
# The item (either a variant or a bundle)
|
|
23
|
+
# @return [FlexCommerce::Variant|FlexCommerce::Bundle]
|
|
24
|
+
|
|
25
|
+
# @TODO Document other popular methods that we will support
|
|
26
|
+
|
|
27
|
+
has_one :item
|
|
28
|
+
belongs_to :cart, class_name: "::FlexCommerce::Cart"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# note: only embedded in order responses, not carts
|
|
32
|
+
has_many :line_item_discounts, class_name: "::FlexCommerce::LineItemDiscount"
|
|
33
|
+
end
|
|
34
|
+
end
|
data/app/models/menu.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Menu model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce menus.
|
|
7
|
+
# As managing the menus 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 menus
|
|
17
|
+
#
|
|
18
|
+
# FlexCommerce::Menu.all #fetches all menus(actually the first page in case there are thousands)
|
|
19
|
+
#
|
|
20
|
+
# # Finding a specific menu
|
|
21
|
+
#
|
|
22
|
+
# FlexCommerce::Menu.find("my-menu-reference") # Finds the menu with this unique id
|
|
23
|
+
#
|
|
24
|
+
# # Finding nested menu items of the menu (See MenuItem class for what you can do with this including getting nested menu items)
|
|
25
|
+
#
|
|
26
|
+
# FlexCommerce::Menu.find("my-product-slug").menu_items
|
|
27
|
+
#
|
|
28
|
+
#
|
|
29
|
+
class Menu < FlexCommerceApi::ApiBase
|
|
30
|
+
has_many :menu_items
|
|
31
|
+
# This model has a path attribute so path can no longer be used to modify the path
|
|
32
|
+
def self.path(params = nil, record = nil)
|
|
33
|
+
super(params.nil? ? nil : params.except("path"), record)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/app/models/note.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
#
|
|
3
|
+
# A flex commerce Note model
|
|
4
|
+
#
|
|
5
|
+
# This model provides access to flex commerce notes
|
|
6
|
+
#
|
|
7
|
+
# It is used much like an active record model.
|
|
8
|
+
#
|
|
9
|
+
# Examples:
|
|
10
|
+
#
|
|
11
|
+
# # Fetching notes for a specific customer account
|
|
12
|
+
# FlexCommerce::Note.where(customer_account_id: 1).all
|
|
13
|
+
#
|
|
14
|
+
module FlexCommerce
|
|
15
|
+
class Note < FlexCommerceApi::ApiBase
|
|
16
|
+
# @TODO Document popular methods that we will support
|
|
17
|
+
end
|
|
18
|
+
end
|
data/app/models/order.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
|
|
3
|
+
module FlexCommerce
|
|
4
|
+
#
|
|
5
|
+
# A flex commerce Order model
|
|
6
|
+
#
|
|
7
|
+
# This model provides access to the flex commerce order
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
#
|
|
11
|
+
class Order < FlexCommerceApi::ApiBase
|
|
12
|
+
has_many :transactions, class_name: "::FlexCommerce::OrderTransaction"
|
|
13
|
+
has_many :line_items, class_name: "::FlexCommerce::LineItem"
|
|
14
|
+
has_many :coupons, class_name: "::FlexCommerce::ContainerCoupon"
|
|
15
|
+
has_one :shipping_promotion, class_name: "::FlexCommerce::Promotion"
|
|
16
|
+
has_one :shipping_address, class_name: "::FlexCommerce::Address"
|
|
17
|
+
has_one :billing_address, class_name: "::FlexCommerce::Address"
|
|
18
|
+
|
|
19
|
+
def self.path(params = nil, record = nil)
|
|
20
|
+
if params && params[:filter] && (customer_id = params[:filter].delete(:customer_account_id))
|
|
21
|
+
File.join("customer_accounts/%d" % customer_id, super)
|
|
22
|
+
else
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.create(attributes = {})
|
|
30
|
+
super(attributes.merge(extra_attributes))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.extra_attributes
|
|
34
|
+
extras = {}
|
|
35
|
+
extras.merge!(test: true) if FlexCommerceApi.config.order_test_mode
|
|
36
|
+
extras
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "flex_commerce_api/api_base"
|
|
2
|
+
module FlexCommerce
|
|
3
|
+
#
|
|
4
|
+
# A flex commerce Password Recovery model
|
|
5
|
+
#
|
|
6
|
+
# This model provides access to the flex commerce customer account password recovery functionality.
|
|
7
|
+
# It is used much like an active record model.
|
|
8
|
+
|
|
9
|
+
class PasswordRecovery < FlexCommerceApi::ApiBase
|
|
10
|
+
belongs_to :customer_account, class_name: "::FlexCommerce::CustomerAccount"
|
|
11
|
+
|
|
12
|
+
def self.path(params, *args)
|
|
13
|
+
# Since it is singletone resource, use singular name in path and remove id
|
|
14
|
+
params.delete(:id)
|
|
15
|
+
path = super.gsub(table_name, resource_name)
|
|
16
|
+
params.delete(:customer_account_id)
|
|
17
|
+
path
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|