Class: Blimp::API
- Inherits:
-
Object
show all
- Defined in:
- lib/blimp/api.rb
Defined Under Namespace
Classes: Forbidden, InternalServerError, NotFound, ResponseError
Constant Summary
collapse
- @@base_uri =
"https://app.getblimp.com/api/v2/"
Class Method Summary
collapse
Class Method Details
8
9
10
11
12
13
14
15
16
|
# File 'lib/blimp/api.rb', line 8
def
@headers ||= { 'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => "ApiKey #{Blimp.username}:#{Blimp.api_key}",
'X_BLIMP_APPID' => Blimp.app_id,
'X_BLIMP_SECRET' => Blimp.app_secret,
'User-Agent' => "Blimp-gem/#{Blimp::VERSION}"
}
end
|
.method_missing(method_name, *args) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/blimp/api.rb', line 18
def method_missing method_name, *args
super(method_name, args) unless [:get, :post, :put, :patch, :head, :destroy].include? method_name
uri = @@base_uri + args.shift
body = nil
body = args.shift[:body] if args.first.has_key? :body
query = nil
query = args.shift
HTTParty.send(method_name, uri, headers: , query: query, body: body)
end
|