wire-framework 0.1.5.2 → 0.1.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec09ae1db5056dace28e0d574e44b42f96b54558
4
- data.tar.gz: a47551aae8e917c6e48e417931fad6a7c11b5af7
3
+ metadata.gz: 57b6276466fdde480be64d03871a923b517ba4d5
4
+ data.tar.gz: 085314f7a229be60dfdb3ad8c8445fa4a993da23
5
5
  SHA512:
6
- metadata.gz: 3547a7e673112f1adaf7264511afcc1c350bf00bbd981d31393858bcbbba240bc2b36db37146bf033c3bf7f4ab5331d3405ff35bc12e8a3d16ecfc5280f1a09e
7
- data.tar.gz: a6b7b0cfa9a7e5a688a1a799b2c2d935d92cd49ec802c294ecb28c1013d908e8c4ff5447684bebf83e3da1240892d9c3eacc4a8b227b44faf08086dda98b8e3b
6
+ metadata.gz: d3a6db1b191dd99b39d6dd32756caf687842d3602bec051575374f8d25ad5c0c67bcd67e2be21e28bfacc9620b461515fdadbc396c9fbb98801e754a3f02f948
7
+ data.tar.gz: 3cc276cf1e8f171f1176d2d6423cd25738ca2d1506bc035bf1e9718f7a25479a36a04b09ce8bf492af4d2e69ad7e3836a736f1e428d3c8e0c12c16c91224b153
data/lib/app/db.rb CHANGED
@@ -77,13 +77,6 @@ module DB
77
77
  415
78
78
  end
79
79
  else
80
- #TODO user_id needs to happen in the context
81
- if model.respond_to? :updated_by_id
82
- context.json[:updated_by_id] = context.user
83
- end
84
- if model.respond_to? :created_by_id
85
- context.json[:created_by_id] = context.user
86
- end
87
80
  begin
88
81
  instance = model.create(context.json)
89
82
  instance.save
@@ -104,20 +97,16 @@ module DB
104
97
  # @param [Hash] context the context for this request
105
98
  # @return [Response] all objects, or status code
106
99
  def self.do_read_all(context)
107
- return 404 unless context.resource
108
100
  model = context.config['models'][context.resource]
109
- if model
110
- hash = '[ '
111
- model.each do |e|
112
- hash << e.to_json
113
- hash << ','
114
- end
115
- hash = hash[0...-1]
116
- hash << ']'
117
- [200, {}, hash]
118
- else
119
- 404
101
+ return 404 unless model
102
+ hash = '[ '
103
+ model.each do |e|
104
+ hash << e.to_json
105
+ hash << ','
120
106
  end
107
+ hash = hash[0...-1]
108
+ hash << ']'
109
+ [200, {}, hash]
121
110
  end
122
111
 
123
112
  # Get a specific object from the DB table
@@ -130,13 +119,10 @@ module DB
130
119
  if id.eql?('new') or id.eql? 'upload'
131
120
  return '{}'
132
121
  end
133
- if model
134
- object = model[id]
135
- if object
136
- return [200, {}, object.to_json]
137
- end
122
+ object = model[id]
123
+ if object
124
+ return [200, {}, object.to_json]
138
125
  end
139
- [404, {}, []]
140
126
  end
141
127
 
142
128
  # Update a specific object in the DB table
@@ -145,17 +131,8 @@ module DB
145
131
  def self.do_update(context)
146
132
  model = context.config['models'][context.resource]
147
133
  return 404 unless model
148
-
149
- id = context.id
150
- if model
151
- if model.respond_to?(:updated_by_id)
152
- context.json[:updated_by_id] = context.user
153
- end
154
- instance = model[id]
155
- instance.update(context.json)
156
- else
157
- 404
158
- end
134
+ instance = model[context.id]
135
+ instance.update(context.json)
159
136
  end
160
137
 
161
138
  # Remove a specific object from the DB table
@@ -164,18 +141,12 @@ module DB
164
141
  def self.do_delete(context)
165
142
  model = context.config['models'][context.resource]
166
143
  return 404 unless model
167
-
168
- id = context.id
169
- if model
170
- instance = model[id]
171
- if instance
172
- if instance.destroy
173
- 200
174
- else
175
- [500, {}, 'Failed to delete instance']
176
- end
144
+ instance = model[context.id]
145
+ if instance
146
+ if instance.delete
147
+ 200
177
148
  else
178
- 404
149
+ [500, {}, 'Failed to delete instance']
179
150
  end
180
151
  else
181
152
  404
@@ -44,7 +44,7 @@ module Render
44
44
  # do nothing
45
45
  end
46
46
  else
47
- uri += "#{s}"
47
+ uri += "/#{s}"
48
48
  end
49
49
  temp = []
50
50
  if go_ahead
@@ -58,7 +58,7 @@ module Render
58
58
  end
59
59
  end
60
60
  end
61
- message = template[:path].render(self, hash)
61
+ message = template['file'].render(self, hash)
62
62
  if template['use_layout']
63
63
  message = render_template(actions, context, $wire_templates['layout'], message)
64
64
  end
data/lib/wire.rb CHANGED
@@ -33,7 +33,7 @@ end
33
33
  # @author Bryan T. Meyers
34
34
  module Wire
35
35
  # Current version of the Wire Gem
36
- VERSION = '0.1.5.2'
36
+ VERSION = '0.1.5.3'
37
37
  end
38
38
 
39
39
  require_relative 'app'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wire-framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.2
4
+ version: 0.1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan T. Meyers