traitify 1.8.2 → 1.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58c9b5d889ea03bdf0e6772d54ea60557a4683f5
4
- data.tar.gz: 25820511725fc3dcf27e3118edbdc80003fcab57
3
+ metadata.gz: 3e02ed1efa442b5f118963e006b0ca8ac16f3ff2
4
+ data.tar.gz: cbbff4cec554cdaff99ff387500c5d58e4fbefcc
5
5
  SHA512:
6
- metadata.gz: 9038ae9d321c42c792cec46bc35007c4af394700ffa67b8c815a9dce48199e64e8a0b9a3c94ffc539039f9eff96798cc790df8073238a6e54a6470ce1967994e
7
- data.tar.gz: 18a402a17d30443eb74a0a05c58de3fc520bd7999cc6cac7244d2f34c90556d5a3ec0e68ae498e706b544bc557fdbabb1325b141bdb4d26c994d2965386a8bb1
6
+ metadata.gz: 4b8b50395735f2a9b1ef7187b83fa6c56ba6d2629528d8bffc59ad9ee1b53247a0983a3f544e9919ae703f70547ad5e6aa7c48d18b77ab3fe401e51c7ddd2213
7
+ data.tar.gz: b5f3738d2a60d6ca18508d2d8c1af4ffa61038d4c4f2b501e47aced6afd51b75afaf6866a2179f1b7a3781d9ab7336fe28bb1ce8c2981949ba9cc6bf647192ec
@@ -1,3 +1,9 @@
1
+ ### 1.8.3
2
+
3
+ * Bug Fixes
4
+ * Fixed errors syntax error on special cases
5
+ * Updated docs
6
+
1
7
  ### 1.8.2
2
8
 
3
9
  * Bug Fixes
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- traitify (1.8.1)
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.7)
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.20.4)
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 Developer's API
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.secret = "secret"
25
- traitify.api_host = "http://example.com"
26
- traitify.api_version = "v1"
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
- api_host: "http://example.com",
40
- api_version: "v1",
41
- deck_id: "deck-uuid",
42
- secret: "secret"
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 })
@@ -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.use ContentTypeMiddleware
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
@@ -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 << "#{response.body.first["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
@@ -1,3 +1,3 @@
1
1
  module Traitify
2
- VERSION = "1.8.2"
2
+ VERSION = "1.8.3"
3
3
  end
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.2
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-04-18 00:00:00.000000000 Z
12
+ date: 2015-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie