Class: ActiveClient::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_client/base.rb

Defined Under Namespace

Classes: Response

Instance Method Summary collapse

Instance Method Details

#delete(path) ⇒ Object



12
13
14
# File 'lib/active_client/base.rb', line 12

def delete(path)
  make_request(Net::HTTP::Delete, path)
end

#get(path, skip_parsing: false, **query) ⇒ Object



4
5
6
# File 'lib/active_client/base.rb', line 4

def get(path, skip_parsing: false, **query)
  make_request(Net::HTTP::Get, path, skip_parsing:, query:)
end

#multipart_post(path, body, skip_parsing: false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_client/base.rb', line 16

def multipart_post(path, body, skip_parsing: false)
  instrument(klass: Net::HTTP::Post, path:, query: nil,
             body: nil) do |http, request|
    request.set_form(body, "multipart/form-data")

    response = http.request(request)

    Response.new(parse_response(response.body, skip_parsing),
                 response.is_a?(Net::HTTPSuccess))
  end
end

#post(path, **body) ⇒ Object



8
9
10
# File 'lib/active_client/base.rb', line 8

def post(path, **body)
  make_request(Net::HTTP::Post, path, body:)
end