This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
product: { | |
sku: "H8MAGENTO", | |
price: 15.99, | |
shipping_category_id: 0, | |
name: "Test Thingie", | |
description: "Voluptatibus dolor testicus." | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failures: | |
1) Spree::Admin::BaseController unauthorized request checks error | |
Failure/Error: expect(response).to redirect_to "/rooot" | |
Expected response to be a redirect to <http://test.host/rooot> but was a redirect to <http://test.host/>. | |
Expected "http://test.host/rooot" to be === "http://test.host/". | |
# ./spec/controllers/spree/admin/base_controller_spec.rb:22:in `block (3 levels) in <top (required)>' | |
Finished in 1.49 seconds | |
2 examples, 1 failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order = Spree::Order.last | |
payload_builder = Spree::Wombat::Config[:payload_builder]["Spree::Order"] | |
payload = ActiveModel::ArraySerializer.new([order], | |
each_serializer: payload_builder[:serializer].constantize, | |
root: payload_builder[:root] | |
).to_json | |
Spree::Wombat::Client.push(payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree.config do |config| | |
# Example: | |
# Uncomment to stop tracking inventory levels in the application | |
# config.track_inventory_levels = false | |
config.products_per_page = 9 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Override the order serializer, adding the needed attributes: | |
class MyOrderSerializer < Spree::Wombat::OrderSerializer | |
attributes :shipping_instructions | |
end | |
# make sure to update config/initializers/wombat.rb to include the new serializer: | |
config.payload_builder = { | |
"Spree::Order" => {:serializer => "MyOrderSerializer", :root => "orders"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scheduler: bundle exec ./push_it_scheduler.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fix() { | |
git rebase -i HEAD~$1 | |
} | |
function branch_name() { | |
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" | |
branch_name=${branch_name##refs/heads/} | |
echo $branch_name | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- replace '#add-line-item' --> | |
<h1> Hello world </h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timestamps = Spree::Wombat::Config[:last_pushed_timestamps] | |
timestamps["Spree::Order"] = 2.days.ago | |
Spree::Wombat::Config[:last_pushed_timestamps] = timestamps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Close all open adjustments that still have a "Spree::Order" as source_type. | |
Spree::Adjustment.where(source_type: "Spree::Order").open.collect(&:close!) | |
# Migrate existing order wide tax adjustments to line item adjustments: | |
Spree::Order.find_each do |order| | |
order_tax_adjustments = order.adjustments.where(source_type: "Spree::TaxRate") | |
if order_tax_adjustments.count > 0 | |
#apply the tax on the line_items | |
Spree::TaxRate.adjust(order, order.line_items) |