Sha256: 4bed4dd8553f5a719c3e46277064f4605e8f743c94fa6543c1d0f085f4cd8df0

Contents?: true

Size: 957 Bytes

Versions: 7

Compression:

Stored size: 957 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.1.1 lib/access/spot.rb
access-2.1.0 lib/access/spot.rb
access-2.0.55 lib/access/spot.rb
access-2.0.54 lib/access/spot.rb
access-2.0.53 lib/access/spot.rb
access-2.0.52 lib/access/spot.rb
access-2.0.51 lib/access/spot.rb