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
class Case | |
def self.build(params) | |
new.build(params) | |
end | |
def build(params) | |
create_airware_case(params) | |
end | |
private |
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
source 'https://rails-assets.org' |
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
def find_list_id(name) | |
@api.lists["data"].detect { |r| r["name"] == name }["id"] | |
end | |
def list_id | |
@list_id ||= find_list_id(@list_name) | |
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
module Spree | |
class Promotion | |
module Rules | |
class LimitOnePerUserPromotionRule < PromotionRule | |
def eligible?(order) | |
@email = order.email | |
return completed_orders_using_promotion < 1 | |
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
if defined?(AssetSync) | |
AssetSync.configure do |config| | |
config.fog_provider = 'AWS' | |
config.fog_directory = ENV['FOG_BUCKET'] | |
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID'] | |
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] | |
# Delete files from the store | |
# config.existing_remote_files = 'keep' | |
# |
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
module RCMS | |
class Asset < ActiveRecord::Base | |
self.table_name = 'rcms_assets' | |
end | |
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
module RCMS | |
class Asset < ActiveRecord::Base | |
self.table_name = 'rcms_assets' | |
self.inheritance_column = :_type_disabled | |
end | |
end | |
#does not work (has column name 'type') |
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
module ApplicationHelper | |
include Spree::BaseHelper | |
def checkout_steps | |
states = checkout_states | |
current_index = states.index(@order.state) + 1 | |
order_title = @order.state.titleize | |
return "Step #{current_index} of #{states.length}: #{order_title}" | |
end | |
def checkout_image_url(product) |
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::Api::ApiHelpers.module_eval do | |
def taxon_attributes | |
[:id, :name, :pretty_name, :permalink, :position, :parent_id, :taxonomy_id, :icon_url] | |
end | |
def user_attributes | |
[:id, :email, :created_at, :updated_at, :first_name, :last_name, :phone, :spree_api_key, :authentication_token, :encrypted_password] | |
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
if ENV['USE_S3'] == 'true' | |
Paperclip::Attachment.default_options[:storage] = :fog | |
Paperclip::Attachment.default_options[:fog_credentials] = { provider: "AWS", aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] } | |
Paperclip::Attachment.default_options[:fog_directory] = ENV['FOG_BUCKET'] | |
Paperclip::Attachment.default_options[:path] = '/app/public/assets/products/:id/:style/:basename.:extension' | |
Paperclip::Attachment.default_options[:fog_host] = ENV['S3_HOST_ALIAS'] | |
Paperclip::Attachment.default_options[:url] = ':s3_alias_url' | |
Spree::Image.attachment_definitions[:attachment][:path] = 'public/assets/products/:id/:style/:basename.:extension' | |
else | |
Paperclip::Attachment.default_options[:storage] = :fog |