intervals_api 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/intervals_api/request_handler.rb +7 -11
- data/lib/intervals_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28f792607ddeff3949904c3b1186bc2f11ab07f4
|
4
|
+
data.tar.gz: 44240e86774fb89dfa49ebe7f2b4dd3ec85310f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c923f62f162a21b3d8cace555788685645b93394f46f1af29a99c3b28e1c86c159a3efc38e32f46a248034da49f57f2064567cc8c3a4b156d409fd3656ef5521
|
7
|
+
data.tar.gz: c337f295d3cf4ce33f724afa95e0320fb4a25a8ca0546fa85acfa65f9e5e58c4955705b877979b73927983d9a02bc2ff5dd52e94b82c25e164922e19dc4cbcfe
|
@@ -12,23 +12,19 @@ module IntervalsAPI
|
|
12
12
|
'Content-Type' => 'application/json',
|
13
13
|
'Authorization' => "Basic #{Base64.encode64(token + ":X")}"
|
14
14
|
},
|
15
|
-
query: {},
|
16
|
-
body: {}
|
17
15
|
}
|
18
16
|
end
|
19
17
|
|
20
18
|
%w(get post put delete options).each do |request_type|
|
21
19
|
define_method request_type do |url, options = {}|
|
20
|
+
|
21
|
+
query_options = @default_options
|
22
|
+
query_options[:headers].merge(options[:headers]) if options.key?(:header)
|
23
|
+
query_options[:query] = options[:query] if options.key?(:query)
|
24
|
+
query_options[:body ] = options[:body ].to_json if options.key?(:body)
|
25
|
+
|
22
26
|
RecursiveOpenStruct.new(
|
23
|
-
self.class.send(
|
24
|
-
request_type,
|
25
|
-
url,
|
26
|
-
{
|
27
|
-
headers: @default_options[:headers].merge( options[:headers].to_json),
|
28
|
-
query: @default_options[:query].merge( options[:query].to_json),
|
29
|
-
body: @default_options[:body].merge( options[:body].to_json)
|
30
|
-
}
|
31
|
-
)
|
27
|
+
self.class.send(request_type, url, query_options)
|
32
28
|
)
|
33
29
|
end
|
34
30
|
end
|