Sha256: 00e4937f5cdd783e583f68af00d7b033c8596ece8c38fdbf3fd673d81bf71d40
Contents?: true
Size: 952 Bytes
Versions: 2
Compression:
Stored size: 952 Bytes
Contents
# frozen_string_literal: true module Pcli class ApiRequest def initialize(path) @path = path @method = 'get' @params = {} @headers = { 'Content-Type': 'application/json' } end def method(value = nil) if value @method = value self else @method end end def path(value = nil) if value @path = value self else @path end end def params(value = nil) if value @params = @params.merge(value) self else @params end end def param(key, value) @params[key] = value self end def headers(value = nil) if value @headers = @headers.merge(value) self else @headers end end def header(key, value) @headers[key] = value self end attr_writer :path, :method, :params, :headers end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pcli-0.1.1 | lib/pcli/api_request.rb |
pcli-0.1.0 | lib/pcli/api_request.rb |