logical_model 0.2.9 → 0.2.10

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.
data/Gemfile CHANGED
@@ -4,9 +4,10 @@ source "http://rubygems.org"
4
4
  gem "activemodel"
5
5
  gem "activesupport"
6
6
  gem "typhoeus", "~> 0.2.4"
7
- gem "kaminari"
7
+ gem "kaminari", '~> 0.13.0'
8
8
 
9
9
  group :development, :test do
10
+ gem 'activerecord'
10
11
  gem "shoulda"
11
12
  gem "bundler", "~> 1.0.10"
12
13
  gem "jeweler", "~> 1.6.4"
@@ -1,123 +1,118 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- abstract (1.0.0)
5
- actionmailer (3.0.7)
6
- actionpack (= 3.0.7)
7
- mail (~> 2.2.15)
8
- actionpack (3.0.7)
9
- activemodel (= 3.0.7)
10
- activesupport (= 3.0.7)
11
- builder (~> 2.1.2)
12
- erubis (~> 2.6.6)
13
- i18n (~> 0.5.0)
14
- rack (~> 1.2.1)
15
- rack-mount (~> 0.6.14)
16
- rack-test (~> 0.5.7)
17
- tzinfo (~> 0.3.23)
18
- activemodel (3.0.7)
19
- activesupport (= 3.0.7)
20
- builder (~> 2.1.2)
21
- i18n (~> 0.5.0)
22
- activerecord (3.0.7)
23
- activemodel (= 3.0.7)
24
- activesupport (= 3.0.7)
25
- arel (~> 2.0.2)
26
- tzinfo (~> 0.3.23)
27
- activeresource (3.0.7)
28
- activemodel (= 3.0.7)
29
- activesupport (= 3.0.7)
30
- activesupport (3.0.7)
31
- arel (2.0.10)
32
- builder (2.1.2)
4
+ actionpack (3.1.3)
5
+ activemodel (= 3.1.3)
6
+ activesupport (= 3.1.3)
7
+ builder (~> 3.0.0)
8
+ erubis (~> 2.7.0)
9
+ i18n (~> 0.6)
10
+ rack (~> 1.3.5)
11
+ rack-cache (~> 1.1)
12
+ rack-mount (~> 0.8.2)
13
+ rack-test (~> 0.6.1)
14
+ sprockets (~> 2.0.3)
15
+ activemodel (3.1.3)
16
+ activesupport (= 3.1.3)
17
+ builder (~> 3.0.0)
18
+ i18n (~> 0.6)
19
+ activerecord (3.1.3)
20
+ activemodel (= 3.1.3)
21
+ activesupport (= 3.1.3)
22
+ arel (~> 2.2.1)
23
+ tzinfo (~> 0.3.29)
24
+ activesupport (3.1.3)
25
+ multi_json (~> 1.0)
26
+ arel (2.2.1)
27
+ builder (3.0.0)
33
28
  diff-lcs (1.1.3)
34
- erubis (2.6.6)
35
- abstract (>= 1.0.0)
36
- ffi (1.0.9)
29
+ erubis (2.7.0)
30
+ ffi (1.0.11)
37
31
  git (1.2.5)
38
- guard (0.8.4)
32
+ guard (0.10.0)
33
+ ffi (>= 0.5.0)
39
34
  thor (~> 0.14.6)
40
- guard-rspec (0.5.0)
41
- guard (>= 0.8.4)
42
- i18n (0.5.0)
35
+ guard-rspec (0.6.0)
36
+ guard (>= 0.10.0)
37
+ hike (1.2.1)
38
+ i18n (0.6.0)
43
39
  jeweler (1.6.4)
44
40
  bundler (~> 1.0)
45
41
  git (>= 1.2.5)
46
42
  rake
47
- json (1.5.3)
48
- kaminari (0.12.4)
49
- rails (>= 3.0.0)
50
- libnotify (0.5.7)
51
- mail (2.2.19)
52
- activesupport (>= 2.3.6)
53
- i18n (>= 0.4.0)
54
- mime-types (~> 1.16)
55
- treetop (~> 1.4.8)
56
- mime-types (1.16)
57
- polyglot (0.3.2)
58
- rack (1.2.3)
59
- rack-mount (0.6.14)
43
+ json (1.6.4)
44
+ kaminari (0.13.0)
45
+ actionpack (>= 3.0.0)
46
+ activesupport (>= 3.0.0)
47
+ railties (>= 3.0.0)
48
+ libnotify (0.7.1)
49
+ mime-types (1.17.2)
50
+ multi_json (1.0.4)
51
+ rack (1.3.6)
52
+ rack-cache (1.1)
53
+ rack (>= 0.4)
54
+ rack-mount (0.8.3)
60
55
  rack (>= 1.0.0)
61
- rack-test (0.5.7)
56
+ rack-ssl (1.3.2)
57
+ rack
58
+ rack-test (0.6.1)
62
59
  rack (>= 1.0)
63
- rails (3.0.7)
64
- actionmailer (= 3.0.7)
65
- actionpack (= 3.0.7)
66
- activerecord (= 3.0.7)
67
- activeresource (= 3.0.7)
68
- activesupport (= 3.0.7)
69
- bundler (~> 1.0)
70
- railties (= 3.0.7)
71
- railties (3.0.7)
72
- actionpack (= 3.0.7)
73
- activesupport (= 3.0.7)
60
+ railties (3.1.3)
61
+ actionpack (= 3.1.3)
62
+ activesupport (= 3.1.3)
63
+ rack-ssl (~> 1.3.2)
74
64
  rake (>= 0.8.7)
75
- thor (~> 0.14.4)
76
- rake (0.9.2)
65
+ rdoc (~> 3.4)
66
+ thor (~> 0.14.6)
67
+ rake (0.9.2.2)
77
68
  rb-inotify (0.8.8)
78
69
  ffi (>= 0.5.0)
79
- rcov (0.9.9)
80
- rspec (2.6.0)
81
- rspec-core (~> 2.6.0)
82
- rspec-expectations (~> 2.6.0)
83
- rspec-mocks (~> 2.6.0)
84
- rspec-core (2.6.4)
85
- rspec-expectations (2.6.0)
70
+ rcov (0.9.11)
71
+ rdoc (3.12)
72
+ json (~> 1.4)
73
+ rspec (2.8.0)
74
+ rspec-core (~> 2.8.0)
75
+ rspec-expectations (~> 2.8.0)
76
+ rspec-mocks (~> 2.8.0)
77
+ rspec-core (2.8.0)
78
+ rspec-expectations (2.8.0)
86
79
  diff-lcs (~> 1.1.2)
87
- rspec-mocks (2.6.0)
88
- rspec-rails (2.6.1)
89
- actionpack (~> 3.0)
90
- activesupport (~> 3.0)
91
- railties (~> 3.0)
92
- rspec (~> 2.6.0)
80
+ rspec-mocks (2.8.0)
81
+ rspec-rails (2.8.1)
82
+ actionpack (>= 3.0)
83
+ activesupport (>= 3.0)
84
+ railties (>= 3.0)
85
+ rspec (~> 2.8.0)
93
86
  shoulda (2.11.3)
94
- sinatra (1.2.7)
87
+ sinatra (1.2.8)
95
88
  rack (~> 1.1)
96
89
  tilt (>= 1.2.2, < 2.0)
97
- sqlite3 (1.3.4)
90
+ sprockets (2.0.3)
91
+ hike (~> 1.2)
92
+ rack (~> 1.0)
93
+ tilt (~> 1.1, != 1.3.0)
94
+ sqlite3 (1.3.5)
98
95
  sqlite3-ruby (1.3.3)
99
96
  sqlite3 (>= 1.3.3)
100
97
  thor (0.14.6)
101
98
  tilt (1.3.3)
102
- treetop (1.4.10)
103
- polyglot
104
- polyglot (>= 0.3.1)
105
99
  typhoeus (0.2.4)
106
100
  mime-types
107
101
  mime-types
108
- tzinfo (0.3.29)
102
+ tzinfo (0.3.31)
109
103
 
110
104
  PLATFORMS
111
105
  ruby
112
106
 
113
107
  DEPENDENCIES
114
108
  activemodel
109
+ activerecord
115
110
  activesupport
116
111
  bundler (~> 1.0.10)
117
112
  guard-rspec
118
113
  jeweler (~> 1.6.4)
119
114
  json
120
- kaminari
115
+ kaminari (~> 0.13.0)
121
116
  libnotify
122
117
  rb-inotify
123
118
  rcov
@@ -8,18 +8,62 @@ It was written following this tutorial: http://www.slideshare.net/ihower/service
8
8
 
9
9
  LogicalModel makes some assumptions about the service you'll be consuming
10
10
 
11
- # TODO
11
+ * resource service is RESTfull
12
+ * INDEX response is
13
+ {
14
+ collection: [resources...],
15
+ total: total items
16
+ }
12
17
 
13
- * it is RESTfull
14
- * Create response on success is
15
- {}
16
- * Create response on failure is
18
+ * SHOW response is
19
+ {
20
+ .... resource attributes ...
21
+ }
22
+
23
+ * CREATE response on success is
24
+ {
25
+ id: created_id
26
+ }
27
+
28
+ * CREATE response on failure is
29
+ {
30
+ message: 'error message',
31
+ error_codes: [],
32
+ errors: attribute_errors
33
+ }
34
+
35
+ * UPDATE response on success is
36
+ "OK"
37
+
38
+ * UPDATE response on failure is
39
+ {
40
+ message: 'error message',
41
+ error_codes: [],
42
+ errors: attribute_errors
43
+ }
44
+
45
+ * DESTROY response is
46
+ "ok"
17
47
 
18
48
  == Usage
19
49
 
20
50
  In your Gemfile:
21
51
 
22
- gem "logical_model"
52
+ gem "logical_model"
53
+
54
+ == Testing
55
+
56
+ For runnings specs you must have the service running locally. Do like this:
57
+
58
+ ruby service.rb -p 3000 -e test
59
+
60
+ Also note that after a single run of the tests the server must be restarted to reset
61
+ the database. We could change this by deleting all users in the test setup.
62
+
63
+ To run spec:
64
+
65
+ bundle exec rspec spec/client_spec.rb
66
+
23
67
 
24
68
  == Contributing to logical_model
25
69
 
@@ -33,11 +77,10 @@ gem "logical_model"
33
77
 
34
78
  == Copyright
35
79
 
36
- Copyright (c) 2011 Dwayne Macgowan. See LICENSE.txt for
80
+ Copyright (c) 2011,2012 Dwayne Macgowan. See LICENSE.txt for
37
81
  further details.
38
82
 
39
83
  === TODO
40
84
 
41
- * specs!
42
85
  * put log in /log
43
86
  * on create parse response and show errors, etc.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'rubygems'
4
- gem 'activerecord', "=3.0.7"
4
+ gem 'activerecord'
5
5
  require 'active_record'
6
6
  require 'logger'
7
7
  require 'bundler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.10
data/client.rb CHANGED
@@ -2,16 +2,16 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'typhoeus'
4
4
  require 'json'
5
- require 'lib/logical_model'
5
+ require './lib/logical_model'
6
6
 
7
7
  class User < LogicalModel
8
8
  #class << self; attr_accessor :base_uri end
9
9
 
10
- #self.hydra = Typhoeus::Hydra.new
10
+ self.hydra = Typhoeus::Hydra.new
11
11
  self.use_ssl = false #(Rails.env=="production")
12
12
 
13
13
  self.resource_path = "/api/v1/users"
14
- self.attribute_keys = [:name, :email, :password, :bio]
14
+ self.attribute_keys = [:id, :name, :email, :password, :bio]
15
15
  self.use_api_key = false
16
16
  #self.api_key_name = "token"
17
17
  #self.api_key = "8c330b5d70f86ebfa6497c901b299b79afc6d68c60df6df0bda0180d3777eb4a5528924ac96cf58a25e599b4110da3c4b690fa29263714ec6604b6cb2d943656"
@@ -21,48 +21,4 @@ class User < LogicalModel
21
21
  TIMEOUT = 5500 # miliseconds
22
22
  PER_PAGE = 9999
23
23
 
24
- # def self.find_by_name(name)
25
- # response = Typhoeus::Request.get("#{base_uri}/api/v1/users/#{name}")
26
- # if response.code == 200
27
- # JSON.parse(response.body)["user"]
28
- # elsif response.code == 404
29
- # nil
30
- # else
31
- # raise response.body
32
- # end
33
- # end
34
-
35
- # def self.create(attributes = {})
36
- # response = Typhoeus::Request.post("#{base_uri}/api/v1/users", :body => attributes.to_json)
37
- # if response.success?
38
- # JSON.parse(response.body)["user"]
39
- # else
40
- # raise response.body
41
- # end
42
- # end
43
-
44
- # def self.update(name, attributes)
45
- # response = Typhoeus::Request.put("#{base_uri}/api/v1/users/#{name}", :body => attributes.to_json)
46
- # if response.success?
47
- # JSON.parse(response.body)["user"]
48
- # else
49
- # raise response.body
50
- # end
51
- # end
52
-
53
- # def self.destroy(name)
54
- # response = Typhoeus::Request.delete("#{base_uri}/api/v1/users/#{name}")
55
- # response.success?
56
- # end
57
-
58
- # def self.login(name, password)
59
- # response = Typhoeus::Request.post("#{base_uri}/api/v1/users/#{name}/sessions", :body => {:password => password}.to_json)
60
- # if response.success?
61
- # JSON.parse(response.body)["user"]
62
- # elsif response.code == 400
63
- # nil
64
- # else
65
- # raise response.body
66
- # end
67
- # end
68
- end
24
+ end
@@ -69,6 +69,18 @@ class LogicalModel
69
69
  def log_path; @log_path ||= "log/logical_model.log"; end
70
70
  def use_api_key; @use_api_key ||= false; end
71
71
 
72
+ def validates_associated(*associations)
73
+ associations.each do |association|
74
+ validates_each association do |record, attr, value|
75
+ unless value.collect{ |r| r.nil? || r.valid? }.all?
76
+ value.reject { |t| t.valid? }.each do |t|
77
+ record.errors.add("", "#{t.class.name} #{t.errors.full_messages.to_sentence}")
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+
72
84
  # host eg: "127.0.0.1:3010"
73
85
  # resource_path eg: "/api/v1/people"
74
86
  end
@@ -77,17 +89,12 @@ class LogicalModel
77
89
  @json_root ||= self.class.to_s.underscore
78
90
  end
79
91
 
80
-
81
92
  def self.resource_uri(id=nil)
82
93
  prefix = (use_ssl)? "https://" : "http://"
83
94
  sufix = (id.nil?)? "" : "/#{id}"
84
95
  "#{prefix}#{host}#{resource_path}#{sufix}"
85
96
  end
86
97
 
87
- def persisted?
88
- false
89
- end
90
-
91
98
  def initialize(attributes={})
92
99
  self.attributes = attributes
93
100
  end
@@ -95,6 +102,61 @@ class LogicalModel
95
102
  def self.has_many_keys=(keys)
96
103
  @has_many_keys = keys
97
104
  attr_accessor *keys
105
+
106
+ keys.each do |association|
107
+
108
+ # return empty array or @association variable for each association
109
+ define_method association do
110
+ if instance_variable_get("@#{association}").blank?
111
+ instance_variable_set("@#{association}", [])
112
+ end
113
+
114
+ instance_variable_get("@#{association}")
115
+ end
116
+
117
+ # this method loads the contact attributes recieved by logical model from the service
118
+ define_method "#{association}=" do |params|
119
+ collection = []
120
+ params.each do |attr_params|
121
+ if attr_params["_type"].present?
122
+ attr_class = attr_params.delete("_type").to_s.constantize
123
+ else
124
+ attr_class = association.to_s.camelize.constantize
125
+ end
126
+ collection << attr_class.new(attr_params)
127
+ end
128
+ instance_variable_set("@#{association}", collection)
129
+ end
130
+
131
+ define_method "new_#{association.to_s.singularize}" do |attr_params|
132
+ if attr_params["_type"].present?
133
+ clazz = attr_params.delete(:_type).constantize
134
+ else
135
+ clazz = association.to_s.singularize.camelize.constantize
136
+ end
137
+
138
+ return unless clazz
139
+
140
+ temp_object = clazz.new(attr_params.merge({"#{self.json_root}_id" => self.id}))
141
+ eval(association.to_s) << temp_object
142
+ temp_object
143
+ end
144
+
145
+ # this method loads the contact attributes from the html form (using nested resources conventions)
146
+ define_method "#{association}_attributes=" do |key_attributes|
147
+ array = []
148
+ key_attributes.each do |attr_params|
149
+ attr_params.to_hash.symbolize_keys!
150
+ if attr_params["_type"].present?
151
+ attr_class = attr_params.delete("_type").to_s.constantize
152
+ else
153
+ attr_class = association.to_s.singularize.camelize.constantize
154
+ end
155
+ array << attr_class.new(attr_params)
156
+ end
157
+ instance_variable_set("@#{association}", array)
158
+ end
159
+ end
98
160
  end
99
161
 
100
162
  def self.has_many_keys
@@ -178,7 +240,7 @@ class LogicalModel
178
240
  # This pagination won't block excecution waiting for result, pagination will be enqueued in Objectr#hydra.
179
241
  #
180
242
  # Parameters:
181
- # - options hash.
243
+ # @param options [Hash].
182
244
  # Valid options are:
183
245
  # * :page - indicated what page to return. Defaults to 1.
184
246
  # * :per_page - indicates how many records to be returned per page. Defauls to 20
@@ -187,8 +249,8 @@ class LogicalModel
187
249
  # Usage:
188
250
  # Person.async_paginate(:page => params[:page]){|i| result = i}
189
251
  def self.async_paginate(options={})
190
- options[:page] ||= 1
191
- options[:per_page] ||= 20
252
+ page = options[:page] || 1
253
+ per_page = options[:per_page] || 20
192
254
 
193
255
  options = self.merge_key(options)
194
256
 
@@ -200,7 +262,14 @@ class LogicalModel
200
262
  result_set = self.from_json(response.body)
201
263
 
202
264
  # this paginate is will_paginate's Array pagination
203
- collection = Kaminari.paginate_array(result_set[:collection]).page(options[:page]).per(options[:per_page])
265
+ collection = Kaminari.paginate_array(
266
+ result_set[:collection],
267
+ {
268
+ :total_count=>result_set[:total],
269
+ :limit => per_page,
270
+ :offset => per_page * ([page, 1].max - 1)
271
+ }
272
+ )
204
273
 
205
274
  yield collection
206
275
  else
@@ -303,7 +372,7 @@ class LogicalModel
303
372
  end
304
373
 
305
374
  # Updates Objects attributes, this will only send attributes passed as arguments
306
- #
375
+ #
307
376
  #
308
377
  # Returns false if Object#valid? is false.
309
378
  # Returns updated object if successfull.
@@ -348,7 +417,7 @@ class LogicalModel
348
417
  end
349
418
 
350
419
  # Saves Objects attributes
351
- #
420
+ #
352
421
  #
353
422
  # Returns false if Object#valid? is false.
354
423
  # Returns updated object if successfull.
@@ -422,4 +491,16 @@ class LogicalModel
422
491
  self.class.delete(self.id,params)
423
492
  end
424
493
 
494
+ def persisted?
495
+ false
496
+ end
497
+
498
+ # Returns true if a record has not been persisted yet.
499
+ #
500
+ # Usage:
501
+ # @person.new_record?
502
+ def new_record?
503
+ !self.persisted?
504
+ end
505
+
425
506
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "logical_model"
8
- s.version = "0.2.9"
8
+ s.version = "0.2.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dwayne Macgowan"]
12
- s.date = "2011-11-24"
12
+ s.date = "2012-01-09"
13
13
  s.description = "LogicalModel allows to use a resource as a model. It is based on web presentation http://www.slideshare.net/ihower/serviceoriented-design-and-implement-with-rails3"
14
14
  s.email = "dwaynemac@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -31,10 +31,8 @@ Gem::Specification.new do |s|
31
31
  "config/database.yml",
32
32
  "db/development.sqlite3",
33
33
  "db/migrate/001_create_users.rb",
34
- "db/test.sqlite3",
35
34
  "lib/logical_model.rb",
36
35
  "logical_model.gemspec",
37
- "logs/development.log",
38
36
  "models/user.rb",
39
37
  "service.rb",
40
38
  "spec/client_spec.rb",
@@ -56,7 +54,8 @@ Gem::Specification.new do |s|
56
54
  s.add_runtime_dependency(%q<activemodel>, [">= 0"])
57
55
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
58
56
  s.add_runtime_dependency(%q<typhoeus>, ["~> 0.2.4"])
59
- s.add_runtime_dependency(%q<kaminari>, [">= 0"])
57
+ s.add_runtime_dependency(%q<kaminari>, ["~> 0.13.0"])
58
+ s.add_development_dependency(%q<activerecord>, [">= 0"])
60
59
  s.add_development_dependency(%q<shoulda>, [">= 0"])
61
60
  s.add_development_dependency(%q<bundler>, ["~> 1.0.10"])
62
61
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
@@ -72,7 +71,8 @@ Gem::Specification.new do |s|
72
71
  s.add_dependency(%q<activemodel>, [">= 0"])
73
72
  s.add_dependency(%q<activesupport>, [">= 0"])
74
73
  s.add_dependency(%q<typhoeus>, ["~> 0.2.4"])
75
- s.add_dependency(%q<kaminari>, [">= 0"])
74
+ s.add_dependency(%q<kaminari>, ["~> 0.13.0"])
75
+ s.add_dependency(%q<activerecord>, [">= 0"])
76
76
  s.add_dependency(%q<shoulda>, [">= 0"])
77
77
  s.add_dependency(%q<bundler>, ["~> 1.0.10"])
78
78
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
@@ -89,7 +89,8 @@ Gem::Specification.new do |s|
89
89
  s.add_dependency(%q<activemodel>, [">= 0"])
90
90
  s.add_dependency(%q<activesupport>, [">= 0"])
91
91
  s.add_dependency(%q<typhoeus>, ["~> 0.2.4"])
92
- s.add_dependency(%q<kaminari>, [">= 0"])
92
+ s.add_dependency(%q<kaminari>, ["~> 0.13.0"])
93
+ s.add_dependency(%q<activerecord>, [">= 0"])
93
94
  s.add_dependency(%q<shoulda>, [">= 0"])
94
95
  s.add_dependency(%q<bundler>, ["~> 1.0.10"])
95
96
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
data/service.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'active_record'
4
4
  require 'sinatra'
5
- require 'models/user'
5
+ require './models/user'
6
6
 
7
7
  # setting up the environment
8
8
  env_index = ARGV.index("-e")
@@ -17,12 +17,16 @@ if env == "test"
17
17
  User.create(:name => "paul", :email => "paul@pauldix.net", :bio => "rubyist")
18
18
  end
19
19
 
20
-
21
-
22
20
  # Simple RESTfull Service
23
21
  # for LogicalModel Testing
24
22
 
23
+ # index
24
+ # Responds { collection, total }
25
+ get 'api/v1/users' do
26
+ users = User.all
25
27
 
28
+ { collection: users, total: users.count}.to_json
29
+ end
26
30
 
27
31
  # HTTP entry points
28
32
  # get a user by name
@@ -40,7 +44,7 @@ post '/api/v1/users' do
40
44
  begin
41
45
  user = User.new(params[:user])
42
46
  if user.save
43
- user.to_json
47
+ [201, {id: user.id}.to_json]
44
48
  else
45
49
  error 400, {:errors => user.errors}.to_json
46
50
  end
@@ -76,4 +80,4 @@ delete '/api/v1/users/:name' do
76
80
  else
77
81
  error 404, {:error => "user not found"}.to_json
78
82
  end
79
- end
83
+ end
@@ -5,33 +5,7 @@ require File.dirname(__FILE__) + '/../client'
5
5
 
6
6
  # Also note that after a single run of the tests the server must be restarted to reset
7
7
  # the database. We could change this by deleting all users in the test setup.
8
-
9
- # TODO testing in these specs should be focus on LogicalModel behaviour.
10
8
  describe "LogicalModel User client" do
11
- before(:each) do
12
- # User.destroy_all
13
- # User.base_uri = "http://localhost:3000"
14
-
15
- # @user = User.find_by_name(:name => "paul")
16
- # User.delete(@user.id)
17
- # User.destroy("trotter")
18
-
19
- # @user = User.new({:name => "bryan",
20
- # :email => "bryan@spamtown.usa",
21
- # :password => "strongpass",
22
- # :bio => "rubyist"})
23
- # @user.create
24
- # User.create(
25
- # :name => "paul",
26
- # :email => "paul@pauldix.net",
27
- # :password => "strongpass",
28
- # :bio => "rubyist")
29
- # User.create(
30
- # :name => "bryan",
31
- # :email => "bryan@spamtown.usa",
32
- # :password => "strongpass",
33
- # :bio => "rubyist")
34
- end
35
9
 
36
10
  describe "#create" do
37
11
  context "with valid attributes" do
@@ -55,27 +29,33 @@ describe "LogicalModel User client" do
55
29
  end
56
30
  end
57
31
 
58
- # describe "#find" do
59
- # it "should GET resource by id" do
60
- # pending "on it to work"
61
- #user = User.find(@user.id)
62
- #user["name"].should == "paul"
63
- #user["email"].should == "paul@pauldix.net"
64
- #user["bio"].should == "rubyist"
65
- # end
66
- # it "should return nil for a user not found" do
67
- # pending "on it to work"
68
- #User.find_by_name("gosling").should be_nil
69
- # end
70
- # end
71
-
72
- # describe "#paginate" do
73
-
74
- # end
75
-
76
- # describe "#update" do
77
-
78
- # end
32
+ describe "#paginate" do
33
+ before do
34
+ # --> Mock service
35
+ req = Typhoeus::Request.any_instance
36
+ response = mock(
37
+ code: 200,
38
+ body: {
39
+ collection: [{name:'a',email:'a@m'},
40
+ {name:'b',email:'b@m'},
41
+ {name:'c',email:'c@m'}],
42
+ total: 6
43
+ }.to_json,
44
+ request: mock(url:"mockedurl"),
45
+ time: 1234
46
+ )
47
+ req.stub(:on_complete).and_yield(response)
48
+ # <-- service mocked
49
+
50
+ @users = User.paginate(page:1, per_page:1)
51
+ end
52
+ it "should return a Kaminari::PaginatableArray" do
53
+ @users.should be_a(Kaminari::PaginatableArray)
54
+ end
55
+ it "should set total_count" do
56
+ @users.total_count.should == 6
57
+ end
58
+ end
79
59
 
80
60
  describe "#https" do
81
61
  context "when use_ssl is tue" do
@@ -96,35 +76,4 @@ describe "LogicalModel User client" do
96
76
  end
97
77
  end
98
78
  end
99
-
100
-
101
-
102
- # it "should create a user" do
103
- # user = User.create({
104
- # :name => "trotter",
105
- # :email => "trotter@spamtown.usa",
106
- # :password => "whatev"})
107
- # User.find_by_name("trotter")["email"].should == "trotter@spamtown.usa"
108
- # end
109
-
110
- # it "should update a user" do
111
- # user = User.update("paul", :bio => "rubyist and author")
112
- # user["name"].should == "paul"
113
- # user["bio"].should == "rubyist and author"
114
- # User.find_by_name("paul")["bio"] == "rubyist and author"
115
- # end
116
-
117
- # it "should destroy a user" do
118
- # User.destroy("bryan").should == true
119
- # User.find_by_name("bryan").should be_nil
120
- # end
121
-
122
- # it "should verify login credentials" do
123
- # user = User.login("paul", "strongpass")
124
- # user["name"].should == "paul"
125
- # end
126
-
127
- # it "should return nil with invalid credentials" do
128
- # User.login("paul", "wrongpassword").should be_nil
129
- # end
130
79
  end
@@ -22,7 +22,22 @@ describe "v1 service: " do
22
22
  before(:each) do
23
23
  User.delete_all
24
24
  end
25
-
25
+
26
+ describe "get /api/v1/users" do
27
+ before do
28
+ User.create(name: "dwayne", email: "dwaynemac@gmail.com", password: "asdf", bio: "test")
29
+ User.create(name: "2dwayne", email: "dw2aynemac@gmail.com", password: "a2sdf", bio: "te2st")
30
+ get '/api/v1/users'
31
+ end
32
+ it { should respond_with :success }
33
+ it "should send collection" do
34
+ ActiveSupport::JSON.decode(last_response.body)['collection'].should_not be_nil
35
+ end
36
+ it "should send total items number" do
37
+ AcriveSupport::JSON.decode(last_response.body)['total'].should == 2
38
+ end
39
+ end
40
+
26
41
  describe "RESTfull GET (on /api/v1/users/:id)" do
27
42
  context "for existing user" do
28
43
  before(:each) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logical_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-24 00:00:00.000000000Z
12
+ date: 2012-01-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
16
- requirement: &79786070 !ruby/object:Gem::Requirement
16
+ requirement: &78627270 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *79786070
24
+ version_requirements: *78627270
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &79785440 !ruby/object:Gem::Requirement
27
+ requirement: &78626410 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *79785440
35
+ version_requirements: *78626410
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: typhoeus
38
- requirement: &79784950 !ruby/object:Gem::Requirement
38
+ requirement: &78624510 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,21 +43,32 @@ dependencies:
43
43
  version: 0.2.4
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *79784950
46
+ version_requirements: *78624510
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: kaminari
49
- requirement: &79784280 !ruby/object:Gem::Requirement
49
+ requirement: &78623980 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.13.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *78623980
58
+ - !ruby/object:Gem::Dependency
59
+ name: activerecord
60
+ requirement: &78623670 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
53
64
  - !ruby/object:Gem::Version
54
65
  version: '0'
55
- type: :runtime
66
+ type: :development
56
67
  prerelease: false
57
- version_requirements: *79784280
68
+ version_requirements: *78623670
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: shoulda
60
- requirement: &79783710 !ruby/object:Gem::Requirement
71
+ requirement: &78623310 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *79783710
79
+ version_requirements: *78623310
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: bundler
71
- requirement: &79767980 !ruby/object:Gem::Requirement
82
+ requirement: &78622890 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 1.0.10
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *79767980
90
+ version_requirements: *78622890
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: jeweler
82
- requirement: &79767170 !ruby/object:Gem::Requirement
93
+ requirement: &78622410 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 1.6.4
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *79767170
101
+ version_requirements: *78622410
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: rcov
93
- requirement: &79765920 !ruby/object:Gem::Requirement
104
+ requirement: &78621770 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *79765920
112
+ version_requirements: *78621770
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: sqlite3-ruby
104
- requirement: &79765210 !ruby/object:Gem::Requirement
115
+ requirement: &78621440 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '0'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *79765210
123
+ version_requirements: *78621440
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: sinatra
115
- requirement: &79764410 !ruby/object:Gem::Requirement
126
+ requirement: &78621020 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ~>
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: 1.2.6
121
132
  type: :development
122
133
  prerelease: false
123
- version_requirements: *79764410
134
+ version_requirements: *78621020
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: json
126
- requirement: &79763810 !ruby/object:Gem::Requirement
137
+ requirement: &78599190 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ! '>='
@@ -131,10 +142,10 @@ dependencies:
131
142
  version: '0'
132
143
  type: :development
133
144
  prerelease: false
134
- version_requirements: *79763810
145
+ version_requirements: *78599190
135
146
  - !ruby/object:Gem::Dependency
136
147
  name: rspec-rails
137
- requirement: &79763190 !ruby/object:Gem::Requirement
148
+ requirement: &78598610 !ruby/object:Gem::Requirement
138
149
  none: false
139
150
  requirements:
140
151
  - - ! '>='
@@ -142,10 +153,10 @@ dependencies:
142
153
  version: '0'
143
154
  type: :development
144
155
  prerelease: false
145
- version_requirements: *79763190
156
+ version_requirements: *78598610
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: guard-rspec
148
- requirement: &79762800 !ruby/object:Gem::Requirement
159
+ requirement: &78598040 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ! '>='
@@ -153,10 +164,10 @@ dependencies:
153
164
  version: '0'
154
165
  type: :development
155
166
  prerelease: false
156
- version_requirements: *79762800
167
+ version_requirements: *78598040
157
168
  - !ruby/object:Gem::Dependency
158
169
  name: rb-inotify
159
- requirement: &79762320 !ruby/object:Gem::Requirement
170
+ requirement: &78597410 !ruby/object:Gem::Requirement
160
171
  none: false
161
172
  requirements:
162
173
  - - ! '>='
@@ -164,10 +175,10 @@ dependencies:
164
175
  version: '0'
165
176
  type: :development
166
177
  prerelease: false
167
- version_requirements: *79762320
178
+ version_requirements: *78597410
168
179
  - !ruby/object:Gem::Dependency
169
180
  name: libnotify
170
- requirement: &79761520 !ruby/object:Gem::Requirement
181
+ requirement: &78596950 !ruby/object:Gem::Requirement
171
182
  none: false
172
183
  requirements:
173
184
  - - ! '>='
@@ -175,7 +186,7 @@ dependencies:
175
186
  version: '0'
176
187
  type: :development
177
188
  prerelease: false
178
- version_requirements: *79761520
189
+ version_requirements: *78596950
179
190
  description: LogicalModel allows to use a resource as a model. It is based on web
180
191
  presentation http://www.slideshare.net/ihower/serviceoriented-design-and-implement-with-rails3
181
192
  email: dwaynemac@gmail.com
@@ -199,10 +210,8 @@ files:
199
210
  - config/database.yml
200
211
  - db/development.sqlite3
201
212
  - db/migrate/001_create_users.rb
202
- - db/test.sqlite3
203
213
  - lib/logical_model.rb
204
214
  - logical_model.gemspec
205
- - logs/development.log
206
215
  - models/user.rb
207
216
  - service.rb
208
217
  - spec/client_spec.rb
@@ -225,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
234
  version: '0'
226
235
  segments:
227
236
  - 0
228
- hash: -873629389
237
+ hash: -162919699
229
238
  required_rubygems_version: !ruby/object:Gem::Requirement
230
239
  none: false
231
240
  requirements:
Binary file
@@ -1,144 +0,0 @@
1
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.004691s FAILED:
2
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
3
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.00462s FAILED:
4
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
5
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.004597s FAILED:
6
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
7
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.00463s FAILED:
8
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
9
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.004576s FAILED:
10
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
11
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.00471s FAILED:
12
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
13
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.004598s FAILED:
14
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
15
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.021388s FAILED:
16
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
17
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.004659s FAILED:
18
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
19
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.005105s FAILED:
20
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
21
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.004775s FAILED:
22
- LogicalModel Log RESPONSE: "745: unexpected token at 'user%5Bbio%5D=rubyist&user%5Bemail%5D=paul%40pauldix.net&user%5Bname%5D=paul&user%5Bpassword%5D=strongpass'"
23
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.145529s FAILED:
24
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
25
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.0216s FAILED:
26
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
27
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.018887s FAILED:
28
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
29
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.127662s FAILED:
30
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
31
- LogicalModel Log: 0 https://localhost:3000/api/v1/users in 0.044237s FAILED: error
32
- LogicalModel Log RESPONSE:
33
- LogicalModel Log: 0 https://localhost:3000/api/v1/users in 0.000878s FAILED: error
34
- LogicalModel Log RESPONSE:
35
- LogicalModel Log: 0 https://localhost:3000/api/v1/users in 0.001611s FAILED: error
36
- LogicalModel Log RESPONSE:
37
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.233063s FAILED:
38
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
39
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.157818s FAILED:
40
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
41
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.067717s FAILED:
42
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
43
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.011295s FAILED:
44
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
45
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.019577s FAILED:
46
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
47
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.047789s FAILED:
48
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
49
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.021546s FAILED:
50
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
51
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.049893s FAILED:
52
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
53
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 5.021058s FAILED:
54
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
55
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.047952s FAILED:
56
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
57
- LogicalModel Log: 0 http://localhost:3000/api/v1/users in 0.001093s FAILED: error
58
- LogicalModel Log RESPONSE:
59
- LogicalModel Log: 0 http://localhost:3000/api/v1/users in 0.000394s FAILED: error
60
- LogicalModel Log RESPONSE:
61
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.136481s FAILED:
62
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
63
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.050792s FAILED:
64
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
65
- LogicalModel Log: 200 http://localhost:3000/api/v1/users in 0.141034s FAILED:
66
- LogicalModel Log RESPONSE: {"user":{"name":"bryan","created_at":"2011-11-03T14:37:44-03:00","updated_at":"2011-11-03T14:37:44-03:00","id":24,"bio":"another rubyist","email":"bryan@pauldix.net"}}
67
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.050582s FAILED:
68
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
69
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.035647s FAILED:
70
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
71
- LogicalModel Log: 200 http://localhost:3000/api/v1/users in 0.201605s FAILED:
72
- LogicalModel Log RESPONSE: {"user":{"name":"bryan","created_at":"2011-11-03T14:39:18-03:00","updated_at":"2011-11-03T14:39:18-03:00","id":26,"bio":"another rubyist","email":"bryan@pauldix.net"}}
73
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.038625s FAILED:
74
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
75
- LogicalModel Log: 200 http://localhost:3000/api/v1/users in 0.191726s FAILED:
76
- LogicalModel Log RESPONSE: {"user":{"name":"bryan","created_at":"2011-11-03T14:41:10-03:00","updated_at":"2011-11-03T14:41:10-03:00","id":28,"bio":"another rubyist","email":"bryan@pauldix.net"}}
77
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.018539s FAILED:
78
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
79
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.049956s FAILED:
80
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
81
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.018731s FAILED:
82
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
83
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.048094s FAILED:
84
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
85
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.02157s FAILED:
86
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
87
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.051048s FAILED:
88
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
89
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 5.02165s FAILED:
90
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
91
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.050986s FAILED:
92
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
93
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.013325s FAILED:
94
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
95
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.11644s FAILED:
96
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
97
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.014655s FAILED:
98
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
99
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.050812s FAILED:
100
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
101
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.015264s FAILED:
102
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
103
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.048666s FAILED:
104
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
105
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 5.023148s FAILED:
106
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
107
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.047819s FAILED:
108
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
109
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.014254s FAILED:
110
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
111
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.048866s FAILED:
112
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
113
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.01741s FAILED:
114
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
115
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.051693s FAILED:
116
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
117
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.035599s FAILED:
118
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
119
- LogicalModel Log: 200 http://localhost:3000/api/v1/users in 0.187376s FAILED:
120
- LogicalModel Log RESPONSE: {"user":{"name":"bryan","created_at":"2011-11-03T14:58:14-03:00","updated_at":"2011-11-03T14:58:14-03:00","id":30,"bio":"another rubyist","email":"bryan@pauldix.net"}}
121
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.02095s FAILED:
122
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
123
- LogicalModel Log: 0 https://localhost:3000/api/v1/users in 0.000257s FAILED: error
124
- LogicalModel Log RESPONSE:
125
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.023091s FAILED:
126
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
127
- LogicalModel Log: 0 https://localhost:3000/api/v1/users in 0.000932s FAILED: error
128
- LogicalModel Log RESPONSE:
129
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.019534s FAILED:
130
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
131
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 5.0228s FAILED:
132
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
133
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.012712s FAILED:
134
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
135
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.050448s FAILED:
136
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
137
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.058483s FAILED:
138
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
139
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.01427s FAILED:
140
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
141
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.051569s FAILED:
142
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}
143
- LogicalModel Log: 400 http://localhost:3000/api/v1/users in 0.116518s FAILED:
144
- LogicalModel Log RESPONSE: {"errors":{"name":["has already been taken"],"email":["has already been taken"]}}