Class: ItunesReceiptEncoder::Payload
- Inherits:
-
Object
- Object
- ItunesReceiptEncoder::Payload
- Includes:
- Utils
- Defined in:
- lib/itunes_receipt_encoder/payload.rb
Overview
ItunesReceiptEncoder::Payload
Instance Attribute Summary collapse
-
#application_version ⇒ Object
Returns the value of attribute application_version.
-
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
-
#in_app ⇒ Object
Returns the value of attribute in_app.
-
#opaque_value ⇒ Object
Returns the value of attribute opaque_value.
-
#original_application_version ⇒ Object
Returns the value of attribute original_application_version.
-
#sha1_hash ⇒ Object
Returns the value of attribute sha1_hash.
-
#unique_vendor_identifier ⇒ Object
Returns the value of attribute unique_vendor_identifier.
Instance Method Summary collapse
-
#initialize(attrs = {}) {|_self| ... } ⇒ Payload
constructor
A new instance of Payload.
- #to_asn1_set ⇒ Object
- #to_plist_hash(options = {}) ⇒ Object
Methods included from Utils
#gmt_time, #ms_time, #pst_time
Constructor Details
#initialize(attrs = {}) {|_self| ... } ⇒ Payload
Returns a new instance of Payload.
18 19 20 21 22 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 18 def initialize(attrs = {}) attrs.each { |key, val| send("#{key}=", val) } @in_app ||= [] yield self if block_given? end |
Instance Attribute Details
#application_version ⇒ Object
Returns the value of attribute application_version.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def application_version @application_version end |
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def bundle_id @bundle_id end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def creation_date @creation_date end |
#environment ⇒ Object
Returns the value of attribute environment.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def environment @environment end |
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def expiration_date @expiration_date end |
#in_app ⇒ Object
Returns the value of attribute in_app.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def in_app @in_app end |
#opaque_value ⇒ Object
Returns the value of attribute opaque_value.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def opaque_value @opaque_value end |
#original_application_version ⇒ Object
Returns the value of attribute original_application_version.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def original_application_version @original_application_version end |
#sha1_hash ⇒ Object
Returns the value of attribute sha1_hash.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def sha1_hash @sha1_hash end |
#unique_vendor_identifier ⇒ Object
Returns the value of attribute unique_vendor_identifier.
13 14 15 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 13 def unique_vendor_identifier @unique_vendor_identifier end |
Instance Method Details
#to_asn1_set ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 24 def to_asn1_set ASN1.set [ asn1_environment, asn1_bundle_id, asn1_application_version, asn1_original_application_version, asn1_creation_date, (asn1_opaque_value if opaque_value), (asn1_sha1_hash if sha1_hash), (asn1_expiration_date if expiration_date) ].concat(asn1_in_app) end |
#to_plist_hash(options = {}) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/itunes_receipt_encoder/payload.rb', line 37 def to_plist_hash( = {}) transaction = InApp.new(in_app[.fetch(:index, 0)]) { 'bid' => bundle_id.to_s, 'bvrs' => application_version.to_s, 'unique-vendor-identifier' => unique_vendor_identifier.to_s }.merge(transaction.to_plist_hash()) end |