Exception: Bandwidth::BandwidthRateLimitErrorException

Inherits:
APIException
  • Object
show all
Defined in:
lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb

Overview

BandwidthRateLimitError class.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ BandwidthRateLimitErrorException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



32
33
34
35
36
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 32

def initialize(reason, response)
  super(reason, response)
  hash = APIHelper.json_deserialize(@response.raw_body)
  unbox(hash)
end

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 15

def description
  @description
end

#field_errorsList of FieldError

TODO: Write general description for this method

Returns:



27
28
29
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 27

def field_errors
  @field_errors
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 19

def id
  @id
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 23

def status
  @status
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 11

def type
  @type
end

Instance Method Details

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • The (Hash)

    deserialized response sent by the server in the



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_rate_limit_error_exception.rb', line 41

def unbox(hash)
  @type = hash['type']
  @description = hash['description']
  @id = hash['id']
  @status = hash['status']
  # Parameter is an array, so we need to iterate through it
  @field_errors = nil
  unless hash['fieldErrors'].nil?
    @field_errors = []
    hash['fieldErrors'].each do |structure|
      @field_errors << (FieldError.from_hash(structure) if structure)
    end
  end
end