Class: Decommas::Response::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/decommas/response/base.rb

Direct Known Subclasses

PriceService

Constant Summary collapse

VALID_RESPONSES =
[200]
THROTTLED_RESPONSES =
[429]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'lib/decommas/response/base.rb', line 7

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/decommas/response/base.rb', line 8

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message.



9
10
11
# File 'lib/decommas/response/base.rb', line 9

def message
  @message
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/decommas/response/base.rb', line 11

def success?
  VALID_RESPONSES.include?(@code)
end

#throttled?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/decommas/response/base.rb', line 15

def throttled?
  THROTTLED_RESPONSES.include?(@code)
end