Class: ItunesValidator::Receipt
- Inherits:
-
Object
- Object
- ItunesValidator::Receipt
- Defined in:
- lib/itunes_validator/receipt.rb
Instance Attribute Summary collapse
-
#app_item_id ⇒ Object
readonly
Returns the value of attribute app_item_id.
-
#bid ⇒ Object
readonly
Returns the value of attribute bid.
-
#bvrs ⇒ Object
readonly
Returns the value of attribute bvrs.
-
#expires_date ⇒ Object
readonly
Returns the value of attribute expires_date.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
-
#original_purchase_date ⇒ Object
readonly
Returns the value of attribute original_purchase_date.
-
#original_transaction_id ⇒ Object
readonly
Returns the value of attribute original_transaction_id.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#purchase_date ⇒ Object
readonly
Returns the value of attribute purchase_date.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#app_item_id ⇒ Object (readonly)
Returns the value of attribute app_item_id.
13 14 15 |
# File 'lib/itunes_validator/receipt.rb', line 13 def app_item_id @app_item_id end |
#bid ⇒ Object (readonly)
Returns the value of attribute bid.
13 14 15 |
# File 'lib/itunes_validator/receipt.rb', line 13 def bid @bid end |
#bvrs ⇒ Object (readonly)
Returns the value of attribute bvrs.
13 14 15 |
# File 'lib/itunes_validator/receipt.rb', line 13 def bvrs @bvrs end |
#expires_date ⇒ Object (readonly)
Returns the value of attribute expires_date.
12 13 14 |
# File 'lib/itunes_validator/receipt.rb', line 12 def expires_date @expires_date end |
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
10 11 12 |
# File 'lib/itunes_validator/receipt.rb', line 10 def item_id @item_id end |
#original_purchase_date ⇒ Object (readonly)
Returns the value of attribute original_purchase_date.
11 12 13 |
# File 'lib/itunes_validator/receipt.rb', line 11 def original_purchase_date @original_purchase_date end |
#original_transaction_id ⇒ Object (readonly)
Returns the value of attribute original_transaction_id.
9 10 11 |
# File 'lib/itunes_validator/receipt.rb', line 9 def original_transaction_id @original_transaction_id end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
10 11 12 |
# File 'lib/itunes_validator/receipt.rb', line 10 def product_id @product_id end |
#purchase_date ⇒ Object (readonly)
Returns the value of attribute purchase_date.
11 12 13 |
# File 'lib/itunes_validator/receipt.rb', line 11 def purchase_date @purchase_date end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
10 11 12 |
# File 'lib/itunes_validator/receipt.rb', line 10 def quantity @quantity end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
9 10 11 |
# File 'lib/itunes_validator/receipt.rb', line 9 def transaction_id @transaction_id end |
Class Method Details
.from_h(h) ⇒ Object
3 4 5 6 7 |
# File 'lib/itunes_validator/receipt.rb', line 3 def self.from_h(h) r = self.new r.from_h(h) r end |
Instance Method Details
#from_h(h) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/itunes_validator/receipt.rb', line 15 def from_h(h) @transaction_id, @original_transaction_id = h['transaction_id'], h['original_transaction_id'] @item_id = h['item_id'] @product_id = h['product_id'] @quantity = (Integer(h['quantity']) if h['quantity']) || 0 @transaction_id = h['transaction_id'] @purchase_date = (Time.at(h['purchase_date_ms'].to_i / 1000.0) if h['purchase_date_ms']) @original_purchase_date = (Time.at(h['original_purchase_date_ms'].to_i / 1000.0) if h['original_purchase_date_ms']) @expires_date = (Time.at(h['expires_date'].to_i / 1000.0) if h['expires_date']) @app_item_id, @bid, @bvrs = h['app_item_id'], h['bid'], h['bvrs'] self end |