Sha256: 020f46e1e1c99f1612c67a914a31dee109f389c5cf49664c3e581bb2e9894547

Contents?: true

Size: 653 Bytes

Versions: 6

Compression:

Stored size: 653 Bytes

Contents

module Lono::Api
  class Client
    extend Memoist
    include Verify
    include Repos
    include Lono::Utils::Logging

    def http
      Proxy.new
    end
    memoize :http

    def load_json(res)
      if res.code == "200"
        data = JSON.load(res.body)
        case data
        when Array
          data.map(&:deep_symbolize_keys)
        when Hash
          data.deep_symbolize_keys
        end
      else
        if ENV['LONO_DEBUG_API']
          logger.info "Error: Non-successful http response status code: #{res.code}"
          logger.info "headers: #{res.each_header.to_h.inspect}"
        end
        nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/api/client.rb
lono-8.0.0.pre.rc5 lib/lono/api/client.rb
lono-8.0.0.pre.rc4 lib/lono/api/client.rb
lono-8.0.0.pre.rc3 lib/lono/api/client.rb
lono-8.0.0.pre.rc2 lib/lono/api/client.rb
lono-8.0.0.pre.rc1 lib/lono/api/client.rb