Sha256: 8babc1f3f7bd4a8f2e81bc53eefaf103fce3aa227e284b2aa92b97b25712dfdc

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

class Sendle::Api::Quote < Sendle::Api::Resource
  include Sendle::Api::Actions::Index

  class << self
    alias_method :execute, :index
  end

  def url
    Sendle::Api.base_url + "quote"
  end

  def include_credentials?
    false
  end

  def validate_index_request!(params)
    # Checking for required params
    required = %w( pickup_suburb pickup_postcode delivery_suburb delivery_postcode kilogram_weight)
    validate_presence_of!(required, params)

    # Checking for valid plan_name, if passed in
    if params[:plan_name]
      plan_name = params[:plan_name]
      raise Sendle::Api::Errors::InvalidPlan.new(plan_name) unless PLANS.include?(plan_name)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sendle-api-0.0.11 lib/sendle/api/quote.rb