Class: Access::Offer
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from MuchMeta
#set_up_methods, #set_values
Constructor Details
#initialize(values) ⇒ Offer
Returns a new instance of Offer.
23
24
25
26
27
28
29
30
31
|
# File 'lib/access/offer.rb', line 23
def initialize(values)
@used_fields = []
set_up_methods(values)
set_values(values)
@categories = Access::Category.process_batch(@categories) if @categories
@links = Access::Link.new(@links) if @links
@offer_store = Access::Store.new(@offer_store) if @offer_store
@offer_uses_remaining = Access::Redemption.new(@offer_uses_remaining) if @offer_uses_remaining
end
|
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
5
6
7
|
# File 'lib/access/offer.rb', line 5
def location
@location
end
|
#store ⇒ Object
Returns the value of attribute store.
5
6
7
|
# File 'lib/access/offer.rb', line 5
def store
@store
end
|
Class Method Details
.find(offer_key, options = {}) ⇒ Object
11
12
13
|
# File 'lib/access/offer.rb', line 11
def self.find(offer_key, options = {})
Access::Api.new.find_offer offer_key, options
end
|
.find_uses_remaining(offer_key, options = {}) ⇒ Object
15
16
17
|
# File 'lib/access/offer.rb', line 15
def self.find_uses_remaining(offer_key, options = {})
Access::Api.new.find_offer_uses_remaining offer_key, options
end
|
.process_batch(chunk) ⇒ Object
19
20
21
|
# File 'lib/access/offer.rb', line 19
def self.process_batch(chunk)
chunk.map { |offer| new(offer) }
end
|
.search(options = {}) ⇒ Object
7
8
9
|
# File 'lib/access/offer.rb', line 7
def self.search(options = {})
Access::Api.new.search_offers options
end
|