enju_message 0.1.14.pre9 → 0.1.14.pre10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/message_request.rb +4 -4
  3. data/lib/enju_message/version.rb +1 -1
  4. data/spec/dummy/app/models/user.rb +4 -37
  5. data/spec/dummy/db/migrate/001_create_patrons.rb +1 -10
  6. data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
  7. data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
  8. data/spec/dummy/db/migrate/{20111201163342_create_user_groups.rb → 077_create_user_groups.rb} +2 -2
  9. data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -9
  10. data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
  11. data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
  12. data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
  13. data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
  14. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
  15. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
  16. data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
  17. data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
  18. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
  19. data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
  20. data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +11 -0
  21. data/spec/dummy/db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +11 -0
  22. data/spec/dummy/db/migrate/20111201155456_devise_create_users.rb +46 -0
  23. data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
  24. data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
  25. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
  26. data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
  27. data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
  28. data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
  29. data/spec/dummy/db/schema.rb +202 -27
  30. data/spec/dummy/db/test.sqlite3 +0 -0
  31. data/spec/dummy/solr/data/test/index/{_6n.fdt → _93.fdt} +0 -0
  32. data/spec/dummy/solr/data/test/index/{_6n.fdx → _93.fdx} +0 -0
  33. data/spec/dummy/solr/data/test/index/{_6n.fnm → _93.fnm} +0 -0
  34. data/spec/dummy/solr/data/test/index/{_6n.frq → _93.frq} +0 -0
  35. data/spec/dummy/solr/data/test/index/{_6n.nrm → _93.nrm} +0 -0
  36. data/spec/dummy/solr/data/test/index/{_6n.prx → _93.prx} +0 -0
  37. data/spec/dummy/solr/data/test/index/{_6n.tii → _93.tii} +0 -0
  38. data/spec/dummy/solr/data/test/index/{_6n.tis → _93.tis} +0 -0
  39. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  40. data/spec/dummy/solr/data/test/index/segments_i1 +0 -0
  41. data/spec/factories/library.rb +13 -0
  42. data/spec/factories/user.rb +34 -9
  43. data/spec/fixtures/libraries.yml +102 -0
  44. data/spec/fixtures/library_groups.yml +20 -20
  45. metadata +71 -47
  46. data/spec/dummy/app/models/library_group.rb +0 -86
  47. data/spec/dummy/app/models/patron.rb +0 -167
  48. data/spec/dummy/app/models/patron_type.rb +0 -19
  49. data/spec/dummy/app/models/role.rb +0 -8
  50. data/spec/dummy/app/models/user_group.rb +0 -2
  51. data/spec/dummy/app/models/user_has_role.rb +0 -4
  52. data/spec/dummy/db/development.sqlite3 +0 -0
  53. data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +0 -9
  54. data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -14
  55. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +0 -52
  56. data/spec/dummy/db/migrate/20120213092115_add_queue_to_delayed_jobs.rb +0 -9
  57. data/spec/dummy/solr/data/test/index/segments_dd +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02a1cae4b9213d73460fd217952044bd0927e09b
4
- data.tar.gz: 9110f24a1c7d924470b0d85817db0b62e9410130
3
+ metadata.gz: 10a4be314ce274452de8e18e40ec20a5774da96a
4
+ data.tar.gz: 9e8071d4fe863f3482f72157894b696d8dc149c0
5
5
  SHA512:
6
- metadata.gz: 42e043db562178f4282666cecdf736f00dce2ebb6d68e85fb86d6755d9f4ebc1a6ce1ec4a966d9fe13418641fdf39db37aaec3690183545c6ef91169e45e1e84
7
- data.tar.gz: eb19ba49de1db2575a5f1677bf3cdfa31bb264b7156190b236943e55d66c650e01a79c90e2096bdd261fd3917c23feacd005c0d5238a13b91abe8edf8b307427
6
+ metadata.gz: b450fcb44ad5062b5771765e5359f703420045289b005a65c9ee885c199e6ec287f449598cb1c70de9ba6b05fc803caa8ff523c237b7470c4ccab8b9eef8f2c4
7
+ data.tar.gz: baac98bb78f2187a7e381936e87f51d69d62917dbae7417fb87967fcc4dff41494228de34cc5ec82e2f7f1a8850938864776d5816b3ab77211ba085c8122e7bc
@@ -48,7 +48,7 @@ class MessageRequest < ActiveRecord::Base
48
48
  end
49
49
  self.sent_at = Time.zone.now
50
50
  save(:validate => false)
51
- if ['reservation_expired_for_patron', 'reservation_expired_for_patron'].include?(self.message_template.status)
51
+ if ['reservation_expired_for_patron', 'reservation_expired_for_patron'].include?(message_template.status)
52
52
  self.receiver.reserves.each do |reserve|
53
53
  reserve.expiration_notice_to_patron = true
54
54
  reserve.save(:validate => false)
@@ -64,10 +64,10 @@ class MessageRequest < ActiveRecord::Base
64
64
 
65
65
  def save_message_body(options = {})
66
66
  options = {
67
- :receiver => self.receiver,
68
- :locale => self.receiver.locale
67
+ :receiver => receiver,
68
+ :locale => receiver.locale
69
69
  }.merge(options)
70
- self.update_attributes!({:body => self.message_template.embed_body(options)})
70
+ self.update_attributes!({:body => message_template.embed_body(options)})
71
71
  end
72
72
 
73
73
  def self.send_messages
@@ -1,3 +1,3 @@
1
1
  module EnjuMessage
2
- VERSION = "0.1.14.pre9"
2
+ VERSION = "0.1.14.pre10"
3
3
  end
@@ -1,46 +1,13 @@
1
1
  class User < ActiveRecord::Base
2
2
  # Include default devise modules. Others available are:
3
3
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
- devise :database_authenticatable, :registerable,
5
- :recoverable, :rememberable, :trackable, :validatable
4
+ devise :database_authenticatable, #:registerable,
5
+ :recoverable, :rememberable, :trackable, #:validatable,
6
+ :lockable, :lock_strategy => :none, :unlock_strategy => :none
6
7
 
7
8
  # Setup accessible (or protected) attributes for your model
8
9
  attr_accessible :email, :password, :password_confirmation, :remember_me
9
10
 
10
- has_one :user_has_role
11
- has_one :role, :through => :user_has_role
12
- has_one :patron
13
- belongs_to :user_group
14
- belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
15
- before_create :set_role_and_patron
16
-
11
+ enju_leaf_user_model
17
12
  enju_message_user_model
18
-
19
- extend FriendlyId
20
- friendly_id :username
21
-
22
- def set_role_and_patron
23
- self.required_role = Role.where(:name => 'Librarian').first
24
- self.locale = I18n.default_locale.to_s
25
- unless self.patron
26
- self.patron = Patron.create(:full_name => self.username) if self.username
27
- end
28
- end
29
-
30
- def has_role?(role_in_question)
31
- return false unless role
32
- return true if role.name == role_in_question
33
- case role.name
34
- when 'Administrator'
35
- return true
36
- when 'Librarian'
37
- return true if role_in_question == 'User'
38
- else
39
- false
40
- end
41
- end
42
-
43
- def full_name
44
- username
45
- end
46
13
  end
@@ -1,5 +1,5 @@
1
1
  class CreatePatrons < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :patrons do |t|
4
4
  t.integer :user_id
5
5
  t.string :last_name
@@ -38,11 +38,6 @@ class CreatePatrons < ActiveRecord::Migration
38
38
  t.integer :patron_type_id, :default => 1, :null => false
39
39
  t.integer :lock_version, :default => 0, :null => false
40
40
  t.text :note
41
- t.integer :creates_count, :default => 0, :null => false
42
- t.integer :realizes_count, :default => 0, :null => false
43
- t.integer :produces_count, :default => 0, :null => false
44
- t.integer :owns_count, :default => 0, :null => false
45
- #t.integer :resource_has_subjects_count, :default => 0, :null => false
46
41
  t.integer :required_role_id, :default => 1, :null => false
47
42
  t.integer :required_score, :default => 0, :null => false
48
43
  t.string :state
@@ -55,8 +50,4 @@ class CreatePatrons < ActiveRecord::Migration
55
50
  add_index :patrons, :required_role_id
56
51
  add_index :patrons, :full_name
57
52
  end
58
-
59
- def self.down
60
- drop_table :patrons
61
- end
62
53
  end
@@ -0,0 +1,28 @@
1
+ class CreateLibraries < ActiveRecord::Migration
2
+ def change
3
+ create_table :libraries do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :short_display_name, :null => false
7
+ t.string :zip_code
8
+ t.text :street
9
+ t.text :locality
10
+ t.text :region
11
+ t.string :telephone_number_1
12
+ t.string :telephone_number_2
13
+ t.string :fax_number
14
+ t.text :note
15
+ t.integer :call_number_rows, :default => 1, :null => false
16
+ t.string :call_number_delimiter, :default => "|", :null => false
17
+ t.integer :library_group_id, :default => 1, :null => false
18
+ t.integer :users_count, :default => 0, :null => false
19
+ t.integer :position
20
+ t.integer :country_id
21
+
22
+ t.timestamps
23
+ t.datetime :deleted_at
24
+ end
25
+ add_index :libraries, :library_group_id
26
+ add_index :libraries, :name, :unique => true
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ class CreateShelves < ActiveRecord::Migration
2
+ def change
3
+ create_table :shelves do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :library_id, :default => 1, :null => false
8
+ t.integer :items_count, :default => 0, :null => false
9
+ t.integer :position
10
+ t.timestamps
11
+ t.datetime :deleted_at
12
+ end
13
+ add_index :shelves, :library_id
14
+ end
15
+ end
@@ -1,12 +1,12 @@
1
1
  class CreateUserGroups < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :user_groups do |t|
4
- t.string :name
4
+ t.string :name, :not_null => true
5
5
  t.text :display_name
6
6
  t.text :note
7
7
  t.integer :position
8
-
9
8
  t.timestamps
9
+ t.datetime :deleted_at
10
10
  end
11
11
  end
12
12
  end
@@ -1,25 +1,18 @@
1
1
  class CreateLibraryGroups < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :library_groups do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
6
6
  t.string :short_name, :null => false
7
7
  t.string :email
8
8
  t.text :my_networks
9
- t.boolean :use_dsbl, :default => false, :null => false
10
- t.text :dsbl_list
11
9
  t.text :login_banner
12
10
  t.text :note
13
- t.integer :valid_period_for_new_user, :default => 365, :null => false
14
- t.boolean :post_to_union_catalog, :default => false, :null => false
15
11
  t.integer :country_id
12
+ t.integer :position
16
13
 
17
14
  t.timestamps
18
15
  end
19
16
  add_index :library_groups, :short_name
20
17
  end
21
-
22
- def self.down
23
- drop_table :library_groups
24
- end
25
18
  end
@@ -0,0 +1,12 @@
1
+ class CreateBaskets < ActiveRecord::Migration
2
+ def change
3
+ create_table :baskets do |t|
4
+ t.integer :user_id
5
+ t.text :note
6
+ t.integer :lock_version, :default => 0, :null => false
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :baskets, :user_id
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ class CreateBookstores < ActiveRecord::Migration
2
+ def change
3
+ create_table :bookstores do |t|
4
+ t.text :name, :null => false
5
+ t.string :zip_code
6
+ t.text :address
7
+ t.text :note
8
+ t.string :telephone_number
9
+ t.string :fax_number
10
+ t.string :url
11
+ t.integer :position
12
+ t.datetime :deleted_at
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRequestStatusTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :request_status_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRequestTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :request_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ class CreateSubscriptions < ActiveRecord::Migration
2
+ def change
3
+ create_table :subscriptions do |t|
4
+ t.text :title, :null => false
5
+ t.text :note
6
+ #t.integer :subscription_list_id, :integer
7
+ t.integer :user_id
8
+ t.integer :order_list_id
9
+ t.datetime :deleted_at
10
+ t.integer :subscribes_count, :default => 0, :null => false
11
+
12
+ t.timestamps
13
+ end
14
+ add_index :subscriptions, :user_id
15
+ add_index :subscriptions, :order_list_id
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ class CreateSubscribes < ActiveRecord::Migration
2
+ def change
3
+ create_table :subscribes do |t|
4
+ t.integer :subscription_id, :null => false
5
+ t.integer :work_id, :null => false
6
+ t.datetime :start_at, :null => false
7
+ t.datetime :end_at, :null => false
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :subscribes, :subscription_id
12
+ add_index :subscribes, :work_id
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ class CreateSearchEngines < ActiveRecord::Migration
2
+ def change
3
+ create_table :search_engines do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :url, :null => false
7
+ t.text :base_url, :null => false
8
+ t.text :http_method, :null => false
9
+ t.text :query_param, :null => false
10
+ t.text :additional_param
11
+ t.text :note
12
+ t.integer :position
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ class CreateCountries < ActiveRecord::Migration
2
+
3
+ # ISO 3166 is the International Standard for country codes.
4
+ #
5
+ # ISO 3166-1:2006 Codes for the representation of names of countries and their subdivisions - Part 1:
6
+ # Country codes which is what most users know as ISO's country codes. First published in 1974, it is has since
7
+ # then become one of the world's most popular and most widely used standard solution for coding country names.
8
+ # It contains a two-letter code which is recommended as the general purpose code, a three-letter code which has
9
+ # better mnenomic properties and a numeric-3 code which can be useful if script independence of the codes is important.
10
+ #
11
+ # http://www.iso.org/iso/country_codes/background_on_iso_3166/what_is_iso_3166.htm
12
+
13
+ def change
14
+ create_table :countries do |t|
15
+ t.string :name, :size => 80, :null => false
16
+ t.text :display_name
17
+ t.string :alpha_2, :size => 2
18
+ t.string :alpha_3, :size => 3
19
+ t.string :numeric_3, :size => 3
20
+ t.text :note
21
+ t.integer :position
22
+ end
23
+ add_index :countries, :name
24
+ add_index :countries, :alpha_2
25
+ add_index :countries, :alpha_3
26
+ add_index :countries, :numeric_3
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ class CreateVersions < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :versions do |t|
4
+ t.string :item_type, :null => false
5
+ t.integer :item_id, :null => false
6
+ t.string :event, :null => false
7
+ t.string :whodunnit
8
+ t.text :object
9
+ t.datetime :created_at
10
+ end
11
+ add_index :versions, [:item_type, :item_id]
12
+ end
13
+
14
+ def self.down
15
+ remove_index :versions, [:item_type, :item_id]
16
+ drop_table :versions
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ class AddOpeningHourToLibrary < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :libraries, :opening_hour, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :libraries, :opening_hour
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class AddBirthDateAndDeathDateToPatron < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :patrons, :birth_date, :string
4
+ add_column :patrons, :death_date, :string
5
+ end
6
+
7
+ def self.down
8
+ remove_column :patrons, :death_date
9
+ remove_column :patrons, :birth_date
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class AddValidPeriodForNewUserToUserGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :user_groups, :valid_period_for_new_user, :integer, :default => 0, :null => false
4
+ add_column :user_groups, :expired_at, :timestamp
5
+ end
6
+
7
+ def self.down
8
+ remove_column :user_groups, :valid_period_for_new_user
9
+ remove_column :user_groups, :expired_at
10
+ end
11
+ end
@@ -0,0 +1,46 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => false, :default => ""
6
+ t.string :encrypted_password, :null => false, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, :default => 0
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+ ## Token authenticatable
34
+ # t.string :authentication_token
35
+
36
+
37
+ t.timestamps
38
+ end
39
+
40
+ add_index :users, :email, :unique => true
41
+ add_index :users, :reset_password_token, :unique => true
42
+ # add_index :users, :confirmation_token, :unique => true
43
+ # add_index :users, :unlock_token, :unique => true
44
+ # add_index :users, :authentication_token, :unique => true
45
+ end
46
+ end
@@ -0,0 +1,5 @@
1
+ class AddIsilToLibrary < ActiveRecord::Migration
2
+ def change
3
+ add_column :libraries, :isil, :string
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBudgetTypes < ActiveRecord::Migration
2
+ def change
3
+ create_table :budget_types do |t|
4
+ t.string :name
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class CreateAccepts < ActiveRecord::Migration
2
+ def change
3
+ create_table :accepts do |t|
4
+ t.integer :basket_id
5
+ t.integer :item_id
6
+ t.integer :librarian_id
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :accepts, :basket_id
12
+ add_index :accepts, :item_id
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddClosedToShelf < ActiveRecord::Migration
2
+ def change
3
+ add_column :shelves, :closed, :boolean, :default => false, :null => false
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ class AddAdditionalAttributesToUser < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :username, :string
4
+ add_column :users, :user_number, :string
5
+ add_column :users, :state, :string
6
+ add_column :users, :locale, :string
7
+ add_column :users, :deleted_at, :datetime
8
+ add_column :users, :expired_at, :datetime
9
+ add_column :users, :library_id, :integer, :default => 1, :null => false
10
+ add_column :users, :required_role_id, :integer, :default => 1, :null => false
11
+ add_column :users, :user_group_id, :integer, :default => 1, :null => false
12
+ add_column :users, :note, :text
13
+ add_column :users, :keyword_list, :text
14
+
15
+ add_column :users, :failed_attempts, :integer
16
+ add_column :users, :unlock_token, :string
17
+ add_column :users, :locked_at, :datetime
18
+
19
+ add_column :users, :confirmed_at, :datetime
20
+
21
+ add_index :users, :username, :unique => true
22
+ add_index :users, :user_group_id
23
+ add_index :users, :user_number, :unique => true
24
+ add_index :users, :unlock_token, :unique => true
25
+ end
26
+ end
@@ -0,0 +1,6 @@
1
+ class AddLatitudeAndLongitudeToLibrary < ActiveRecord::Migration
2
+ def change
3
+ add_column :libraries, :latitude, :float
4
+ add_column :libraries, :longitude, :float
5
+ end
6
+ end