repres-dosser 1.8.3 → 1.9

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: 5906319adab603857976c30257c1c3cba8a1bf1d
4
- data.tar.gz: 8ad5cc9e2b653899bedb7d0d5cd02e6f19ce20fe
3
+ metadata.gz: 6225ace816757924b0affa10b971289536da5842
4
+ data.tar.gz: 936f844a42e192bec54e3b55bf1d7864052ca664
5
5
  SHA512:
6
- metadata.gz: e986af84bd67b7789fe904090568b98f34e2a2725062903058217a701a656aef879d5cf96a3ca9423c289c1d8df9d76391eca07d261f547980b4633322b7ba6c
7
- data.tar.gz: 5796b592fee696186c56a4876fdb0f3716de9b80a262576ff32bc549d0d44a2e9b50b95417220fed8bb43cbec021a8a83f128970472ba5336a4b08eef127ec28
6
+ metadata.gz: 0fa35156c795e372b4d71a3858413f7d954c7631264bf686e0c895ace7b83c2dd7cc28ee1bf4481e82cc69d98d953f039abbb60895b6027aa446393a9c267bd2
7
+ data.tar.gz: 529ff9d1c7ed8c6cfa40d2e9f1a5e56ad4b474ca605448f88f9f988eb5b3e5b7b73c38f959405d2d61b38b2cdbc6ff80f725ad207f5c7cdcf7fd8f7da5c6f45e
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Repres Dosser 领域特定语意表现引擎
2
2
 
3
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/repres-dosser/frames)
3
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
5
+
4
6
  [![Gem Version](https://badge.fury.io/rb/repres-dosser.svg)](https://badge.fury.io/rb/repres-dosser)
5
7
  [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/repres-dosser.svg)](https://gemnasium.com/github.com/topbitdu/repres-dosser)
6
8
 
@@ -167,3 +169,18 @@ before insert the swagger_engine & the latest repres-dosser gem into the Gemfile
167
169
  config/initializers/swagger_engine.rb
168
170
  lib/swagger/administration_api_v2.json
169
171
  ```
172
+
173
+
174
+
175
+ ## RSpec examples
176
+
177
+ ```ruby
178
+ # spec/models/unidom_spec.rb
179
+ require 'repres/dosser/models_rspec'
180
+
181
+ # spec/types/unidom_spec.rb
182
+ require 'repres/dosser/types_rspec'
183
+
184
+ # spec/validators/unidom_spec.rb
185
+ require 'repres/dosser/validators_rspec'
186
+ ```
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application controller 是模块内所有控制器的基类。
3
+
1
4
  class Repres::Dosser::ApplicationController < ActionController::Base
2
5
  protect_from_forgery with: :exception
3
6
  end
@@ -1,3 +1,10 @@
1
+ ##
2
+ # Resource Presentation 是 DOSSER 风格的资源表现逻辑的关注点。
3
+ # HTTP 状态码可参考以下链接:
4
+ # https://httpstatuses.com/
5
+ # http://www.restapitutorial.com/httpstatuscodes.html
6
+ # http://guides.rubyonrails.org/layouts_and_rendering.html#the-status-option
7
+
1
8
  module Repres::Dosser::Concerns::ResourcePresentation
2
9
 
3
10
  extend ActiveSupport::Concern
@@ -14,11 +21,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
14
21
 
15
22
  attr_writer :criteria
16
23
 
17
- # https://httpstatuses.com/
18
- # http://www.restapitutorial.com/httpstatuscodes.html
19
- # http://guides.rubyonrails.org/layouts_and_rendering.html#the-status-option
20
-
21
- # 200
24
+ ##
25
+ # 返回 HTTP 状态码 200 ok 。
22
26
  def render_ok(
23
27
  success: true,
24
28
  code: self.class::CODE_SUCCESS,
@@ -35,7 +39,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
35
39
  errors: errors
36
40
  end
37
41
 
38
- # 201
42
+ ##
43
+ # 返回 HTTP 状态码 201 。
39
44
  def render_created(
40
45
  success: true,
41
46
  code: self.class::CODE_SUCCESS,
@@ -52,7 +57,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
52
57
  errors: errors
53
58
  end
54
59
 
55
- # 202
60
+ ##
61
+ # 返回 HTTP 状态码 202 。
56
62
  def render_accepted(
57
63
  success: true,
58
64
  code: self.class::CODE_SUCCESS,
@@ -69,7 +75,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
69
75
  errors: errors
70
76
  end
71
77
 
72
- # 204
78
+ ##
79
+ # 返回 HTTP 状态码 204 。
73
80
  def render_no_content(
74
81
  success: true,
75
82
  code: self.class::CODE_SUCCESS,
@@ -86,7 +93,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
86
93
  errors: errors
87
94
  end
88
95
 
89
- # 400
96
+ ##
97
+ # 返回 HTTP 状态码 400 。
90
98
  def render_bad_request(
91
99
  success: false,
92
100
  code: self.class::CODE_FAILURE_WRONG_PARAMETER,
@@ -103,7 +111,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
103
111
  errors: errors
104
112
  end
105
113
 
106
- # 401
114
+ ##
115
+ # 返回 HTTP 状态码 401 。
107
116
  def render_unauthorized(
108
117
  success: false,
109
118
  code: self.class::CODE_FAILURE,
@@ -120,7 +129,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
120
129
  errors: errors
121
130
  end
122
131
 
123
- # 403 forbidden
132
+ ##
133
+ # 返回 HTTP 状态码 403 forbidden 。
124
134
  def render_forbidden(
125
135
  success: false,
126
136
  code: self.class::CODE_FAILURE_FORBIDDEN,
@@ -137,7 +147,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
137
147
  errors: errors
138
148
  end
139
149
 
140
- # 404
150
+ ##
151
+ # 返回 HTTP 状态码 404 。
141
152
  def render_not_found(
142
153
  success: false,
143
154
  code: self.class::CODE_FAILURE_NOT_FOUND,
@@ -169,7 +180,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
169
180
  end
170
181
  =end
171
182
 
172
- # 409
183
+ ##
184
+ # 返回 HTTP 状态码 409 。
173
185
  def render_conflict(
174
186
  success: false,
175
187
  code: self.class::CODE_FAILURE_WRONG_STATE,
@@ -186,7 +198,8 @@ module Repres::Dosser::Concerns::ResourcePresentation
186
198
  errors: errors
187
199
  end
188
200
 
189
- # 500
201
+ ##
202
+ # 返回 HTTP 状态码 500 。
190
203
  def render_internal_server_error(
191
204
  success: false,
192
205
  code: self.class::CODE_FAILURE,
@@ -1,2 +1,5 @@
1
+ ##
2
+ # Application job 是模块内所有异步任务的基类。
3
+
1
4
  class Repres::Dosser::ApplicationJob < ActiveJob::Base
2
5
  end
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application mailer 是模块内所有电子邮件发送类的基类。
3
+
1
4
  class Repres::Dosser::ApplicationMailer < ActionMailer::Base
2
5
  default from: 'from@example.com'
3
6
  layout 'mailer'
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application record 是模块内所有模型的抽象基类。
3
+
1
4
  class Repres::Dosser::ApplicationRecord < ActiveRecord::Base
2
5
  self.abstract_class = true
3
6
  end
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Repres Dosser</title>
5
- <%= stylesheet_link_tag "repres/dosser/application", media: "all" %>
5
+ <%= stylesheet_link_tag 'repres/dosser/application', media: "all" %>
6
6
  <%= csrf_meta_tags %>
7
7
  </head>
8
8
  <body>
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  module Repres
2
2
  module Dosser
3
- VERSION = '1.8.3'.freeze
3
+ VERSION = '1.9'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repres-dosser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: '1.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-18 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -60,6 +60,9 @@ files:
60
60
  - lib/generators/repres/dosser/swagger/templates/lib/swagger/api.json.erb
61
61
  - lib/repres/dosser.rb
62
62
  - lib/repres/dosser/engine.rb
63
+ - lib/repres/dosser/models_rspec.rb
64
+ - lib/repres/dosser/types_rspec.rb
65
+ - lib/repres/dosser/validators_rspec.rb
63
66
  - lib/repres/dosser/version.rb
64
67
  - lib/tasks/dosser_tasks.rake
65
68
  homepage: https://github.com/topbitdu/repres-dosser