Sha256: 9a6624f6ecb8cd11aaa5eca8c7ebdb6c929a3563b2c5c294c7f79c9d77d2f042

Contents?: true

Size: 958 Bytes

Versions: 7

Compression:

Stored size: 958 Bytes

Contents

module Access
  class Spot
    include Access::MuchMeta

    def self.search_by_channel(channel_key, options = {})
      Access::Api.new.search_spots_by_channel channel_key, options
    end

    def self.search_by_campaign(campaign_key, options = {})
      Access::Api.new.search_spots_by_campaign campaign_key, options
    end

    def self.find(spot_key, options = {})
      Access::Api.new.find_spot spot_key, options
    end

    def self.process_batch(chunk)
      chunk.map { |spot| new(spot) }
    end

    def initialize(values)
      @used_fields = []
      set_up_methods(values)
      set_values(values)
      @offer_resource = Access::Offer.new(@offer_resource) if @offer_resource
      @campaign_resource = Access::Campaign.new(@campaign_resource) if @campaign_resource
      @links = Access::Link.process_batch(@links) if @links
    end

    def offer
      @offer_resource
    end

    def campaign
      @campaign_resource
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
access-2.3.0.pre.rc2 lib/access/spot.rb
access-2.3.0.pre.rc1 lib/access/spot.rb
access-2.2.0 lib/access/spot.rb
access-2.1.5 lib/access/spot.rb
access-2.1.4 lib/access/spot.rb
access-2.1.3 lib/access/spot.rb
access-2.1.2 lib/access/spot.rb