jive_add_ons 0.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: ec47ad611676c21aa25d3f99a605e793e7bd1506
4
+ data.tar.gz: 6527cc006d3f56d9ca6f07742735bda91c988ea3
5
+ SHA512:
6
+ metadata.gz: f291d8672b0888ee05b2174863a0f749ff53e162300ada60da106704dd7e70539eea82873d9a9a5d89cc3d506794029814b8e586586794e83b9e406cb57848f7
7
+ data.tar.gz: 16aae033ed5b089e81639eee1b92cc510d2c9f8ef0f80f3cb88b68d7f6bf4038574a4204906cf4bef46c007e16d1021f3b8636bc29f838888d0feeefbcb647e9
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Butch Marshall
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = JiveAddOns
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'JiveAddOns'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+
19
+ load 'rails/tasks/engine.rake'
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+
25
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
26
+
27
+ require 'rspec/core'
28
+ require 'rspec/core/rake_task'
29
+
30
+ desc "Run all specs in spec directory (excluding plugin specs)"
31
+
32
+ RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
33
+
34
+ task :default => :spec
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,17 @@
1
+ require_dependency "jive_add_ons/application_controller"
2
+
3
+ module Concerns
4
+ module Controllers
5
+ module AddOns
6
+ extend JiveAddOns::Concerns::Controllers::AddOns
7
+ end
8
+ end
9
+ end
10
+
11
+ module JiveAddOns
12
+ class AddOnsController < ApplicationController
13
+ include Concerns::Controllers::AddOns
14
+
15
+ before_filter :validate_authenticity
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ module JiveAddOns
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module JiveAddOns
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module JiveAddOns
2
+ class AddOn < ActiveRecord::Base
3
+ self.table_name = "jive_add_ons"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ asdfasfasdf
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>JiveAddOns</title>
5
+ <%= stylesheet_link_tag "jive_add_ons/application", media: "all" %>
6
+ <%= javascript_include_tag "jive_add_ons/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ JiveAddOns::Engine.routes.draw do
2
+ post 'register' => "add_ons#create"
3
+ post 'unregister' => "add_ons#destroy"
4
+
5
+ mount JiveOsApps::Engine => "/osapps"
6
+ end
@@ -0,0 +1,16 @@
1
+ class CreateJiveAddOns < ActiveRecord::Migration
2
+ def change
3
+ create_table :jive_add_ons do |t|
4
+ t.string :tenant_id
5
+ t.string :client_id
6
+ t.string :client_secret
7
+ t.string :jive_signature
8
+ t.string :jive_signature_url
9
+ t.string :jive_url
10
+ t.boolean :uninstalled
11
+ t.integer :attempt
12
+
13
+ t.timestamps null: false
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,70 @@
1
+ module JiveAddOns
2
+ module Concerns
3
+ module Controllers
4
+ module AddOns
5
+ extend ActiveSupport::Concern
6
+
7
+ def create
8
+ @add_on = JiveAddOns::AddOn.create(register_params)
9
+ render :text => @add_on.inspect
10
+ end
11
+
12
+ def destroy
13
+ @add_on = JiveAddOns::AddOn.where(unregister_params).first
14
+
15
+ respond_to do |format|
16
+ if @add_on && @add_on.update_attributes(:uninstalled => true)
17
+ format.json { render :json => {} }
18
+ else
19
+ format.json { render :json => {}, status: :not_found }
20
+ end
21
+ end
22
+ end
23
+
24
+ protected
25
+ def validate_authenticity
26
+ if !::Jive::SignedRequest.validate_registration(json_params)
27
+ raise 'Could not validate request'
28
+ end
29
+ end
30
+
31
+ private
32
+ def json_params
33
+ ActionController::Parameters.new(JSON.parse(request.body.read))
34
+ end
35
+
36
+ def unregister_params
37
+ params.tap { |whitelisted|
38
+ whitelisted[:tenant_id] = whitelisted[:tenantId]
39
+ whitelisted[:client_id] = whitelisted[:clientId]
40
+ whitelisted[:jive_url] = whitelisted[:jiveUrl]
41
+ whitelisted[:jive_signature_url] = whitelisted[:jiveSignatureURL]
42
+ }.permit(
43
+ :tenant_id,
44
+ :client_id,
45
+ :jive_url,
46
+ :jive_signature_url
47
+ )
48
+ end
49
+
50
+ def register_params
51
+ json_params.tap { |whitelisted|
52
+ whitelisted[:tenant_id] = whitelisted[:tenantId]
53
+ whitelisted[:client_id] = whitelisted[:clientId]
54
+ whitelisted[:client_secret] = whitelisted[:clientSecret]
55
+ whitelisted[:jive_url] = whitelisted[:jiveUrl]
56
+ whitelisted[:jive_signature] = whitelisted[:jiveSignature]
57
+ whitelisted[:jive_signature_url] = whitelisted[:jiveSignatureURL]
58
+ }.permit(
59
+ :tenant_id,
60
+ :client_id,
61
+ :client_secret,
62
+ :jive_url,
63
+ :jive_signature,
64
+ :jive_signature_url
65
+ )
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,13 @@
1
+ module JiveAddOns
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace JiveAddOns
4
+
5
+ initializer :append_migrations do |app|
6
+ unless app.root.to_s.match(root.to_s)
7
+ config.paths["db/migrate"].expanded.each do |expanded_path|
8
+ app.config.paths["db/migrate"] << expanded_path
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module JiveAddOns
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "jive_add_ons/engine"
2
+
3
+ require "jive_add_ons/concerns/controllers/add_ons"
4
+
5
+ module JiveAddOns
6
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :jive_add_ons do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jive_add_ons
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Butch Marshall
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: jive_os_apps
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: jive-signed_request
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: factory_girl_rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: database_cleaner
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rack-cors
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: angular-ui-bootstrap-rails
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Api endpoints for making your platform Jive ready.
154
+ email:
155
+ - butch.a.marshall@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - MIT-LICENSE
161
+ - README.rdoc
162
+ - Rakefile
163
+ - app/assets/javascripts/jive_add_ons/application.js
164
+ - app/assets/stylesheets/jive_add_ons/application.css
165
+ - app/controllers/jive_add_ons/add_ons_controller.rb
166
+ - app/controllers/jive_add_ons/application_controller.rb
167
+ - app/helpers/jive_add_ons/application_helper.rb
168
+ - app/models/jive_add_ons/add_on.rb
169
+ - app/views/jive_add_ons/add_ons/create.erb
170
+ - app/views/layouts/jive_add_ons/application.html.erb
171
+ - config/routes.rb
172
+ - db/migrate/20150718193211_create_jive_add_ons.rb
173
+ - lib/jive_add_ons.rb
174
+ - lib/jive_add_ons/concerns/controllers/add_ons.rb
175
+ - lib/jive_add_ons/engine.rb
176
+ - lib/jive_add_ons/version.rb
177
+ - lib/tasks/jive_add_ons_tasks.rake
178
+ homepage: https://github.com/butchmarshall/jive_add_ons
179
+ licenses:
180
+ - MIT
181
+ metadata: {}
182
+ post_install_message:
183
+ rdoc_options: []
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubyforge_project:
198
+ rubygems_version: 2.4.8
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: Rails Engine for handling Jive add-ons.
202
+ test_files: []