Class: CloudApp::GiftCard
Overview
An ActiveResource-like interface through which to interract with CloudApp gift cards.
Instance Attribute Summary (collapse)
-
- (Object) code
readonly
Returns the value of attribute code.
-
- (Object) created_at
readonly
Returns the value of attribute created_at.
-
- (Object) effective_at
readonly
Returns the value of attribute effective_at.
-
- (Object) expires_at
readonly
Returns the value of attribute expires_at.
-
- (Object) href
readonly
Returns the value of attribute href.
-
- (Object) id
readonly
Returns the value of attribute id.
-
- (Object) months
readonly
Returns the value of attribute months.
-
- (Object) plan
readonly
Returns the value of attribute plan.
-
- (Object) redeemed_at
readonly
Returns the value of attribute redeemed_at.
-
- (Object) updated_at
readonly
Returns the value of attribute updated_at.
Class Method Summary (collapse)
-
+ (CloudApp::GiftCard) find(code)
Get the details of an unredeemed gift card.
-
+ (CloudApp::GiftCard) redeem(code)
Apply a gift card to the authenticated account.
Instance Method Summary (collapse)
-
- (GiftCard) initialize(attributes = {})
constructor
Create a new CloudApp::GiftCard object.
-
- (CloudApp::GiftCard) redeem
Apply the gift card to the authenticated account.
Methods inherited from Base
Constructor Details
- (GiftCard) initialize(attributes = {})
Create a new CloudApp::GiftCard object.
Only used internally
51 52 53 |
# File 'lib/cloudapp/gift_card.rb', line 51 def initialize(attributes = {}) load(attributes) end |
Instance Attribute Details
- (Object) code (readonly)
Returns the value of attribute code
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def code @code end |
- (Object) created_at (readonly)
Returns the value of attribute created_at
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def created_at @created_at end |
- (Object) effective_at (readonly)
Returns the value of attribute effective_at
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def effective_at @effective_at end |
- (Object) expires_at (readonly)
Returns the value of attribute expires_at
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def expires_at @expires_at end |
- (Object) href (readonly)
Returns the value of attribute href
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def href @href end |
- (Object) id (readonly)
Returns the value of attribute id
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def id @id end |
- (Object) months (readonly)
Returns the value of attribute months
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def months @months end |
- (Object) plan (readonly)
Returns the value of attribute plan
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def plan @plan end |
- (Object) redeemed_at (readonly)
Returns the value of attribute redeemed_at
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def redeemed_at @redeemed_at end |
- (Object) updated_at (readonly)
Returns the value of attribute updated_at
42 43 44 |
# File 'lib/cloudapp/gift_card.rb', line 42 def updated_at @updated_at end |
Class Method Details
+ (CloudApp::GiftCard) find(code)
Get the details of an unredeemed gift card.
Requires authentication.
26 27 28 29 |
# File 'lib/cloudapp/gift_card.rb', line 26 def self.find(code) res = get "/gift_cards/#{code}", :digest_auth => @@auth res.ok? ? GiftCard.new(res) : res end |
+ (CloudApp::GiftCard) redeem(code)
Apply a gift card to the authenticated account.
Requires authentication.
37 38 39 40 |
# File 'lib/cloudapp/gift_card.rb', line 37 def self.redeem(code) res = put "/gift_cards/#{code}", :digest_auth => @@auth res.ok? ? GiftCard.new(res) : res end |
Instance Method Details
- (CloudApp::GiftCard) redeem
Apply the gift card to the authenticated account.
58 59 60 |
# File 'lib/cloudapp/gift_card.rb', line 58 def redeem self.class.redeem code end |