reply 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ source "http://rubygems.org"
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
9
  gem 'rspec'
10
+ gem 'guard-rspec'
10
11
  gem "rdoc", "~> 3.12"
11
12
  gem "bundler", "~> 1.0"
12
13
  gem "jeweler", "~> 1.8.7"
@@ -16,9 +16,12 @@ GEM
16
16
  addressable (2.3.5)
17
17
  atomic (1.1.14)
18
18
  builder (3.1.4)
19
+ coderay (1.0.9)
19
20
  diff-lcs (1.2.4)
20
21
  faraday (0.8.8)
21
22
  multipart-post (~> 1.2.0)
23
+ ffi (1.9.0)
24
+ formatador (0.2.4)
22
25
  git (1.2.6)
23
26
  github_api (0.10.1)
24
27
  addressable
@@ -27,6 +30,15 @@ GEM
27
30
  multi_json (~> 1.4)
28
31
  nokogiri (~> 1.5.2)
29
32
  oauth2
33
+ guard (1.8.3)
34
+ formatador (>= 0.2.4)
35
+ listen (~> 1.3)
36
+ lumberjack (>= 1.0.2)
37
+ pry (>= 0.9.10)
38
+ thor (>= 0.14.6)
39
+ guard-rspec (3.1.0)
40
+ guard (>= 1.8)
41
+ rspec (~> 2.13)
30
42
  hashie (2.0.5)
31
43
  highline (1.6.19)
32
44
  httpauth (0.2.0)
@@ -43,6 +55,12 @@ GEM
43
55
  json (1.8.0)
44
56
  jwt (0.1.8)
45
57
  multi_json (>= 1.5)
58
+ listen (1.3.1)
59
+ rb-fsevent (>= 0.9.3)
60
+ rb-inotify (>= 0.9)
61
+ rb-kqueue (>= 0.2)
62
+ lumberjack (1.0.4)
63
+ method_source (0.8.2)
46
64
  minitest (4.7.5)
47
65
  multi_json (1.8.0)
48
66
  multi_xml (0.5.5)
@@ -55,8 +73,17 @@ GEM
55
73
  multi_json (~> 1.0)
56
74
  multi_xml (~> 0.5)
57
75
  rack (~> 1.2)
76
+ pry (0.9.12.2)
77
+ coderay (~> 1.0.5)
78
+ method_source (~> 0.8)
79
+ slop (~> 3.4)
58
80
  rack (1.5.2)
59
81
  rake (10.1.0)
82
+ rb-fsevent (0.9.3)
83
+ rb-inotify (0.9.2)
84
+ ffi (>= 0.5.0)
85
+ rb-kqueue (0.2.0)
86
+ ffi (>= 0.5.0)
60
87
  rdoc (3.12.2)
61
88
  json (~> 1.4)
62
89
  rspec (2.14.1)
@@ -67,6 +94,8 @@ GEM
67
94
  rspec-expectations (2.14.3)
68
95
  diff-lcs (>= 1.1.3, < 2.0)
69
96
  rspec-mocks (2.14.3)
97
+ slop (3.4.6)
98
+ thor (0.18.1)
70
99
  thread_safe (0.1.3)
71
100
  atomic
72
101
  tzinfo (0.3.37)
@@ -77,6 +106,7 @@ PLATFORMS
77
106
  DEPENDENCIES
78
107
  active_attr (~> 0.8)
79
108
  bundler (~> 1.0)
109
+ guard-rspec
80
110
  jeweler (~> 1.8.7)
81
111
  rdoc (~> 3.12)
82
112
  rspec
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
9
+
data/Rakefile CHANGED
@@ -25,12 +25,8 @@ Jeweler::Tasks.new do |gem|
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
27
27
 
28
- require 'rake/testtask'
29
- Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/test_*.rb'
32
- test.verbose = true
33
- end
28
+ require 'rspec/core/rake_task'
29
+ RSpec::Core::RakeTask.new(:spec)
34
30
 
35
31
  # require 'rcov/rcovtask'
36
32
  # Rcov::RcovTask.new do |test|
@@ -40,14 +36,14 @@ end
40
36
  # test.rcov_opts << '--exclude "gems/*"'
41
37
  # end
42
38
 
43
- task :default => :test
39
+ task :default => :spec
44
40
 
45
- require 'rdoc/task'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+ # require 'rdoc/task'
42
+ # Rake::RDocTask.new do |rdoc|
43
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
44
 
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "reply #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
53
- end
45
+ # rdoc.rdoc_dir = 'rdoc'
46
+ # rdoc.title = "reply #{version}"
47
+ # rdoc.rdoc_files.include('README*')
48
+ # rdoc.rdoc_files.include('lib/**/*.rb')
49
+ # end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -1,5 +1,5 @@
1
1
  class Reply
2
- attr_accessor :status, :messages, :data
2
+ attr_accessor :status, :code, :messages, :data
3
3
 
4
4
  STATUS_ERROR = 0
5
5
  STATUS_SUCCESS = 1
@@ -9,6 +9,7 @@ class Reply
9
9
  @messages = params[:messages] || []
10
10
  @status = params[:status] || STATUS_SUCCESS
11
11
  @data = params[:data] || {}
12
+ @code = params[:code] || nil
12
13
  end
13
14
 
14
15
  def clear_messages
@@ -0,0 +1,49 @@
1
+ Reply
2
+ ======
3
+
4
+ A simple class used to encapsulate the reply from a service
5
+
6
+ [![Build Status](https://travis-ci.org/sporto/reply.png)](https://travis-ci.org/sporto/reply)
7
+
8
+ Usage
9
+ -----
10
+
11
+ ```ruby
12
+ reply = Reply.new
13
+
14
+ # add message
15
+ reply.add_message("Something")
16
+
17
+ # add multiple messages
18
+ reply.add_messages(["x", "y"])
19
+
20
+ # mark the reply as succesful (this is the default)
21
+ reply.success!
22
+
23
+ # mark as warning
24
+ reply.warning!
25
+
26
+ # mark as error
27
+ reply.error!
28
+
29
+ # add error message and mark as error at the same time
30
+ reply.add_error("Something bad happend")
31
+
32
+ # add erroor messages and mark as error
33
+ reply.add_error(["Error 1", "Error 2"])
34
+
35
+ # check if reply was successful
36
+ reply.successful?
37
+ reply.success?
38
+
39
+ # check if reply was unsuccessful
40
+ reply.error?
41
+ reply.failure?
42
+
43
+ # add some data to the reply
44
+ reply.data = something
45
+ ```
46
+
47
+ Copyright
48
+ ---------
49
+ Copyright © 2013 Sebastian Porto. See LICENSE.txt for further details.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "reply"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sebastian Porto"]
@@ -13,20 +13,21 @@ Gem::Specification.new do |s|
13
13
  s.description = "An standarized reply object"
14
14
  s.email = "s@porto5.com"
15
15
  s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
16
+ "LICENSE.txt"
18
17
  ]
19
18
  s.files = [
20
19
  ".document",
21
20
  ".rspec",
21
+ ".travis.yml",
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
+ "Guardfile",
24
25
  "LICENSE.txt",
25
- "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "lib/reply.rb",
29
29
  "lib/reply/reply.rb",
30
+ "readme.md",
30
31
  "reply.gemspec",
31
32
  "spec/lib/reply/reply_spec.rb",
32
33
  "spec/spec_helper.rb",
@@ -36,7 +37,7 @@ Gem::Specification.new do |s|
36
37
  s.homepage = "http://github.com/sporto/reply"
37
38
  s.licenses = ["MIT"]
38
39
  s.require_paths = ["lib"]
39
- s.rubygems_version = "1.8.25"
40
+ s.rubygems_version = "1.8.17"
40
41
  s.summary = "An standarized reply object"
41
42
 
42
43
  if s.respond_to? :specification_version then
@@ -44,12 +45,14 @@ Gem::Specification.new do |s|
44
45
 
45
46
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
47
  s.add_development_dependency(%q<rspec>, [">= 0"])
48
+ s.add_development_dependency(%q<guard-rspec>, [">= 0"])
47
49
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
48
50
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
49
51
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
50
52
  s.add_development_dependency(%q<active_attr>, ["~> 0.8"])
51
53
  else
52
54
  s.add_dependency(%q<rspec>, [">= 0"])
55
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
53
56
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
54
57
  s.add_dependency(%q<bundler>, ["~> 1.0"])
55
58
  s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
@@ -57,6 +60,7 @@ Gem::Specification.new do |s|
57
60
  end
58
61
  else
59
62
  s.add_dependency(%q<rspec>, [">= 0"])
63
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
60
64
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
61
65
  s.add_dependency(%q<bundler>, ["~> 1.0"])
62
66
  s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &2152636520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
24
+ version_requirements: *2152636520
25
+ - !ruby/object:Gem::Dependency
26
+ name: guard-rspec
27
+ requirement: &2152635460 !ruby/object:Gem::Requirement
25
28
  none: false
26
29
  requirements:
27
30
  - - ! '>='
28
31
  - !ruby/object:Gem::Version
29
32
  version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2152635460
30
36
  - !ruby/object:Gem::Dependency
31
37
  name: rdoc
32
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &2152650400 !ruby/object:Gem::Requirement
33
39
  none: false
34
40
  requirements:
35
41
  - - ~>
@@ -37,15 +43,10 @@ dependencies:
37
43
  version: '3.12'
38
44
  type: :development
39
45
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '3.12'
46
+ version_requirements: *2152650400
46
47
  - !ruby/object:Gem::Dependency
47
48
  name: bundler
48
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &2152649400 !ruby/object:Gem::Requirement
49
50
  none: false
50
51
  requirements:
51
52
  - - ~>
@@ -53,15 +54,10 @@ dependencies:
53
54
  version: '1.0'
54
55
  type: :development
55
56
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
57
+ version_requirements: *2152649400
62
58
  - !ruby/object:Gem::Dependency
63
59
  name: jeweler
64
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &2152648800 !ruby/object:Gem::Requirement
65
61
  none: false
66
62
  requirements:
67
63
  - - ~>
@@ -69,15 +65,10 @@ dependencies:
69
65
  version: 1.8.7
70
66
  type: :development
71
67
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 1.8.7
68
+ version_requirements: *2152648800
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: active_attr
80
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &2152648080 !ruby/object:Gem::Requirement
81
72
  none: false
82
73
  requirements:
83
74
  - - ~>
@@ -85,30 +76,26 @@ dependencies:
85
76
  version: '0.8'
86
77
  type: :development
87
78
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: '0.8'
79
+ version_requirements: *2152648080
94
80
  description: An standarized reply object
95
81
  email: s@porto5.com
96
82
  executables: []
97
83
  extensions: []
98
84
  extra_rdoc_files:
99
85
  - LICENSE.txt
100
- - README.rdoc
101
86
  files:
102
87
  - .document
103
88
  - .rspec
89
+ - .travis.yml
104
90
  - Gemfile
105
91
  - Gemfile.lock
92
+ - Guardfile
106
93
  - LICENSE.txt
107
- - README.rdoc
108
94
  - Rakefile
109
95
  - VERSION
110
96
  - lib/reply.rb
111
97
  - lib/reply/reply.rb
98
+ - readme.md
112
99
  - reply.gemspec
113
100
  - spec/lib/reply/reply_spec.rb
114
101
  - spec/spec_helper.rb
@@ -129,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
116
  version: '0'
130
117
  segments:
131
118
  - 0
132
- hash: 510463183428051726
119
+ hash: 204553621348656513
133
120
  required_rubygems_version: !ruby/object:Gem::Requirement
134
121
  none: false
135
122
  requirements:
@@ -138,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
125
  version: '0'
139
126
  requirements: []
140
127
  rubyforge_project:
141
- rubygems_version: 1.8.25
128
+ rubygems_version: 1.8.17
142
129
  signing_key:
143
130
  specification_version: 3
144
131
  summary: An standarized reply object
@@ -1,19 +0,0 @@
1
- = reply
2
-
3
- Description goes here.
4
-
5
- == Contributing to reply
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2013 Sebastian. See LICENSE.txt for
18
- further details.
19
-