Sha256: 175c527c8d5e50689cf96d7c8488326c0e3133b372a213ebb2a5947657fdd565

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

module CommonHelpers
  def limit_exceeded_exception(request = {})
    request_options = {
      :headers=> {
        "Content-Type"=>"application/json", "Authorization"=>"OAuth 864b21f13485a7f2de49593f627213075e8eb046",
        "Host"=>"api.gb1.brightbox.com:443", "Content-Length"=>71
      },
      :host=>"api.gb1.brightbox.com", :mock=>false, :path=>"/1.0/servers",
      :port=>"443", :query=>nil, :scheme=>"https",
      :expects=>[202],
      :method=>"POST",
      :body=>"{\"image\":\"img-4gqhs\",\"server_type\":\"typ-qdiwq\",\"name\":\"medium servers\"}"
    }

    response = Excon::Response.new(
      :body => "{\"error_name\":\"account_limit_reached\",\"errors\":[\"Account limit reached, please contact support for more information\"]}",
      :status => 403,
      :headers => {
        "Date"=>"Tue, 28 Jun 2011 08:07:21 GMT", "Server"=>"Apache", "Cache-Control"=>"no-cache", "Access-Control-Allow-Origin"=>"*", "Access-Control-Allow-Headers"=>"Authorization", "Content-Length"=>"118", "Status"=>"403", "Content-Type"=>"application/json; charset=utf-8"
      }
    )

    Excon::Errors.status_error(request_options.merge(request),response)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
brightbox-cli-1.2.2 spec/support/common_helpers.rb
brightbox-cli-1.2.1 spec/support/common_helpers.rb
brightbox-cli-1.2.0 spec/support/common_helpers.rb
brightbox-cli-1.1.0 spec/support/common_helpers.rb
brightbox-cli-1.0.0 spec/support/common_helpers.rb
brightbox-cli-1.0.0.rc2 spec/support/common_helpers.rb
brightbox-cli-1.0.0.rc1 spec/support/common_helpers.rb