Sha256: 7b6b86b3d47ffbfafa746cc42adb64a606a7baa539855d882079e3d538d5d6c7

Contents?: true

Size: 498 Bytes

Versions: 8

Compression:

Stored size: 498 Bytes

Contents

require "json"
require "ostruct"

module Digicert
  class Response
    def initialize(response)
      @response = response
    end

    def parse
      parse_response || response
    end

    private

    attr_reader :response

    def parse_response
      if response.body
        JSON.parse(response.body, object_class: response_object_klass)
      end
    end

    def response_object_klass
      Digicert.configuration.response_klass
    end
  end

  class ResponseObject < OpenStruct; end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
digicert-1.0.0 lib/digicert/response.rb
digicert-0.5.0 lib/digicert/response.rb
digicert-0.4.1 lib/digicert/response.rb
digicert-0.4.0 lib/digicert/response.rb
digicert-0.3.1 lib/digicert/response.rb
digicert-0.3.0 lib/digicert/response.rb
digicert-0.2.0 lib/digicert/response.rb
digicert-0.1.2 lib/digicert/response.rb