Class: SpreeCmCommissioner::Integrations::StadiumXV1::Resources::Ticket

Inherits:
Base
  • Object
show all
Defined in:
app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

from_collection

Constructor Details

#initialize(attributes = {}) ⇒ Ticket

Returns a new instance of Ticket.



25
26
27
28
29
30
31
32
33
34
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 25

def initialize(attributes = {})
  super(attributes)

  @is_used = attributes['is_used'] == true || attributes['is_used'] == 'true'
  @is_online = attributes['is_online'] != false
  @is_expired = attributes['is_expired'] == true || attributes['is_expired'] == 'true'
  @created_at = parse_timestamp(attributes['created_at'])
  @updated_at = parse_timestamp(attributes['updated_at'])
  @used_at = parse_timestamp(attributes['used_at'])
end

Instance Attribute Details

#__vObject

Returns the value of attribute __v.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def __v
  @__v
end

#_idObject

Returns the value of attribute _id.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def _id
  @_id
end

#cashbackObject

Returns the value of attribute cashback.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def cashback
  @cashback
end

#club_idObject

Returns the value of attribute club_id.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def club_id
  @club_id
end

#created_atObject

Returns the value of attribute created_at.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def created_at
  @created_at
end

#first_uidObject

Returns the value of attribute first_uid.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def first_uid
  @first_uid
end

#generated_byObject

Returns the value of attribute generated_by.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def generated_by
  @generated_by
end

#is_expiredObject

Returns the value of attribute is_expired.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def is_expired
  @is_expired
end

#is_onlineObject

Returns the value of attribute is_online.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def is_online
  @is_online
end

#is_usedObject

Returns the value of attribute is_used.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def is_used
  @is_used
end

#league_idObject

Returns the value of attribute league_id.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def league_id
  @league_id
end

#match_idObject

Returns the value of attribute match_id.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def match_id
  @match_id
end

#payment_methodObject

Returns the value of attribute payment_method.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def payment_method
  @payment_method
end

#remarkObject

Returns the value of attribute remark.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def remark
  @remark
end

#ticket_typeObject

Returns the value of attribute ticket_type.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def ticket_type
  @ticket_type
end

#token_idObject

Returns the value of attribute token_id.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def token_id
  @token_id
end

#uidObject

Returns the value of attribute uid.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def uid
  @uid
end

#updated_atObject

Returns the value of attribute updated_at.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def updated_at
  @updated_at
end

#used_atObject

Returns the value of attribute used_at.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def used_at
  @used_at
end

#zone_idObject

Returns the value of attribute zone_id.



4
5
6
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 4

def zone_id
  @zone_id
end

Instance Method Details

#to_hObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb', line 36

def to_h
  {
    _id: _id,
    match_id: match_id,
    uid: uid,
    first_uid: first_uid,
    generated_by: generated_by,
    club_id: club_id,
    zone_id: zone_id,
    league_id: league_id,
    token_id: token_id,
    payment_method: payment_method,
    ticket_type: ticket_type,
    remark: remark,
    is_used: is_used,
    is_online: is_online,
    used_at: used_at&.iso8601,
    is_expired: is_expired,
    created_at: created_at&.iso8601,
    updated_at: updated_at&.iso8601,
    cashback: cashback,
    __v: __v
  }.compact
end