app/helpers/spree/api/api_helpers.rb in spree_api-2.3.13 vs app/helpers/spree/api/api_helpers.rb in spree_api-2.4.0.rc1

- old
+ new

@@ -19,17 +19,20 @@ :return_authorization_attributes, :address_attributes, :country_attributes, :state_attributes, :adjustment_attributes, + :inventory_unit_attributes, + :return_authorization_attributes, :creditcard_attributes, :payment_source_attributes, :user_attributes, :property_attributes, :stock_location_attributes, :stock_movement_attributes, - :stock_item_attributes + :stock_item_attributes, + :promotion_attributes ] mattr_reader *ATTRIBUTES def required_fields_for(model) @@ -54,11 +57,11 @@ :id, :product_id, :property_id, :value, :property_name ] @@variant_attributes = [ :id, :name, :sku, :price, :weight, :height, :width, :depth, :is_master, - :cost_price, :slug, :description, :track_inventory + :slug, :description, :track_inventory ] @@image_attributes = [ :id, :position, :attachment_content_type, :attachment_file_name, :type, :attachment_updated_at, :attachment_width, :attachment_height, :alt @@ -81,11 +84,11 @@ @@option_type_attributes = [:id, :name, :presentation, :position] @@payment_attributes = [ :id, :source_type, :source_id, :amount, :display_amount, - :payment_method_id, :state, :avs_response, :created_at, + :payment_method_id, :response_code, :state, :avs_response, :created_at, :updated_at ] @@payment_method_attributes = [:id, :name, :description] @@ -102,12 +105,11 @@ :id, :lock_version, :state, :variant_id, :shipment_id, :return_authorization_id ] @@return_authorization_attributes = [ - :id, :number, :state, :amount, :order_id, :reason, :created_at, - :updated_at + :id, :number, :state, :order_id, :memo, :created_at, :updated_at ] @@address_attributes = [ :id, :firstname, :lastname, :full_name, :address1, :address2, :city, :zipcode, :phone, :company, :alternative_phone, :country_id, :state_id, @@ -146,8 +148,20 @@ @@stock_item_attributes = [ :id, :count_on_hand, :backorderable, :lock_version, :stock_location_id, :variant_id ] + + @@promotion_attributes = [ + :id, :name, :description, :expires_at, :starts_at, :type, :usage_limit, :match_policy, :code, :advertise, :path + ] + + def variant_attributes + if @current_user_roles && @current_user_roles.include?("admin") + @@variant_attributes + [:cost_price] + else + @@variant_attributes + end + end end end end