traitify-magis 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/traitify-magis/version.rb +1 -1
- data/lib/traitify-magis.rb +14 -9
- 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: daceb8b68c2d5c0944cc5198013faa4d84a96d89
|
4
|
+
data.tar.gz: ea9b709ad95acde0699aefe363be8c3fb534b6b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf70b346f09358f0ca9822a9e4ba28eb59d085d2b5ab419e76f03d23371a7fca87f361e06bd0740ca130230846b7c69299dd6d74340569845352f52a7db33552
|
7
|
+
data.tar.gz: 5feb80cf8603f5cfb163244e4595b03bcea90d880a4a7c27120e5182fe5a68619c19cc210eb283c8468da9e0e34024b5d692760ab45cd760791c8e02d5e49560
|
data/lib/traitify-magis.rb
CHANGED
@@ -4,10 +4,13 @@ require "traitify"
|
|
4
4
|
require 'active_support/inflector'
|
5
5
|
|
6
6
|
class Api < Sinatra::Base
|
7
|
-
before "
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
before "*" do
|
8
|
+
unless session["decks"]
|
9
|
+
@traitify = Magis.load_configuration("traitify")
|
10
|
+
@traitify["decks"].each do |deck|
|
11
|
+
create_assessment(deck)
|
12
|
+
end
|
13
|
+
session["decks"] = @traitify["decks"]
|
11
14
|
end
|
12
15
|
end
|
13
16
|
|
@@ -21,14 +24,16 @@ class Api < Sinatra::Base
|
|
21
24
|
traitify.secret = ENV["TRAITIFY_SECRET"] || traitify_credentials["secret_key"]
|
22
25
|
traitify.api_host = ENV["TRAITIFY_API_HOST"] || traitify_credentials["api_host"]
|
23
26
|
traitify.api_version = ENV["TRAITIFY_API_VERSION"] || traitify_credentials["api_version"]
|
27
|
+
p "creating assessment"
|
24
28
|
if Magis.db["users"]["assessments"][id]
|
25
29
|
assessment_id = traitify.create_assessment(deck_id: id).id
|
30
|
+
assessments = Magis.db["users"]["assessments"]
|
31
|
+
assessments[id] = {
|
32
|
+
id.camelcase(:lower) => assessment_id
|
33
|
+
}
|
34
|
+
|
26
35
|
Magis.db["users"].update({"_id" => current_user["_id"]}, {
|
27
|
-
"$set" =>
|
28
|
-
assessments: {
|
29
|
-
id.camelcase(:lower) => assessment_id
|
30
|
-
}
|
31
|
-
}
|
36
|
+
"$set" => assessments
|
32
37
|
})
|
33
38
|
|
34
39
|
assessment_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traitify-magis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hashrocket Workstation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: traitify
|