mumuki-bibliotheca 6.2.0 → 6.2.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
  SHA256:
3
- metadata.gz: c3452b76785a90e339640007046881e3809e48c6ce158eee40eeb65b6752d41d
4
- data.tar.gz: de7f3eaaec9d4a7374b092bd8e96d23b4b71f36806aa1d45f6d64bd5bb1a0882
3
+ metadata.gz: c49be8ab2a2941f9bb2c48cd13eff5da71860392c15991f358ce89ec488cdee0
4
+ data.tar.gz: 54660a3c891a128a9284c32e38521c468a2bd3fda037dcaeef83c65c0626baad
5
5
  SHA512:
6
- metadata.gz: 9dd4c6cc8910b5fb34a7ff19f2895d7b6d8f27c6ae35a50759fbc151a8566e57edc172fdfbb1f3e81ccba893561f81bc2dcba7d4b5d4210539f07daede005ff0
7
- data.tar.gz: dcbda9975fa69aaaed8c335655976736bd29f92fcee7fcf73518832a8b72158fc891ef6140f59c041096bd602ebee694058cd100bc5ec9d9f409c7226b4482ad
6
+ metadata.gz: 74d17df501da0253d8b8cf23af42ab6c36971b8ddac92b955ad20f6c18d4dc50b5a0b1f9999a0247b7053960c48d63b4ddfff770884bcc33375e86e84cde89cd
7
+ data.tar.gz: b8e8d51b6139d6a7cf0e1fd541d64a8d7ea3f9c81974c98a5104bede941d1f0a82b5a46a2fdc62ad3d81d4af2335be0c704dc8d71d82094463f8bfd5311c635c
data/lib/events.rb CHANGED
@@ -4,7 +4,7 @@ Mumukit::Nuntius::EventConsumer.handle do
4
4
  # * new logins in classroom
5
5
  # * user creation and modification in laboratory
6
6
  # * user creation and modification in classroom
7
- event :UserChanged do |data|
7
+ event :UserChanged do |payload|
8
8
  User.import_from_resource_h! payload.deep_symbolize_keys[:user]
9
9
  end
10
10
 
@@ -8,6 +8,16 @@ require 'mumukit/login'
8
8
  require 'mumukit/nuntius'
9
9
  require 'mumukit/platform'
10
10
 
11
+ module Mumukit::Nuntius
12
+ def self.notify_content_change_event!(content_kind, slug)
13
+ notify_event! content_change_event_name(content_kind), slug: slug.to_s
14
+ end
15
+
16
+ def self.content_change_event_name(content_kind)
17
+ "#{content_kind.to_s.camelize}Changed"
18
+ end
19
+ end
20
+
11
21
  Mumukit::Nuntius.configure do |c|
12
22
  c.app_name = 'bibliotheca'
13
23
  end
@@ -131,6 +131,13 @@ HTML
131
131
  Mumuki::Bibliotheca.api_syncer(json_body)
132
132
  end
133
133
 
134
+ def upsert_and_notify!(content_kind)
135
+ resource_h = upsert! content_kind
136
+
137
+ Mumukit::Nuntius.notify_content_change_event! content_kind, slug.to_s
138
+ resource_h
139
+ end
140
+
134
141
  def upsert!(content_kind)
135
142
  authorize! :writer
136
143
  content = api_syncer.locate_and_import! content_kind, slug.to_s
@@ -18,7 +18,7 @@ class Mumuki::Bibliotheca::App < Sinatra::Application
18
18
  end
19
19
 
20
20
  post '/books' do
21
- upsert! :book
21
+ upsert_and_notify! :book
22
22
  end
23
23
 
24
24
  post '/book/:organization/:repository/fork' do
@@ -30,7 +30,7 @@ class Mumuki::Bibliotheca::App < Sinatra::Application
30
30
  end
31
31
 
32
32
  post '/guides' do
33
- upsert! :guide
33
+ upsert_and_notify! :guide
34
34
  end
35
35
 
36
36
  post '/guides/import/:organization/:repository' do
@@ -18,7 +18,7 @@ class Mumuki::Bibliotheca::App < Sinatra::Application
18
18
  end
19
19
 
20
20
  post '/topics' do
21
- upsert! :topic
21
+ upsert_and_notify! :topic
22
22
  end
23
23
 
24
24
  post '/book/:organization/:repository/fork' do
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Bibliotheca
3
- VERSION = '6.2.0'
3
+ VERSION = '6.2.2'
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  logger = Mumukit::Nuntius::Logger
2
2
  namespace :events do
3
- task :listen do
3
+ task listen: :environment do
4
4
  logger.info 'Loading event handlers....'
5
5
  require_relative '../events'
6
6
  logger.info "Loaded handlers #{Mumukit::Nuntius::EventConsumer.handled_events}!"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-bibliotheca
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2018-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 6.2.0
75
+ version: 6.2.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 6.2.0
82
+ version: 6.2.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mumukit-login
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.0.0
196
+ rubygems_version: 3.0.1
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: API for editing content on mumuki