Class: ChannelAdvisor::MessageCode

Inherits:
Object
  • Object
show all
Defined in:
lib/channel_advisor/message_code.rb

Constant Summary collapse

Success =
MessageCode.new(0, 'Success')
Unexpected =
MessageCode.new(1, 'Unexpected')
NoAccountID =
MessageCode.new(3, 'No Account ID value was specified')
NoSkuValue =
MessageCode.new(5, 'No Sku value was specified')
TooManySkus =
MessageCode.new(8, 'The number of Sku values specified was greater than the maximum amount allowed by the method definition')

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, message) ⇒ MessageCode

Returns a new instance of MessageCode


5
6
7
8
# File 'lib/channel_advisor/message_code.rb', line 5

def initialize(code, message)
  @code = code
  @message = message
end

Instance Attribute Details

#codeObject

Returns the value of attribute code


3
4
5
# File 'lib/channel_advisor/message_code.rb', line 3

def code
  @code
end

#messageObject

Returns the value of attribute message


3
4
5
# File 'lib/channel_advisor/message_code.rb', line 3

def message
  @message
end

Class Method Details

.get(code) ⇒ Object


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/channel_advisor/message_code.rb', line 16

def self.get(code)
  code = code.to_i
  message = nil
  case code
  when 0
    Success
  when 1
    Unexpected
  when 3
    NoAccountID
  when 5
    NoSkuValue
  when 8
    TooManySkus
  else
    MessageCode.new(code, 'Unknown Error')
  end
end