Class: Trello::Api::Base

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

Direct Known Subclasses

Integration, Trello

Class Method Summary collapse

Class Method Details

.make_call(method, url, body, headers) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/trello/api/base.rb', line 7

def make_call(method, url, body, headers)
  headers = headers.merge('User-Agent' => 'Ruby')
  
  if method.to_s == 'get'
    result = HTTParty.public_send(method, url, query: body, headers: headers)
  else
    result = HTTParty.public_send(method, url, body: body, headers: headers)
  end

  unless result.success?
    abort "#{result.code} error: #{result.body}"
  end

  result
end