Sha256: 249198347908af5f55c930a3213f03f04c974953fca43ac075492d1d4bd42f28

Contents?: true

Size: 657 Bytes

Versions: 2

Compression:

Stored size: 657 Bytes

Contents

module PipelineDeals
  class Resource < ActiveResource::Base
    self.site = "https://api.pipelinedeals.com"
    self.prefix = "/api/v3/"
    self.collection_parser = PipelineDeals::Collection


    def self.find(*arguments)
      scope = arguments.slice!(0)
      options = arguments.slice!(0) || {}

      if options[:params]
        options[:params].merge!({api_key: PipelineDeals.api_key})
      else
        options.merge!({params: {api_key: PipelineDeals.api_key}})
      end

      super(scope, options)
    end

    def save
      prefix_options[:api_key] = PipelineDeals.api_key
      self.include_root_in_json = true
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pipeline_deals-0.1.0 lib/pipeline_deals/resource.rb
pipeline_deals-0.0.2 lib/pipeline_deals/resource.rb