traitify-magis 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 77d4c1445bcdcced1bc75f9a405024865ccaaa72
4
+ data.tar.gz: e3b2e3b262f0d90d12538ab578f76961298b2eba
5
+ SHA512:
6
+ metadata.gz: 1488cc8e7226decf71cc3164473850e92034f51f020b88b10e4f3fa0eb2750c8af0c2725ac5ec96df35c567d46d84ae39159fa0c32a3fefd6f51bb39740eebdd
7
+ data.tar.gz: b184638344a7835d202b5b71841e13b3c001abd70da141f76ddfcd6d453c62e424998333b8dd58dd0ae33547ce944a88fc90ba3b02193b2928cbe552bc521c57
@@ -0,0 +1,37 @@
1
+ require "traitify-magis/version"
2
+ require "sinatra"
3
+ require "traitify"
4
+ require 'active_support/inflector'
5
+
6
+ class Api < Sinatra::Base
7
+ before "/majis.js" do
8
+ @traitify = Magis.load_configuration("traitify")
9
+ @traitify[:decks].each do |deck|
10
+ create_assessment(deck)
11
+ end
12
+ end
13
+
14
+ def traitify_credentials
15
+ @credentials ||= Magis.load_configuration("traitify")
16
+ end
17
+
18
+ def create_assessment(id)
19
+ traitify = Traitify.new
20
+
21
+ traitify.secret = ENV["TRAITIFY_SECRET"] || traitify_credentials["secret_key"]
22
+ traitify.api_host = ENV["TRAITIFY_API_HOST"] || traitify_credentials["api_host"]
23
+ traitify.api_version = ENV["TRAITIFY_API_VERSION"] || traitify_credentials["api_version"]
24
+ if Magis.db["users"]["assessments"][id]
25
+ assessment_id = traitify.create_assessment(deck_id: id).id
26
+ Magis.db["users"].update({"_id" => current_user["_id"]}, {
27
+ "$set" => {
28
+ assessments: {
29
+ id.camelcase(:lower) => assessment_id
30
+ }
31
+ }
32
+ })
33
+
34
+ assessment_id
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module TraitifyMagis
2
+ VERSION = "1.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: traitify-magis
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hashrocket Workstation
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: traitify
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.1.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: " Write a longer description. Optional."
56
+ email:
57
+ - dev@hashrocket.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/traitify-magis.rb
63
+ - lib/traitify-magis/version.rb
64
+ homepage: ''
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.2.2
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Write a short summary. Required.
88
+ test_files: []