jive_add_ons 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec47ad611676c21aa25d3f99a605e793e7bd1506
4
- data.tar.gz: 6527cc006d3f56d9ca6f07742735bda91c988ea3
3
+ metadata.gz: 0dd7a0583e6db12bb2036d8ed0df37ef22859fcb
4
+ data.tar.gz: 5c0b014812d86c550fb92aff6af01c1537eb28a7
5
5
  SHA512:
6
- metadata.gz: f291d8672b0888ee05b2174863a0f749ff53e162300ada60da106704dd7e70539eea82873d9a9a5d89cc3d506794029814b8e586586794e83b9e406cb57848f7
7
- data.tar.gz: 16aae033ed5b089e81639eee1b92cc510d2c9f8ef0f80f3cb88b68d7f6bf4038574a4204906cf4bef46c007e16d1021f3b8636bc29f838888d0feeefbcb647e9
6
+ metadata.gz: 269654a1c4df5ab5cc22df7c775d6dc73fcc8b5ae3741dbce9db41ccb1193f1340020dda06768c97ad695a1f76f9acd2a7dfb8d15c4d6a7af24834ffb12d3968
7
+ data.tar.gz: 9144fefd2b5e212bb916105992459f7e99b4e2248499f9b19b86ce3315e2f65e651af24ca37a976830cfe5ee9e8b8d5d111ed8c24e6f772045fd37a1cff1ed02
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require 'bundler/setup'
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
5
  end
6
6
 
7
7
  require 'rdoc/task'
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
18
 
19
19
  load 'rails/tasks/engine.rake'
20
20
  load 'rails/tasks/statistics.rake'
@@ -31,4 +31,4 @@ desc "Run all specs in spec directory (excluding plugin specs)"
31
31
 
32
32
  RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
33
33
 
34
- task :default => :spec
34
+ task :default => :spec
@@ -11,6 +11,7 @@ end
11
11
  module JiveAddOns
12
12
  class AddOnsController < ApplicationController
13
13
  include Concerns::Controllers::AddOns
14
+ rescue_from ActionController::BadRequest, :with => :failure
14
15
 
15
16
  before_filter :validate_authenticity
16
17
  end
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  JiveAddOns::Engine.routes.draw do
2
- post 'register' => "add_ons#create"
3
- post 'unregister' => "add_ons#destroy"
2
+ post ':add_on_name/register' => "add_ons#create", :as => :register_add_on
3
+ post ':add_on_name/unregister' => "add_ons#destroy", :as => :unregister_add_on
4
4
 
5
5
  mount JiveOsApps::Engine => "/osapps"
6
6
  end
@@ -5,36 +5,38 @@ module JiveAddOns
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  def create
8
- @add_on = JiveAddOns::AddOn.create(register_params)
9
- render :text => @add_on.inspect
8
+ @add_on = JiveAddOns::AddOn.new(register_params)
9
+ @add_on.uninstalled = false
10
+ @add_on.save
11
+
12
+ render :nothing => true, :status => 204
10
13
  end
11
14
 
12
15
  def destroy
13
16
  @add_on = JiveAddOns::AddOn.where(unregister_params).first
17
+ @add_on.update_attributes(:uninstalled => true)
14
18
 
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
19
+ render :nothing => true, :status => 204
22
20
  end
23
21
 
24
22
  protected
25
23
  def validate_authenticity
26
24
  if !::Jive::SignedRequest.validate_registration(json_params)
27
- raise 'Could not validate request'
25
+ raise ActionController::BadRequest
28
26
  end
29
27
  end
30
28
 
29
+ def failure
30
+ render :nothing => true, :status => 403
31
+ end
32
+
31
33
  private
32
34
  def json_params
33
35
  ActionController::Parameters.new(JSON.parse(request.body.read))
34
36
  end
35
37
 
36
38
  def unregister_params
37
- params.tap { |whitelisted|
39
+ json_params.tap { |whitelisted|
38
40
  whitelisted[:tenant_id] = whitelisted[:tenantId]
39
41
  whitelisted[:client_id] = whitelisted[:clientId]
40
42
  whitelisted[:jive_url] = whitelisted[:jiveUrl]
@@ -1,3 +1,3 @@
1
1
  module JiveAddOns
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,4 +1,13 @@
1
- # desc "Explaining what the task does"
2
- # task :jive_add_ons do
3
- # # Task goes here
4
- # end
1
+
2
+ namespace :jive_add_ons do
3
+ # desc "generates add-on zip file"
4
+ task :generate => :environment do
5
+
6
+ # Dir["#{Rails.root}/config/jive_add_ons/*"].each { |file|
7
+ # extn = File.extname file # => ".mp4"
8
+ # name = File.basename file, extn # => "xyz"
9
+ # @config = YAML.load(ERB.new(File.read(file)).result)[Rails.env]
10
+ # puts @config
11
+ # }
12
+ end
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jive_add_ons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
@@ -158,7 +158,6 @@ extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
160
  - MIT-LICENSE
161
- - README.rdoc
162
161
  - Rakefile
163
162
  - app/assets/javascripts/jive_add_ons/application.js
164
163
  - app/assets/stylesheets/jive_add_ons/application.css
@@ -166,7 +165,6 @@ files:
166
165
  - app/controllers/jive_add_ons/application_controller.rb
167
166
  - app/helpers/jive_add_ons/application_helper.rb
168
167
  - app/models/jive_add_ons/add_on.rb
169
- - app/views/jive_add_ons/add_ons/create.erb
170
168
  - app/views/layouts/jive_add_ons/application.html.erb
171
169
  - config/routes.rb
172
170
  - db/migrate/20150718193211_create_jive_add_ons.rb
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = JiveAddOns
2
-
3
- This project rocks and uses MIT-LICENSE.
@@ -1 +0,0 @@
1
- asdfasfasdf