caboose-cms 0.9.94 → 0.9.95

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: df217f87faf8c93c8aa06947ee169d1459902087
4
- data.tar.gz: 870c6ace2742e5f57e80c26581d9b0727ec0b8b0
3
+ metadata.gz: 48d3ccbb53621efe566b03eed61919faeb957615
4
+ data.tar.gz: 54d28c881b9c08d143d9819cd2c04355047f3ee1
5
5
  SHA512:
6
- metadata.gz: 5f01c6c85faa7e8ce92599d7a87f7f0fdacbd8a799614f43a748b848867e57324d1165f8aacef65d642cd40487d58915435a17786948df65fcd5178905b838e9
7
- data.tar.gz: 7e6027f08532f803027cd5e2df55256a1213984e48ec49767d5c3e0feb72f95a648ef6836a7baadb9d2b4a16a07c50df6fe91320606a76bddd2e56ac6595c8b0
6
+ metadata.gz: af02565698684f101906a9f652933b8fd532aa62d6fbf2ff0354ed09a727b26e7b1fd459e615ddad66a535953b12002355b2f4cbc7b760dec4676aa0275771ce
7
+ data.tar.gz: 0a00afaa195d2c0dc383e6de747f5d436dff3ddd7e5b93bcc7f47580861c709b4f6314b02a6e53cfc7f70d01f5675036aa49e9ec0a6afc4967c6db9287bf2bcc
@@ -4,7 +4,7 @@ module Caboose
4
4
  skip_before_filter :verify_authenticity_token
5
5
 
6
6
  # @route GET /admin/sns
7
- def admin_index
7
+ def admin_index
8
8
  render :json => true
9
9
  end
10
10
 
@@ -12,32 +12,33 @@ module Caboose
12
12
  def admin_add
13
13
  body = JSON.parse(request.raw_post, {symbolize_names: true})
14
14
  Caboose.log(body)
15
- if body[:Type] && body[:Type] == "SubscriptionConfirmation"
16
- Caboose.log("SNS Subscription SubscribeURL\n#{body[:SubscribeURL]}")
17
- elsif body[:Subject] == 'Amazon S3 Notification'
18
- msg = JSON.parse(body[:Message])
19
- if msg['Records']
20
- msg['Records'].each do |r|
21
- if r['eventName'] && r['eventName'].starts_with?('ObjectCreated')
22
- if r['s3'] && r['s3']['object'] && r['s3']['object']['key']
23
-
24
- key = URI.decode(r['s3']['object']['key']).gsub('+', ' ')
25
- Caboose.log("Processing #{key}")
26
-
27
- arr = key.split('_')
28
- media_category_id = arr.shift
29
- original_name = arr.join('_')
30
- name = Caboose::Media.upload_name(original_name)
31
-
32
- m = Media.where(:media_category_id => media_category_id, :original_name => original_name, :name => name).first
33
- m = Media.create(:media_category_id => media_category_id, :original_name => original_name, :name => name, :processed => false) if m.nil?
34
- m.delay(:queue => 'caboose_media').process
35
-
36
- end
37
- end
38
- end
15
+ # if body[:Records]
16
+ # records = body[:Records]
17
+ # # if body[:Type] && body[:Type] == "SubscriptionConfirmation"
18
+ # # Caboose.log("SNS Subscription SubscribeURL\n#{body[:SubscribeURL]}")
19
+ # if records['eventSource'] == "aws:s3"
20
+ # msg = JSON.parse(body[:Message])
21
+ # if msg['Records']
22
+ if body && body['Records']
23
+ body['Records'].each do |r|
24
+ if r['eventName'] && r['eventName'].starts_with?('ObjectCreated')
25
+ if r['s3'] && r['s3']['object'] && r['s3']['object']['key']
26
+ key = URI.decode(r['s3']['object']['key']).gsub('+', ' ')
27
+ Caboose.log("Processing #{key}")
28
+ arr = key.split('_')
29
+ media_category_id = arr.shift
30
+ original_name = arr.join('_')
31
+ name = Caboose::Media.upload_name(original_name)
32
+ m = Media.where(:media_category_id => media_category_id, :original_name => original_name, :name => name).first
33
+ m = Media.create(:media_category_id => media_category_id, :original_name => original_name, :name => name, :processed => false) if m.nil?
34
+ m.delay(:queue => 'caboose_media').process
35
+ end
36
+ end
39
37
  end
40
38
  end
39
+ # end
40
+ # end
41
+ # end
41
42
  render :json => true
42
43
  end
43
44
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.94'
2
+ VERSION = '0.9.95'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.94
4
+ version: 0.9.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry