Class: Google4R::Checkout::Item::DigitalContent
- Inherits:
-
Object
- Object
- Google4R::Checkout::Item::DigitalContent
- Defined in:
- lib/google4r/checkout/shared.rb
Overview
A DigitalContent item represents the information relating to online delivery of digital items
You should never initialize it directly but use Item#digital_content instead
See code.google.com/apis/checkout/developer/Google_Checkout_Digital_Delivery.html for information on Google Checkout’s idea of digital content.
item.digital_content do |dc|
dc.optimistic!
dc.description = %{Here's some information on how to get your content}
end
Constant Summary collapse
- OPTIMISTIC =
Constants for display-disposition
'OPTIMISTIC'
- PESSIMISTIC =
'PESSIMISTIC'
Instance Attribute Summary collapse
-
#description ⇒ Object
A description of how the user should access the digital content after completing the order (string, required for description-based delivery, otherwise optional).
-
#display_disposition ⇒ Object
Either ‘OPTIMISTIC’ or ‘PESSIMISTIC’.
-
#email_delivery ⇒ Object
A boolean identifying whether email delivery is used for this item.
-
#key ⇒ Object
A key required by the user to access this digital content after completing the order (string, optional).
-
#url ⇒ Object
A URL required by the user to access this digital content after completing the order (string, optional).
Class Method Summary collapse
-
.create_from_element(element) ⇒ Object
Creates a new DigitalContent object from a REXML::Element object.
Instance Method Summary collapse
-
#initialize ⇒ DigitalContent
constructor
A new instance of DigitalContent.
Constructor Details
#initialize ⇒ DigitalContent
Returns a new instance of DigitalContent.
380 381 382 |
# File 'lib/google4r/checkout/shared.rb', line 380 def initialize @display_disposition = PESSIMISTIC end |
Instance Attribute Details
#description ⇒ Object
A description of how the user should access the digital content after completing the order (string, required for description-based delivery, otherwise optional)
359 360 361 |
# File 'lib/google4r/checkout/shared.rb', line 359 def description @description end |
#display_disposition ⇒ Object
Either ‘OPTIMISTIC’ or ‘PESSIMISTIC’. If OPTIMISTIC, then Google will display instructions for accessing the digital content as soon as the buyer confirms the order. Optional, but default is PESSIMISTIC
364 365 366 |
# File 'lib/google4r/checkout/shared.rb', line 364 def display_disposition @display_disposition end |
#email_delivery ⇒ Object
A boolean identifying whether email delivery is used for this item.
372 373 374 |
# File 'lib/google4r/checkout/shared.rb', line 372 def email_delivery @email_delivery end |
#key ⇒ Object
A key required by the user to access this digital content after completing the order (string, optional)
375 376 377 |
# File 'lib/google4r/checkout/shared.rb', line 375 def key @key end |
#url ⇒ Object
A URL required by the user to access this digital content after completing the order (string, optional)
378 379 380 |
# File 'lib/google4r/checkout/shared.rb', line 378 def url @url end |
Class Method Details
.create_from_element(element) ⇒ Object
Creates a new DigitalContent object from a REXML::Element object
385 386 387 388 389 390 391 392 393 |
# File 'lib/google4r/checkout/shared.rb', line 385 def self.create_from_element(element) result = DigitalContent.new result.description = element.elements['description'].text rescue nil result.display_disposition = element.elements['display-disposition'].text rescue nil result.email_delivery = element.elements['email-delivery'].text rescue nil # TODO need to convert to boolean? result.key = element.elements['key'].text rescue nil result.url = element.elements['url'].text rescue nil return result end |