Skip to content

Instantly share code, notes, and snippets.

@braidn
Created September 4, 2014 02:05
Show Gist options
  • Save braidn/187d00ca8b45b10d7e40 to your computer and use it in GitHub Desktop.
Save braidn/187d00ca8b45b10d7e40 to your computer and use it in GitHub Desktop.
Spree API Mods
::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
def product_attributes
[:id, :sku, :name, :subtitle, :summary, :description, :price, :available_on, :permalink, :flag_as_new, :in_stock, :backorderable,
:meta_description, :meta_keywords, :taxon_ids, :on_hand, :individual_sale, :solution, :is_a_kit, :cchs_eligible, :is_gift_for_grad,
:is_security_kit, :is_solution_kit, :original_price, :description2, :specs, :video_url]
end
def order_attributes
[:id, :number, :item_total, :total, :tax_total, :ship_total, :state, :adjustment_total, :user_id, :created_at, :updated_at, :completed_at, :payment_total, :shipment_state, :payment_state, :email, :special_instructions, :confirmation_code, :promo_label, :promo_total, :promo_code, :cchs_requested, :guest_checkout, :friendbuy]
end
def variant_attributes
[:id, :name, :sku, :price, :weight, :height, :width, :depth, :is_master, :cost_price, :permalink, :product_id, :lock_version, :kit_image_url, :in_stock, :original_price]
end
# def line_item_attributes
# [:id, :quantity, :price, :variant_id, :additional_text]
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment