Class: Tinypass::Offer
- Inherits:
-
Object
- Object
- Tinypass::Offer
- Defined in:
- lib/tinypass/offer.rb
Instance Attribute Summary collapse
-
#policies ⇒ Object
readonly
Returns the value of attribute policies.
-
#pricing ⇒ Object
readonly
Returns the value of attribute pricing.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #has_active_prices? ⇒ Boolean
-
#initialize(resource, *price_options_or_policy) ⇒ Offer
constructor
A new instance of Offer.
Constructor Details
#initialize(resource, *price_options_or_policy) ⇒ Offer
Returns a new instance of Offer.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tinypass/offer.rb', line 5 def initialize(resource, *) raise ArgumentError.new("Can't initialize offer without price options or policy") if .empty? @resource = resource @policies = [] @tags = [] if .first.kind_of?(PricingPolicy) @pricing = .first else @pricing = PricingPolicy.new() end end |
Instance Attribute Details
#policies ⇒ Object (readonly)
Returns the value of attribute policies.
3 4 5 |
# File 'lib/tinypass/offer.rb', line 3 def policies @policies end |
#pricing ⇒ Object (readonly)
Returns the value of attribute pricing.
3 4 5 |
# File 'lib/tinypass/offer.rb', line 3 def pricing @pricing end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
3 4 5 |
# File 'lib/tinypass/offer.rb', line 3 def resource @resource end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/tinypass/offer.rb', line 3 def @tags end |
Instance Method Details
#has_active_prices? ⇒ Boolean
19 20 21 |
# File 'lib/tinypass/offer.rb', line 19 def has_active_prices? pricing. end |