traitify 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -3
- data/README.md +17 -8
- data/lib/traitify/connection.rb +3 -14
- data/lib/traitify/error.rb +2 -1
- data/lib/traitify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e02ed1efa442b5f118963e006b0ca8ac16f3ff2
|
4
|
+
data.tar.gz: cbbff4cec554cdaff99ff387500c5d58e4fbefcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b8b50395735f2a9b1ef7187b83fa6c56ba6d2629528d8bffc59ad9ee1b53247a0983a3f544e9919ae703f70547ad5e6aa7c48d18b77ab3fe401e51c7ddd2213
|
7
|
+
data.tar.gz: b5f3738d2a60d6ca18508d2d8c1af4ffa61038d4c4f2b501e47aced6afd51b75afaf6866a2179f1b7a3781d9ab7336fe28bb1ce8c2981949ba9cc6bf647192ec
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
traitify (1.8.
|
4
|
+
traitify (1.8.3)
|
5
5
|
faraday (~> 0.9)
|
6
6
|
faraday_middleware (~> 0.9)
|
7
7
|
hashie (~> 3.0)
|
@@ -9,7 +9,7 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.3.
|
12
|
+
addressable (2.3.8)
|
13
13
|
binding_of_caller (0.7.2)
|
14
14
|
debug_inspector (>= 0.0.1)
|
15
15
|
coderay (1.1.0)
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
rspec-mocks (2.99.3)
|
40
40
|
safe_yaml (1.0.4)
|
41
41
|
slop (3.6.0)
|
42
|
-
webmock (1.
|
42
|
+
webmock (1.21.0)
|
43
43
|
addressable (>= 2.3.6)
|
44
44
|
crack (>= 0.3.2)
|
45
45
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Traitify
|
2
2
|
|
3
|
-
Traitify is a ruby gem wrapper for the Traitify
|
3
|
+
Traitify is a ruby gem wrapper for the Traitify's Personality API
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -21,9 +21,10 @@ First, it is helpful to configure Traitify, otherwise everytime you create a Tra
|
|
21
21
|
All the configuration options can be found in `lib/Traitify/configuration.rb`
|
22
22
|
|
23
23
|
Traitify.configure do |traitify|
|
24
|
-
traitify.
|
25
|
-
traitify.
|
26
|
-
traitify.
|
24
|
+
traitify.host = "https://api-sandbox.traitify.com"
|
25
|
+
traitify.version = "v1"
|
26
|
+
traitify.secret_key = "secret"
|
27
|
+
traitify.public_key = "public" # Optional
|
27
28
|
traitify.deck_id = "deck-uuid" # Optional
|
28
29
|
traitify.image_pack = "image-pack-type" # Optional
|
29
30
|
end
|
@@ -36,10 +37,10 @@ All the configuration options can be found in `lib/Traitify/configuration.rb`
|
|
36
37
|
#### Without config file:
|
37
38
|
|
38
39
|
traitify = Traitify.new(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
host: "https://api-sandbox.traitify.com",
|
41
|
+
version: "v1",
|
42
|
+
secret_key: "secret",
|
43
|
+
deck_id: "deck-uuid"
|
43
44
|
)
|
44
45
|
traitify.create_assessment
|
45
46
|
|
@@ -153,3 +154,11 @@ Returns a results object:
|
|
153
154
|
personality_trait.name #=> "Imaginative"
|
154
155
|
personality_trait.definition #=> "Able to think symbolically and play with ideas."
|
155
156
|
personality_trait.description #=> "Coming Soon"
|
157
|
+
|
158
|
+
#### More results
|
159
|
+
|
160
|
+
More API endpoints may be available. You can find more at [developer.traitify.com](http://developer.traitify.com/documentation).
|
161
|
+
To make authenticated calls to new endpoints use the syntax below:
|
162
|
+
|
163
|
+
traitify.get("/new/endpoint")
|
164
|
+
traitify.post("/new/endpoint", { ready: true })
|
data/lib/traitify/connection.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "faraday_middleware"
|
2
2
|
require "traitify/error"
|
3
|
+
require "pry"
|
3
4
|
|
4
5
|
module Traitify
|
5
6
|
module Connection
|
@@ -7,7 +8,8 @@ module Traitify
|
|
7
8
|
Faraday.new(options) do |faraday|
|
8
9
|
faraday.request :url_encoded
|
9
10
|
faraday.request :basic_auth, self.secret_key, "x"
|
10
|
-
faraday.
|
11
|
+
faraday.headers["Accept"] = "application/json"
|
12
|
+
faraday.headers["Content-Type"] = "application/json"
|
11
13
|
faraday.use ErrorMiddleware
|
12
14
|
faraday.response :json, :content_type => /\bjson$/
|
13
15
|
faraday.adapter Faraday.default_adapter
|
@@ -15,19 +17,6 @@ module Traitify
|
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
18
|
-
|
19
|
-
class ContentTypeMiddleware < Faraday::Middleware
|
20
|
-
def initialize(app)
|
21
|
-
@app = app
|
22
|
-
end
|
23
|
-
|
24
|
-
def call(env)
|
25
|
-
env[:request_headers]["Accept"] = "application/json"
|
26
|
-
env[:request_headers]["Content-Type"] = "application/json"
|
27
|
-
@app.call(env)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
20
|
class ErrorMiddleware < Faraday::Middleware
|
32
21
|
def initialize(app)
|
33
22
|
@app = app
|
data/lib/traitify/error.rb
CHANGED
@@ -28,7 +28,8 @@ module Traitify
|
|
28
28
|
message = "#{response.method.upcase} | "
|
29
29
|
message << "#{response.url.to_s} | "
|
30
30
|
message << "#{response.status} | "
|
31
|
-
message <<
|
31
|
+
message << (response.body.is_a?(Hash) ?
|
32
|
+
"#{response.body["message"]}" : "#{response.body.first["message"]}")
|
32
33
|
message
|
33
34
|
end
|
34
35
|
end
|
data/lib/traitify/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traitify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Prats
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|