lib/access/spot.rb in access-2.0.50 vs lib/access/spot.rb in access-2.0.51
- old
+ new
@@ -1,7 +1,8 @@
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
@@ -16,13 +17,12 @@
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
+ @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