Class: KondutoOrderStatus

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ KondutoOrderStatus

Returns a new instance of KondutoOrderStatus.


7
8
9
10
11
12
13
# File 'lib/konduto-ruby/konduto_order_status.rb', line 7

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

#commentsObject

Returns the value of attribute comments


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

def comments
  @comments
end

#statusObject

Returns the value of attribute status


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

def status
  @status
end

Class Method Details

.allowed_statusObject


4
5
6
# File 'lib/konduto-ruby/konduto_order_status.rb', line 4

def self.allowed_status
  %w(APPROVED DECLINED NOT_AUTHORIZED CANCELLED FRAUD)
end

Instance Method Details

#to_hashObject


15
16
17
18
19
20
21
# File 'lib/konduto-ruby/konduto_order_status.rb', line 15

def to_hash
  hash = {
      status: self.status,
      comments: self.comments
  }
  KondutoUtils.remove_nil_keys_from_hash(hash)
end

#to_jsonObject


23
24
25
# File 'lib/konduto-ruby/konduto_order_status.rb', line 23

def to_json
  self.to_hash.to_json
end