Module: RubyLokaliseApi::BaseRequest

Includes:
Connection, JsonHandler
Included in:
OAuth2::Auth, Request
Defined in:
lib/ruby_lokalise_api/base_request.rb

Instance Method Summary collapse

Methods included from Connection

#connection

Methods included from JsonHandler

#custom_dump, #custom_load

Instance Method Details

#delete(path, client, params = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ruby_lokalise_api/base_request.rb', line 36

def delete(path, client, params = {})
  respond_with(
    # Rubocop tries to replace `delete` with `gsub` but that's a different method here!
    # rubocop:disable Style/CollectionMethods
    connection(client).delete(prepare(path)) do |req|
      # rubocop:enable Style/CollectionMethods
      req.body = custom_dump params
    end,
    client
  )
end

#get(path, client, params = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/ruby_lokalise_api/base_request.rb', line 8

def get(path, client, params = {})
  respond_with(
    connection(client).get(prepare(path), params),
    client
  )
end

#patch(path, client, params = {}) ⇒ Object



29
30
31
32
33
34
# File 'lib/ruby_lokalise_api/base_request.rb', line 29

def patch(path, client, params = {})
  respond_with(
    connection(client).patch(prepare(path), params.any? ? custom_dump(params) : nil),
    client
  )
end

#post(path, client, params = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/ruby_lokalise_api/base_request.rb', line 15

def post(path, client, params = {})
  respond_with(
    connection(client).post(prepare(path), custom_dump(params)),
    client
  )
end

#put(path, client, params = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/ruby_lokalise_api/base_request.rb', line 22

def put(path, client, params = {})
  respond_with(
    connection(client).put(prepare(path), custom_dump(params)),
    client
  )
end