Class: AccessGrid::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/accessgrid/access_cards.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Card



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/accessgrid/access_cards.rb', line 65

def initialize(data)
  data ||= {}
  @id = data.fetch('id', nil)
  @state = data.fetch('state', nil)
  @url = data.fetch('install_url', nil)
  @install_url = data.fetch('install_url', nil)
  @details = data.fetch('details', nil)
  @full_name = data.fetch('full_name', nil)
  @expiration_date = data.fetch('expiration_date', nil)
  @card_template_id = data.fetch('card_template_id', nil)
  @card_number = data.fetch('card_number', nil)
  @site_code = data.fetch('site_code', nil)
  @file_data = data.fetch('file_data', nil)
  @direct_install_url = data.fetch('direct_install_url', nil)
  @devices = data.fetch('devices', [])
  @metadata = data.fetch('metadata', {})
end

Instance Attribute Details

#card_numberObject (readonly)

Returns the value of attribute card_number.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def card_number
  @card_number
end

#card_template_idObject (readonly)

Returns the value of attribute card_template_id.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def card_template_id
  @card_template_id
end

#detailsObject (readonly)

Returns the value of attribute details.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def details
  @details
end

#devicesObject (readonly)

Returns the value of attribute devices.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def devices
  @devices
end

#direct_install_urlObject (readonly)

Returns the value of attribute direct_install_url.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def direct_install_url
  @direct_install_url
end

#expiration_dateObject (readonly)

Returns the value of attribute expiration_date.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def expiration_date
  @expiration_date
end

#file_dataObject (readonly)

Returns the value of attribute file_data.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def file_data
  @file_data
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def full_name
  @full_name
end

#idObject (readonly)

Returns the value of attribute id.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def id
  @id
end

#install_urlObject (readonly)

Returns the value of attribute install_url.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def install_url
  @install_url
end

#metadataObject (readonly)

Returns the value of attribute metadata.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def 
  @metadata
end

#site_codeObject (readonly)

Returns the value of attribute site_code.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def site_code
  @site_code
end

#stateObject (readonly)

Returns the value of attribute state.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def state
  @state
end

#urlObject (readonly)

Returns the value of attribute url.



61
62
63
# File 'lib/accessgrid/access_cards.rb', line 61

def url
  @url
end

Instance Method Details

#to_sObject Also known as: inspect



83
84
85
# File 'lib/accessgrid/access_cards.rb', line 83

def to_s
  "Card(name='#{@full_name}', id='#{@id}', state='#{@state}')"
end