Class: KondutoLoyalty

Inherits:
Object
  • Object
show all
Defined in:
lib/konduto-ruby/konduto_loyalty.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ KondutoLoyalty

Returns a new instance of KondutoLoyalty.


4
5
6
7
8
9
10
# File 'lib/konduto-ruby/konduto_loyalty.rb', line 4

def initialize(*args)
  unless args[0].nil?
    args[0].each do |k,v|
      instance_variable_set("@#{k}", v) unless v.nil?
    end
  end
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category


2
3
4
# File 'lib/konduto-ruby/konduto_loyalty.rb', line 2

def category
  @category
end

#programObject

Returns the value of attribute program


2
3
4
# File 'lib/konduto-ruby/konduto_loyalty.rb', line 2

def program
  @program
end

Instance Method Details

#to_hashObject


12
13
14
15
16
17
18
# File 'lib/konduto-ruby/konduto_loyalty.rb', line 12

def to_hash
  hash = {
      program: self.program,
      category: self.category
  }
  KondutoUtils.remove_nil_keys_from_hash(hash)
end

#to_jsonObject


20
21
22
# File 'lib/konduto-ruby/konduto_loyalty.rb', line 20

def to_json
  self.to_hash.to_json
end