Class: SpreeCmCommissioner::EventTicketGoogleWallet
- Inherits:
-
GoogleWallet
- Object
- Spree::Base
- Base
- GoogleWallet
- SpreeCmCommissioner::EventTicketGoogleWallet
- Defined in:
- app/models/spree_cm_commissioner/event_ticket_google_wallet.rb
Constant Summary
Constants inherited from GoogleWallet
Instance Method Summary collapse
- #class_creator ⇒ Object
- #class_updater ⇒ Object
- #event_end_date ⇒ Object
- #event_start_date ⇒ Object
- #object_builder ⇒ Object
- #set_class_id ⇒ Object
- #set_default_preferences ⇒ Object
- #verified? ⇒ Boolean
- #verified_at ⇒ Object
- #verify! ⇒ Object
- #verify_create!(response) ⇒ Object
Instance Method Details
#class_creator ⇒ Object
69 70 71 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 69 def class_creator SpreeCmCommissioner::GoogleWallets::EventTicketClassCreator.new(self) end |
#class_updater ⇒ Object
73 74 75 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 73 def class_updater SpreeCmCommissioner::GoogleWallets::EventTicketClassUpdater.new(self) end |
#event_end_date ⇒ Object
59 60 61 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 59 def event_end_date product.event&.to_date end |
#event_start_date ⇒ Object
55 56 57 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 55 def event_start_date product.event&.from_date end |
#object_builder ⇒ Object
77 78 79 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 77 def object_builder SpreeCmCommissioner::GoogleWallets::EventTicketObjectBuilder end |
#set_class_id ⇒ Object
63 64 65 66 67 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 63 def set_class_id return unless class_id.nil? self.class_id = product.slug end |
#set_default_preferences ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 24 def set_default_preferences self.preferred_issuer_name ||= product.vendor.name self.preferred_event_name ||= product.name self.preferred_venue_name ||= product.venue.place.name self.preferred_venue_address ||= product.venue.place.vicinity self.preferred_start_date = event_start_date unless event_start_date.nil? self.preferred_end_date = event_end_date unless event_end_date.nil? self.preferred_background_color = '#000000' self.preferred_response = nil self.preferred_verified_at = nil end |
#verified? ⇒ Boolean
36 37 38 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 36 def verified? preferred_verified_at.present? && preferred_response.present? end |
#verified_at ⇒ Object
51 52 53 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 51 def verified_at DateTime.parse(preferred_verified_at).strftime('%B %d, %Y %I:%M %p') if preferred_verified_at.present? end |
#verify! ⇒ Object
46 47 48 49 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 46 def verify! self.preferred_verified_at = DateTime.current save! end |
#verify_create!(response) ⇒ Object
40 41 42 43 44 |
# File 'app/models/spree_cm_commissioner/event_ticket_google_wallet.rb', line 40 def verify_create!(response) self.preferred_verified_at = DateTime.current self.preferred_response = response if response.present? save! end |