Sha256: eed4254f5336cd01860e46e6a0a44854d109bd99940428ef976e2df1a99463af

Contents?: true

Size: 860 Bytes

Versions: 13

Compression:

Stored size: 860 Bytes

Contents

module Access
  class Spot

    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)
      self.class.class_eval {attr_reader *values.keys }
      values.each do |attribute_name, attribute_value|
        self.instance_variable_set("@#{attribute_name}", attribute_value)
      end
      @offer_resource = Access::Offer.new(@offer_resource) if @offer_resource
      @links = Access::Link.process_batch(@links) if @links
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
access-2.0.40 lib/access/spot.rb
access-2.0.39 lib/access/spot.rb
access-2.0.38 lib/access/spot.rb
access-2.0.37 lib/access/spot.rb
access-2.0.36 lib/access/spot.rb
access-2.0.34 lib/access/spot.rb
access-2.0.33 lib/access/spot.rb
access-2.0.32 lib/access/spot.rb
access-2.0.31 lib/access/spot.rb
access-2.0.30 lib/access/spot.rb
access-2.0.29 lib/access/spot.rb
access-2.0.28 lib/access/spot.rb
access-2.0.27 lib/access/spot.rb