alloy-api 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/alloy-api.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1076ec91022b7cb844f4cc76e0b04dad0443264a3251664fc475f14c0d94084
|
4
|
+
data.tar.gz: a91bf5c6064ffc4efc064847a5177167a38f0e7dfc1b46f6985c444e0aeede1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b6fecf31ea23cfd1e6ef6afeed2c43a5def2cdd116fe531e965fff72eda1d10fd6b133ae3238f5dc066a30d5bf7ebc554764270e48c4e5075a76c8ad6cef72
|
7
|
+
data.tar.gz: 58672b36421dc156ff4c0c486bd48c3d3e8b3a9e330f2283c1e1b5d21135813325facfa4b72ddc7d65faee94fe5fd442db47d6a50f9efa82781289b29e703f00
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -53,6 +53,7 @@ The Alloy.co api methods are implemented by the Api class. Most take a set of op
|
|
53
53
|
Alloy::Api.parameters(method: 'get') # The default method is 'post' - this method will get required/optional parameters for running evaluations
|
54
54
|
Alloy::Api.evaluations(body: { first_name: 'John', last_name: 'Smith' }, headers: { 'Alloy-Refresh-Cache': 'true' }) # Runs an evaluation. Headers can be set as well, but the Content-Type and Authorization are automatic
|
55
55
|
Alloy::Api.parameters(method: 'get', endpoint: :other_endpoint) # use a different endpoint - allowing for multiple workflows to be used
|
56
|
+
Alloy::Api.some_method(body: "hello world", body_encoding: :to_s) # use to_s on the body object instead of to_json. Important for non-json uploads
|
56
57
|
```
|
57
58
|
|
58
59
|
## License
|
data/lib/alloy-api.rb
CHANGED
@@ -46,6 +46,7 @@ module Alloy
|
|
46
46
|
method = options[:method] || "post"
|
47
47
|
endpoint = options[:endpoint] || :main
|
48
48
|
uri = "#{@@api_endpoints[endpoint][:uri]}#{path}"
|
49
|
+
body_encoding = options[:body_encoding] || :to_json
|
49
50
|
headers = {
|
50
51
|
"Content-Type" => "application/json",
|
51
52
|
"Authorization" => auth_param(endpoint)
|
@@ -53,7 +54,7 @@ module Alloy
|
|
53
54
|
if options[:body_stream].present?
|
54
55
|
response = HTTParty.send(method, uri, { headers: headers, body_stream: options[:body_stream] })
|
55
56
|
else
|
56
|
-
response = HTTParty.send(method, uri, {headers: headers, body: (options[:body] || {}).
|
57
|
+
response = HTTParty.send(method, uri, { headers: headers, body: (options[:body] || {}).send(body_encoding) })
|
57
58
|
end
|
58
59
|
return response if options[:raw]
|
59
60
|
JSON.parse(response.body)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alloy-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Schultz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|