Class: KondutoSeller

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ KondutoSeller

Returns a new instance of KondutoSeller.



4
5
6
7
8
9
10
# File 'lib/konduto-ruby/konduto_seller.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

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#to_hashObject



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

def to_hash
  hash = {
      id: self.id,
      name: self.name,
      created_at: self.created_at
  }
  KondutoUtils.remove_nil_keys_from_hash(hash)
end

#to_jsonObject



21
22
23
# File 'lib/konduto-ruby/konduto_seller.rb', line 21

def to_json
  self.to_hash.to_json
end