app/helpers/spree/api/api_helpers.rb in spree_api-3.3.6 vs app/helpers/spree/api/api_helpers.rb in spree_api-3.4.0.rc1

- old
+ new

@@ -36,18 +36,18 @@ ] mattr_reader *ATTRIBUTES def required_fields_for(model) - required_fields = model._validators.select do |field, validations| + required_fields = model._validators.select do |_field, validations| validations.any? { |v| v.is_a?(ActiveModel::Validations::PresenceValidator) } end.map(&:first) # get fields that are invalid # Permalinks presence is validated, but are really automatically generated # Therefore we shouldn't tell API clients that they MUST send one through - required_fields.map!(&:to_s).delete("permalink") + required_fields.map!(&:to_s).delete('permalink') # Do not require slugs, either - required_fields.delete("slug") + required_fields.delete('slug') required_fields end @@product_attributes = [ :id, :name, :description, :price, :display_price, :available_on, @@ -124,11 +124,11 @@ @@state_attributes = [:id, :name, :abbr, :country_id] @@adjustment_attributes = [ :id, :source_type, :source_id, :adjustable_type, :adjustable_id, :originator_type, :originator_id, :amount, :label, :mandatory, - :locked, :eligible, :created_at, :updated_at + :locked, :eligible, :created_at, :updated_at ] @@creditcard_attributes = [ :id, :month, :year, :cc_type, :last_digits, :name, :gateway_customer_profile_id, :gateway_payment_profile_id @@ -175,10 +175,10 @@ :id, :reimbursement_status, :customer_return_id, :order_id, :number, :total, :created_at, :updated_at ] def variant_attributes - if @current_user_roles && @current_user_roles.include?("admin") + if @current_user_roles && @current_user_roles.include?('admin') @@variant_attributes + [:cost_price] else @@variant_attributes end end