Class: Kickstapi::Reward

Inherits:
Object
  • Object
show all
Defined in:
lib/kickstapi/reward.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Reward

Returns a new instance of Reward.



6
7
8
9
10
# File 'lib/kickstapi/reward.rb', line 6

def initialize(attributes={})
  attributes.each do |key, value|
    public_send("#{key}=", value)
  end
end

Instance Attribute Details

#backersObject

Returns the value of attribute backers.



3
4
5
# File 'lib/kickstapi/reward.rb', line 3

def backers
  @backers
end

#delivery_dateObject

Returns the value of attribute delivery_date.



3
4
5
# File 'lib/kickstapi/reward.rb', line 3

def delivery_date
  @delivery_date
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/kickstapi/reward.rb', line 3

def description
  @description
end

#priceObject

Returns the value of attribute price.



3
4
5
# File 'lib/kickstapi/reward.rb', line 3

def price
  @price
end

Instance Method Details

#to_hashObject



13
14
15
16
17
18
19
20
# File 'lib/kickstapi/reward.rb', line 13

def to_hash
  hash = {}
  self.instance_variables.each do |var|
    sym = var.to_s.gsub(/@/, '')
    hash[sym.to_sym] = self.instance_variable_get var
  end
  hash
end

#to_json(*a) ⇒ Object



22
23
24
# File 'lib/kickstapi/reward.rb', line 22

def to_json(*a)
  self.to_hash.to_json
end