Sha256: bfb75c79ecc9310fab71c31641f756f4064a738f33491fa85d7ebcbeed449cb9

Contents?: true

Size: 436 Bytes

Versions: 9

Compression:

Stored size: 436 Bytes

Contents

module Praxis
  class MultipartPart

    attr_accessor :body
    attr_accessor :headers
    attr_accessor :filename
    
    def initialize(body, headers={}, filename: nil)
      @body = body
      @headers = headers
      @filename = filename
    end

    def status
      @headers['Status'].to_i
    end

    def encode!
      case @body
      when Hash, Array
        @body = JSON.pretty_generate(@body)
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
praxis-0.14.0 lib/praxis/multipart/part.rb
praxis-0.13.0 lib/praxis/multipart/part.rb
praxis-0.11.2 lib/praxis/multipart/part.rb
praxis-0.11.1 lib/praxis/multipart/part.rb
praxis-0.11 lib/praxis/multipart/part.rb
praxis-0.11pre lib/praxis/multipart/part.rb
praxis-0.10.1 lib/praxis/multipart/part.rb
praxis-0.10.0 lib/praxis/multipart/part.rb
praxis-0.9 lib/praxis/multipart/part.rb