jive_add_ons 0.0.5 → 0.0.6

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: 13e47b87691cc2bc9975e9ba3fad3b9e822eb024
4
- data.tar.gz: f3633fdfa5d727fd44998edbdd447ec874cc6b86
3
+ metadata.gz: 22e591672d206318b86d91a1b206b75a192f8171
4
+ data.tar.gz: 3922a65e5a1f5fbd894f3952373dd377df702358
5
5
  SHA512:
6
- metadata.gz: 54917b006536a38d22c5bef5537bb88610b57b91e2d30f1b98d404a9783787da6336ef99b9d888e7f915c5c9d88b79199b9c97b205dab1e90b802071079a7ad4
7
- data.tar.gz: ec0e569c357adc7dbec7e9a706a506393425c435ff2dc9661a3fd18202b06c74daa2009ee02f849c7f7d64da7196a68ce9d7d136c0575717a132bc4c1957ffa5
6
+ metadata.gz: 11f814ea8b47b956afb5cac7c97bd53d6ed5841692e818ef83d82e64f47dcab49eeb9aab6db6f98aeeb3d887335a181851a724bbc665cd068aba5d04a6e1dc1f
7
+ data.tar.gz: e72de89f2a879345812386e0407e52b3fda73b45aebd54139a493808f9b6a8acd94478393415dd94d993433d65a0622aea77895b7a8446ab3e219827c601f896
@@ -11,10 +11,8 @@ end
11
11
  module JiveAddOns
12
12
  class AddOnsController < ApplicationController
13
13
  include Concerns::Controllers::AddOns
14
- rescue_from ActionController::BadRequest, :with => :failure_403
15
14
  rescue_from ActionController::UnknownController, :with => :failure_404
16
15
 
17
- before_filter :validate_authenticity
18
16
  before_filter :validate_add_on_name
19
17
  end
20
18
  end
@@ -1,5 +1,5 @@
1
- class CreateJiveAddOns < ActiveRecord::Migration
2
- def change
1
+ class AddJiveAddOns010Migration < ActiveRecord::Migration
2
+ def self.up
3
3
  create_table :jive_add_ons do |t|
4
4
  t.string :name
5
5
  t.string :tenant_id
@@ -8,10 +8,15 @@ class CreateJiveAddOns < ActiveRecord::Migration
8
8
  t.string :jive_signature
9
9
  t.string :jive_signature_url
10
10
  t.string :jive_url
11
+ t.string :timestamp
11
12
  t.boolean :uninstalled
12
13
  t.integer :attempt
13
14
 
14
15
  t.timestamps null: false
15
16
  end
16
17
  end
17
- end
18
+
19
+ def self.down
20
+ drop_table :jive_add_ons
21
+ end
22
+ end
@@ -5,19 +5,22 @@ module JiveAddOns
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  def create
8
- @add_on = JiveAddOns::AddOn.new(register_params)
8
+ @add_on = Jive::AddOn::Model.new(register_params)
9
9
  @add_on.name = params[:name]
10
10
  @add_on.uninstalled = false
11
- @add_on.save
12
11
 
13
- render :nothing => true, :status => 204
12
+ render :nothing => true, :status => ((@add_on.save)? 204 : 403)
14
13
  end
15
14
 
16
15
  def destroy
17
- @add_on = JiveAddOns::AddOn.where(unregister_params).first
18
- @add_on.update_attributes(:uninstalled => true)
16
+ status = 403
19
17
 
20
- render :nothing => true, :status => 204
18
+ @add_on = Jive::AddOn::Model.where(unregister_params).first
19
+ if @add_on && @add_on.update_attributes(:uninstalled => true)
20
+ status = 204
21
+ end
22
+
23
+ render :nothing => true, :status => status
21
24
  end
22
25
 
23
26
  protected
@@ -32,20 +35,10 @@ module JiveAddOns
32
35
  end
33
36
  end
34
37
 
35
- def validate_authenticity
36
- if !::Jive::SignedRequest.validate_registration(json_params)
37
- raise ActionController::BadRequest
38
- end
39
- end
40
-
41
38
  def failure_404
42
39
  render :nothing => true, :status => 404
43
40
  end
44
41
 
45
- def failure_403
46
- render :nothing => true, :status => 403
47
- end
48
-
49
42
  private
50
43
  def json_params
51
44
  ActionController::Parameters.new(JSON.parse(request.body.read))
@@ -73,13 +66,15 @@ module JiveAddOns
73
66
  whitelisted[:jive_url] = whitelisted[:jiveUrl]
74
67
  whitelisted[:jive_signature] = whitelisted[:jiveSignature]
75
68
  whitelisted[:jive_signature_url] = whitelisted[:jiveSignatureURL]
69
+ whitelisted[:timestamp] = whitelisted[:timestamp]
76
70
  }.permit(
77
71
  :tenant_id,
78
72
  :client_id,
79
73
  :client_secret,
80
74
  :jive_url,
81
75
  :jive_signature,
82
- :jive_signature_url
76
+ :jive_signature_url,
77
+ :timestamp
83
78
  )
84
79
  end
85
80
  end
@@ -1,3 +1,3 @@
1
1
  module JiveAddOns
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/jive_add_ons.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "jive/signed_request"
1
+ require "jive/add_on"
2
2
  require "jive_add_ons/engine"
3
3
  require "jive_add_ons/concerns/controllers/add_ons"
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jive_add_ons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: jive-signed_request
28
+ name: jive-add_on
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -122,10 +122,9 @@ files:
122
122
  - app/controllers/jive_add_ons/add_ons_controller.rb
123
123
  - app/controllers/jive_add_ons/application_controller.rb
124
124
  - app/helpers/jive_add_ons/application_helper.rb
125
- - app/models/jive_add_ons/add_on.rb
126
125
  - app/views/layouts/jive_add_ons/application.html.erb
127
126
  - config/routes.rb
128
- - db/migrate/20150718193211_create_jive_add_ons.rb
127
+ - db/migrate/20160102045039_add_jive_add_ons_0_1_0_migration.rb
129
128
  - lib/jive_add_ons.rb
130
129
  - lib/jive_add_ons/concerns/controllers/add_ons.rb
131
130
  - lib/jive_add_ons/engine.rb
@@ -1,5 +0,0 @@
1
- module JiveAddOns
2
- class AddOn < ActiveRecord::Base
3
- self.table_name = "jive_add_ons"
4
- end
5
- end