ns_service_pack 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -62,6 +62,17 @@ end
62
62
 
63
63
 
64
64
  #==============History:
65
+ #==0.0.13
66
+ * json数据打包部分增加部分成功的情况:
67
+ ResultPacker.improve(ok_data, errors_hash, msg)
68
+ 返回节点情况:
69
+ {
70
+ :status=>'imperfect',
71
+ :msg=>'部分逻辑错误',
72
+ :data=>your_ok_data_part,
73
+ :errors=>your_error_hash_part
74
+ }
75
+
65
76
  #==0.0.12
66
77
  * Fix bug: override the original 'model_name' method, rename to '__model_clazz_name'
67
78
 
@@ -5,7 +5,7 @@
5
5
  class ResultPacker
6
6
  #自定义打包
7
7
  def self.pack(response_hash={})
8
- {:status=>'ok',:msg=>''}.merge!(response_hash)
8
+ {:status=>'ok',:msg=>'', :data=>nil}.merge!(response_hash)
9
9
  end
10
10
 
11
11
  #封装数据
@@ -13,6 +13,11 @@ class ResultPacker
13
13
  {:status=>'ok',:msg=>msg, :data=>data_hash}
14
14
  end
15
15
 
16
+ #前台验证错误
17
+ def self.improve(ok_data = nil, hint_hash={}, msg='部分逻辑错误!')
18
+ {:status=>'imperfect',:msg=>msg, :data=>ok_data, :error=>hint_hash}
19
+ end
20
+
16
21
  #前台验证错误
17
22
  def self.help(hint_hash={}, msg='数据逻辑有误,请查看错误提示!')
18
23
  {:status=>'illegal',:msg=>msg, :errors=>hint_hash}
@@ -1,4 +1,4 @@
1
1
  #coding: utf-8
2
2
  module NsServicePack
3
- VERSION = '0.0.12'
3
+ VERSION = '0.0.13'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ns_service_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-11-17 00:00:00.000000000Z
14
+ date: 2011-11-18 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
- requirement: &76393530 !ruby/object:Gem::Requirement
18
+ requirement: &69140470 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: 3.1.0
24
24
  type: :development
25
25
  prerelease: false
26
- version_requirements: *76393530
26
+ version_requirements: *69140470
27
27
  description: Service package for our service lier
28
28
  email: cao7113@gmail.com
29
29
  executables: []