Sha256: 837d3f618674ff896b771a9a403e2451824ffa612d80ab46d627f4eb08f91c6c
Contents?: true
Size: 615 Bytes
Versions: 5
Compression:
Stored size: 615 Bytes
Contents
# -*- encoding: utf-8 -*- module PMP class Response attr_accessor :raw, :request def initialize(raw, request) @raw = raw @request = request check_for_error(raw) end def check_for_error(response) status_code_type = response.status.to_s[0] case status_code_type when "2" # puts "all is well, status: #{response.status}" when "4", "5" raise "Whoops, error back from PMP: #{response.status}" else raise "Unrecongized status code: #{response.status}" end end def body self.raw.body end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
pmp-0.2.0 | lib/pmp/response.rb |
pmp-0.1.3 | lib/pmp/response.rb |
pmp-0.1.2 | lib/pmp/response.rb |
pmp-0.1.1 | lib/pmp/response.rb |
pmp-0.1.0 | lib/pmp/response.rb |