Sha256: b364a002abc3ede0fc5a31ac6048a028ce725deb0369405959e0163641f8371d
Contents?: true
Size: 1.02 KB
Versions: 9
Compression:
Stored size: 1.02 KB
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 @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
9 entries across 9 versions & 1 rubygems