Class: GoogleWallet::Resources::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/google_wallet/resources/base.rb

Direct Known Subclasses

EventTicket::Class, EventTicket::Object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes: {}, options: {}) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
# File 'lib/google_wallet/resources/base.rb', line 8

def initialize(attributes: {}, options: {})
  @options = options

  attributes.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/google_wallet/resources/base.rb', line 6

def options
  @options
end

Instance Method Details

#attributesObject



16
17
18
19
# File 'lib/google_wallet/resources/base.rb', line 16

def attributes
  hash = deep_merge(template, options)
  remove_empty_values(hash)
end

#payload_keyObject



21
22
23
# File 'lib/google_wallet/resources/base.rb', line 21

def payload_key
  raise 'Define in resource'
end