sinatra_resource 0.4.21 → 0.4.22
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +18 -0
- data/Gemfile.lock +51 -0
- data/README.mdown +1 -1
- data/VERSION +1 -1
- data/examples/datacatalog/.bundle/config +2 -0
- data/examples/datacatalog/Gemfile +14 -0
- data/examples/datacatalog/Gemfile.lock +33 -0
- data/examples/datacatalog/Rakefile +2 -2
- data/examples/datacatalog/app.rb +0 -2
- data/examples/datacatalog/config/config.rb +5 -7
- data/examples/datacatalog/lib/base.rb +2 -2
- data/examples/datacatalog/lib/resource.rb +5 -5
- data/examples/datacatalog/lib/roles.rb +2 -2
- data/examples/datacatalog/model_helpers/search.rb +6 -6
- data/examples/datacatalog/models/categorization.rb +1 -1
- data/examples/datacatalog/models/note.rb +1 -1
- data/examples/datacatalog/models/source.rb +3 -3
- data/examples/datacatalog/models/usage.rb +2 -2
- data/examples/datacatalog/models/user.rb +7 -7
- data/examples/datacatalog/resources/categories.rb +7 -7
- data/examples/datacatalog/resources/categories_sources.rb +4 -4
- data/examples/datacatalog/resources/notes.rb +1 -1
- data/examples/datacatalog/resources/sources.rb +3 -3
- data/examples/datacatalog/resources/sources_usages.rb +3 -3
- data/examples/datacatalog/resources/users.rb +3 -3
- data/examples/datacatalog/tasks/db.rake +2 -2
- data/examples/datacatalog/tasks/test.rake +1 -1
- data/examples/datacatalog/test/helpers/assertions/assert_include.rb +1 -1
- data/examples/datacatalog/test/helpers/assertions/assert_not_include.rb +1 -1
- data/examples/datacatalog/test/helpers/lib/model_factories.rb +7 -7
- data/examples/datacatalog/test/helpers/lib/model_helpers.rb +1 -1
- data/examples/datacatalog/test/helpers/lib/request_helpers.rb +7 -7
- data/examples/datacatalog/test/helpers/resource_test_helper.rb +1 -1
- data/examples/datacatalog/test/helpers/shared/api_keys.rb +11 -11
- data/examples/datacatalog/test/helpers/shared/common_body_responses.rb +1 -1
- data/examples/datacatalog/test/helpers/shared/model_counts.rb +2 -2
- data/examples/datacatalog/test/helpers/shared/status_codes.rb +4 -4
- data/examples/datacatalog/test/helpers/test_cases/resource_test_case.rb +4 -4
- data/examples/datacatalog/test/helpers/test_helper.rb +4 -10
- data/examples/datacatalog/test/models/categorization_test.rb +6 -6
- data/examples/datacatalog/test/models/category_test.rb +8 -8
- data/examples/datacatalog/test/models/note_test.rb +6 -6
- data/examples/datacatalog/test/models/search_test.rb +4 -4
- data/examples/datacatalog/test/models/source_test.rb +5 -5
- data/examples/datacatalog/test/models/user_test.rb +11 -11
- data/examples/datacatalog/test/resources/categories/categories_delete_test.rb +12 -12
- data/examples/datacatalog/test/resources/categories/categories_get_many_test.rb +9 -9
- data/examples/datacatalog/test/resources/categories/categories_get_one_test.rb +7 -7
- data/examples/datacatalog/test/resources/categories/categories_post_test.rb +16 -16
- data/examples/datacatalog/test/resources/categories/categories_put_test.rb +17 -17
- data/examples/datacatalog/test/resources/categories_sources/categories_sources_delete_test.rb +25 -25
- data/examples/datacatalog/test/resources/categories_sources/categories_sources_get_many_test.rb +5 -5
- data/examples/datacatalog/test/resources/categories_sources/categories_sources_get_one_test.rb +15 -15
- data/examples/datacatalog/test/resources/categories_sources/categories_sources_post_test.rb +31 -31
- data/examples/datacatalog/test/resources/categories_sources/categories_sources_put_test.rb +41 -41
- data/examples/datacatalog/test/resources/notes/notes_get_many_test.rb +15 -15
- data/examples/datacatalog/test/resources/notes/notes_get_one_test.rb +7 -7
- data/examples/datacatalog/test/resources/notes/notes_post_test.rb +12 -12
- data/examples/datacatalog/test/resources/sources/sources_delete_test.rb +12 -12
- data/examples/datacatalog/test/resources/sources/sources_get_many_search_test.rb +20 -20
- data/examples/datacatalog/test/resources/sources/sources_get_many_test.rb +8 -8
- data/examples/datacatalog/test/resources/sources/sources_get_one_test.rb +17 -9
- data/examples/datacatalog/test/resources/sources/sources_post_test.rb +13 -13
- data/examples/datacatalog/test/resources/sources/sources_put_test.rb +30 -30
- data/examples/datacatalog/test/resources/sources_usages/sources_usages_delete_test.rb +24 -24
- data/examples/datacatalog/test/resources/sources_usages/sources_usages_get_many_filter_test.rb +9 -9
- data/examples/datacatalog/test/resources/sources_usages/sources_usages_get_many_test.rb +9 -9
- data/examples/datacatalog/test/resources/sources_usages/sources_usages_get_one_test.rb +15 -15
- data/examples/datacatalog/test/resources/sources_usages/sources_usages_post_test.rb +16 -16
- data/examples/datacatalog/test/resources/sources_usages/sources_usages_put_test.rb +33 -33
- data/examples/datacatalog/test/resources/users/users_delete_test.rb +21 -21
- data/examples/datacatalog/test/resources/users/users_get_many_test.rb +16 -16
- data/examples/datacatalog/test/resources/users/users_get_one_test.rb +8 -8
- data/examples/datacatalog/test/resources/users/users_post_test.rb +13 -13
- data/examples/datacatalog/test/resources/users/users_put_test.rb +18 -18
- data/lib/builder/action_definitions.rb +8 -8
- data/lib/builder/helpers.rb +10 -12
- data/lib/builder/mongo_helpers.rb +13 -14
- data/lib/builder.rb +10 -10
- data/lib/exceptions.rb +1 -1
- data/lib/resource.rb +20 -20
- data/lib/roles.rb +2 -2
- data/lib/utility.rb +2 -2
- data/notes/permissions.mdown +6 -6
- data/sinatra_resource.gemspec +9 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/utility_spec.rb +2 -2
- metadata +30 -4
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gem 'query_string_filter', '>= 0.1.4'
|
4
|
+
|
5
|
+
gem 'activesupport', '~> 2.3.8'
|
6
|
+
gem 'frequency', '>= 0.1.2', '< 0.2.0'
|
7
|
+
gem 'kronos', '>= 0.1.6'
|
8
|
+
gem 'mongo_mapper', '= 0.8.4'
|
9
|
+
gem 'sinatra', '>= 1.0'
|
10
|
+
gem 'sinatra_resource', '>= 0.4.21', '< 0.5'
|
11
|
+
|
12
|
+
group :test do
|
13
|
+
gem 'crack', '>= 0.1.4'
|
14
|
+
gem 'pending', '>= 0.1.1'
|
15
|
+
gem 'rr', '>= 0.10.11'
|
16
|
+
gem 'timecop', '>= 0.3.5'
|
17
|
+
gem 'tu-context', '>= 0.5.8'
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (2.3.8)
|
5
|
+
bson (1.0.4)
|
6
|
+
crack (0.1.8)
|
7
|
+
frequency (0.1.5)
|
8
|
+
jnunemaker-validatable (1.8.4)
|
9
|
+
activesupport (>= 2.3.4)
|
10
|
+
kronos (0.1.7)
|
11
|
+
mongo (1.0.7)
|
12
|
+
bson (>= 1.0.4)
|
13
|
+
mongo_mapper (0.8.2)
|
14
|
+
activesupport (>= 2.3.4)
|
15
|
+
jnunemaker-validatable (~> 1.8.4)
|
16
|
+
plucky (~> 0.3.1)
|
17
|
+
pending (0.1.1)
|
18
|
+
plucky (0.3.4)
|
19
|
+
mongo (~> 1.0.7)
|
20
|
+
polyglot (0.3.1)
|
21
|
+
query_string_filter (0.1.6)
|
22
|
+
treetop (>= 1.4.2)
|
23
|
+
rack (1.2.1)
|
24
|
+
rr (0.10.11)
|
25
|
+
sinatra (1.0)
|
26
|
+
rack (>= 1.0)
|
27
|
+
sinatra_resource (0.4.21)
|
28
|
+
mongo_mapper (= 0.8.2)
|
29
|
+
query_string_filter (>= 0.1.4)
|
30
|
+
sinatra (>= 1.0)
|
31
|
+
timecop (0.3.5)
|
32
|
+
treetop (1.4.8)
|
33
|
+
polyglot (>= 0.3.1)
|
34
|
+
tu-context (0.5.8)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
activesupport (~> 2.3.8)
|
41
|
+
crack (>= 0.1.4)
|
42
|
+
frequency (>= 0.1.2, < 0.2.0)
|
43
|
+
kronos (>= 0.1.6)
|
44
|
+
mongo_mapper (= 0.8.2)
|
45
|
+
pending (>= 0.1.1)
|
46
|
+
query_string_filter (>= 0.1.4)
|
47
|
+
rr (>= 0.10.11)
|
48
|
+
sinatra (>= 1.0)
|
49
|
+
sinatra_resource (>= 0.4.21, < 0.5)
|
50
|
+
timecop (>= 0.3.5)
|
51
|
+
tu-context (>= 0.5.8)
|
data/README.mdown
CHANGED
@@ -16,7 +16,7 @@ You will need gemcutter if you don't have it already:
|
|
16
16
|
I recommend a user-level install:
|
17
17
|
|
18
18
|
gem install resource_sinatra
|
19
|
-
|
19
|
+
|
20
20
|
Note: in general, beware of `sudo gem install <project_name>` -- it gives elevated privileges. Do you trust `<project name>`? Better to be safe and use a local install to `~/.gem`.
|
21
21
|
|
22
22
|
## Usage
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.22
|
@@ -0,0 +1,33 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (2.3.8)
|
5
|
+
bson (1.0.7)
|
6
|
+
crack (0.1.8)
|
7
|
+
jnunemaker-validatable (1.8.4)
|
8
|
+
activesupport (>= 2.3.4)
|
9
|
+
mongo (1.0.8)
|
10
|
+
bson (>= 1.0.5)
|
11
|
+
mongo_mapper (0.8.4)
|
12
|
+
activesupport (>= 2.3.4)
|
13
|
+
jnunemaker-validatable (~> 1.8.4)
|
14
|
+
plucky (~> 0.3.5)
|
15
|
+
pending (0.1.1)
|
16
|
+
plucky (0.3.5)
|
17
|
+
mongo (~> 1.0.8)
|
18
|
+
rack (1.2.1)
|
19
|
+
sinatra (1.0)
|
20
|
+
rack (>= 1.0)
|
21
|
+
tu-context (0.5.8)
|
22
|
+
yard (0.5.8)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
crack (>= 0.1.4)
|
29
|
+
mongo_mapper (= 0.8.4)
|
30
|
+
pending (>= 0.1.1)
|
31
|
+
sinatra (>= 1.0)
|
32
|
+
tu-context (>= 0.5.8)
|
33
|
+
yard
|
@@ -13,11 +13,11 @@ namespace :environment do
|
|
13
13
|
puts "Loading application environment..."
|
14
14
|
require File.dirname(__FILE__) + '/app'
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
task :models do
|
18
18
|
puts "Loading models..."
|
19
19
|
Config.setup_mongomapper
|
20
20
|
base = File.dirname(__FILE__)
|
21
|
-
Dir.glob(base + '/models/*.rb'
|
21
|
+
Dir.glob(base + '/models/*.rb').each { |f| require f }
|
22
22
|
end
|
23
23
|
end
|
data/examples/datacatalog/app.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
|
-
gem 'mongo_mapper', '= 0.8.2'
|
4
2
|
require 'mongo_mapper'
|
5
3
|
|
6
4
|
module Config
|
7
|
-
|
5
|
+
|
8
6
|
def self.setup
|
9
7
|
setup_mongomapper
|
10
8
|
# More application setup can go here...
|
11
9
|
end
|
12
|
-
|
10
|
+
|
13
11
|
def self.setup_mongomapper
|
14
12
|
MongoMapper.connection = new_mongo_connection
|
15
13
|
MongoMapper.database = environment_config['mongo_database']
|
16
14
|
end
|
17
|
-
|
15
|
+
|
18
16
|
def self.new_mongo_connection
|
19
17
|
Mongo::Connection.new(environment_config["mongo_hostname"])
|
20
18
|
end
|
@@ -44,7 +42,7 @@ module Config
|
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
47
|
-
|
45
|
+
|
48
46
|
def self.environment=(env)
|
49
47
|
@environment = env
|
50
48
|
end
|
@@ -52,7 +50,7 @@ module Config
|
|
52
50
|
def self.environments
|
53
51
|
config.keys
|
54
52
|
end
|
55
|
-
|
53
|
+
|
56
54
|
def self.config
|
57
55
|
if @config
|
58
56
|
@config
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
3
|
module DataCatalog
|
4
|
-
|
4
|
+
|
5
5
|
module Resource
|
6
|
-
|
6
|
+
|
7
7
|
def self.included(includee)
|
8
8
|
includee.instance_eval do
|
9
9
|
include SinatraResource::Resource
|
@@ -21,12 +21,12 @@ module DataCatalog
|
|
21
21
|
def convert(object)
|
22
22
|
object == "" ? "" : object.to_json
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def full_uri(path)
|
26
26
|
base_uri = Config.environment_config["base_uri"]
|
27
27
|
URI.join(base_uri, path).to_s
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def log_event(event, params)
|
31
31
|
# Application-logic could go here.
|
32
32
|
end
|
@@ -73,5 +73,5 @@ module DataCatalog
|
|
73
73
|
end
|
74
74
|
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DataCatalog
|
2
|
-
|
2
|
+
|
3
3
|
class Search
|
4
|
-
|
4
|
+
|
5
5
|
# Returns an array of strings, tokenized with stopwords removed.
|
6
6
|
#
|
7
7
|
# @param [<String>] array
|
@@ -11,7 +11,7 @@ module DataCatalog
|
|
11
11
|
def self.process(array)
|
12
12
|
unstop(tokenize(array))
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
# Tokenize an array of strings.
|
16
16
|
#
|
17
17
|
# @param [<String>] array
|
@@ -25,7 +25,7 @@ module DataCatalog
|
|
25
25
|
end
|
26
26
|
|
27
27
|
REMOVE = %r([!,;])
|
28
|
-
|
28
|
+
|
29
29
|
# Tokenize a string, removing extra characters too.
|
30
30
|
#
|
31
31
|
# @param [String] string
|
@@ -86,7 +86,7 @@ module DataCatalog
|
|
86
86
|
def self.unstop(array)
|
87
87
|
array - STOP_WORDS
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module DataCatalog
|
2
|
-
|
2
|
+
|
3
3
|
class Source
|
4
4
|
|
5
5
|
include MongoMapper::Document
|
@@ -35,9 +35,9 @@ module DataCatalog
|
|
35
35
|
|
36
36
|
validates_presence_of :title
|
37
37
|
validates_presence_of :url
|
38
|
-
|
38
|
+
|
39
39
|
# == Callbacks
|
40
|
-
|
40
|
+
|
41
41
|
before_save :update_keywords
|
42
42
|
def update_keywords
|
43
43
|
self._keywords = DataCatalog::Search.process([title, description])
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DataCatalog
|
2
2
|
|
3
3
|
class Usage
|
4
|
-
|
4
|
+
|
5
5
|
include MongoMapper::EmbeddedDocument
|
6
6
|
|
7
7
|
# == Attributes
|
@@ -21,7 +21,7 @@ module DataCatalog
|
|
21
21
|
#
|
22
22
|
# validates_presence_of :title
|
23
23
|
# validates_presence_of :url
|
24
|
-
|
24
|
+
|
25
25
|
# == Class Methods
|
26
26
|
|
27
27
|
# == Various Instance Methods
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'digest/sha1'
|
2
2
|
|
3
3
|
module DataCatalog
|
4
|
-
|
4
|
+
|
5
5
|
class User
|
6
|
-
|
6
|
+
|
7
7
|
include MongoMapper::Document
|
8
8
|
|
9
9
|
# == Attributes
|
@@ -19,7 +19,7 @@ module DataCatalog
|
|
19
19
|
ensure_index :email
|
20
20
|
|
21
21
|
# == Validations
|
22
|
-
|
22
|
+
|
23
23
|
validates_presence_of :name
|
24
24
|
validates_presence_of :role
|
25
25
|
validate :validate_role
|
@@ -31,9 +31,9 @@ module DataCatalog
|
|
31
31
|
errors.add(:role, "must be in #{VALID_ROLES.inspect}")
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
# == Callbacks
|
36
|
-
|
36
|
+
|
37
37
|
before_create :assign_api_key
|
38
38
|
def assign_api_key
|
39
39
|
unless _api_key
|
@@ -46,9 +46,9 @@ module DataCatalog
|
|
46
46
|
s = "#{Time.now.to_f}#{salt}#{rand(100_000_000)}#{name}#{email}"
|
47
47
|
Digest::SHA1.hexdigest(s)
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
# == Various Instance Methods
|
51
|
-
|
51
|
+
|
52
52
|
def token
|
53
53
|
Digest::SHA1.hexdigest("#{id}/#{email}/123456789")
|
54
54
|
end
|
@@ -15,7 +15,7 @@ module DataCatalog
|
|
15
15
|
permission :delete => :curator
|
16
16
|
|
17
17
|
# == Properties
|
18
|
-
|
18
|
+
|
19
19
|
property :name
|
20
20
|
property :log
|
21
21
|
|
@@ -29,13 +29,13 @@ module DataCatalog
|
|
29
29
|
}
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# == Callbacks
|
34
|
-
|
34
|
+
|
35
35
|
callback :before_create do |action|
|
36
36
|
action.params["log"] = "before_create"
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
callback :after_create do |action, category|
|
40
40
|
category.log += " after_create"
|
41
41
|
end
|
@@ -43,7 +43,7 @@ module DataCatalog
|
|
43
43
|
callback :before_update do |action, category|
|
44
44
|
action.params["log"] = "before_update"
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
callback :after_update do |action, category|
|
48
48
|
category.log += " after_update"
|
49
49
|
end
|
@@ -51,14 +51,14 @@ module DataCatalog
|
|
51
51
|
callback :before_destroy do |action, category|
|
52
52
|
action.headers 'X-Test-Callbacks' => 'before_destroy'
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
callback :after_destroy do |action, category|
|
56
56
|
x = action.response['X-Test-Callbacks']
|
57
57
|
action.headers 'X-Test-Callbacks' => "#{x} after_destroy"
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
Categories.build
|
63
63
|
|
64
64
|
end
|
@@ -14,7 +14,7 @@ module DataCatalog
|
|
14
14
|
:source_id => child.id
|
15
15
|
)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
relation :delete do |parent, child|
|
19
19
|
Categorization.find(:conditions => {
|
20
20
|
:category_id => parent.id,
|
@@ -30,7 +30,7 @@ module DataCatalog
|
|
30
30
|
permission :create => :curator
|
31
31
|
permission :update => :curator
|
32
32
|
permission :delete => :curator
|
33
|
-
|
33
|
+
|
34
34
|
# == Properties
|
35
35
|
|
36
36
|
property :title
|
@@ -38,9 +38,9 @@ module DataCatalog
|
|
38
38
|
property :raw, :w => :admin
|
39
39
|
|
40
40
|
# == Callbacks
|
41
|
-
|
41
|
+
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
CategoriesSources.build
|
45
45
|
|
46
46
|
end
|
@@ -13,13 +13,13 @@ module DataCatalog
|
|
13
13
|
permission :create => :curator
|
14
14
|
permission :update => :curator
|
15
15
|
permission :delete => :curator
|
16
|
-
|
16
|
+
|
17
17
|
# == Properties
|
18
18
|
|
19
19
|
property :title
|
20
20
|
property :url
|
21
21
|
property :raw, :w => :admin, :hide_by_default => true
|
22
|
-
|
22
|
+
|
23
23
|
property :categories do |source|
|
24
24
|
source.categorizations.map do |categorization|
|
25
25
|
{
|
@@ -32,7 +32,7 @@ module DataCatalog
|
|
32
32
|
|
33
33
|
# == Callbacks
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
Sources.build
|
37
37
|
|
38
38
|
end
|
@@ -16,7 +16,7 @@ module DataCatalog
|
|
16
16
|
permission :create => :curator
|
17
17
|
permission :update => :curator
|
18
18
|
permission :delete => :curator
|
19
|
-
|
19
|
+
|
20
20
|
# == Properties
|
21
21
|
|
22
22
|
property :title
|
@@ -24,9 +24,9 @@ module DataCatalog
|
|
24
24
|
property :description
|
25
25
|
|
26
26
|
# == Callbacks
|
27
|
-
|
27
|
+
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
SourcesUsages.build
|
31
31
|
|
32
32
|
end
|
@@ -15,19 +15,19 @@ module DataCatalog
|
|
15
15
|
permission :delete => :owner
|
16
16
|
|
17
17
|
# == Properties
|
18
|
-
|
18
|
+
|
19
19
|
property :name, :r => :basic
|
20
20
|
property :email, :r => :owner
|
21
21
|
property :role, :r => :owner, :w => :admin
|
22
22
|
property :_api_key, :r => :owner, :w => :admin
|
23
|
-
|
23
|
+
|
24
24
|
property :token, :r => :owner do |user|
|
25
25
|
user.token
|
26
26
|
end
|
27
27
|
|
28
28
|
# == Callbacks
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
Users.build
|
32
32
|
|
33
33
|
end
|
@@ -1,25 +1,25 @@
|
|
1
1
|
module ModelFactories
|
2
|
-
|
2
|
+
|
3
3
|
def create_source(custom={})
|
4
4
|
create_model!(DataCatalog::Source, custom, {
|
5
5
|
:title => "Healthcare Spending Data",
|
6
6
|
:url => "http://data.gov/details/23",
|
7
7
|
})
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def create_category(custom={})
|
11
11
|
create_model!(DataCatalog::Category, custom, {
|
12
12
|
:name => "Sample Category",
|
13
13
|
})
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def create_categorization(custom={})
|
17
17
|
create_model!(DataCatalog::Categorization, custom, {
|
18
18
|
:source_id => "",
|
19
19
|
:category_id => "",
|
20
20
|
})
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def create_note(custom={})
|
24
24
|
create_model!(DataCatalog::Note, custom, {
|
25
25
|
:text => "Sample Note",
|
@@ -34,9 +34,9 @@ module ModelFactories
|
|
34
34
|
:role => "basic",
|
35
35
|
})
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# -----
|
39
|
-
|
39
|
+
|
40
40
|
def new_usage(custom={})
|
41
41
|
new_model!(DataCatalog::Usage, custom, {
|
42
42
|
:title => "Sample Usage",
|
@@ -62,5 +62,5 @@ module ModelFactories
|
|
62
62
|
end
|
63
63
|
model
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
end
|