acfs 0.23.2.b209 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NmE2YWExMjM1ZmVjNmQ5OGQ4MGI1ODE2NDdlMThhOThhYTkyZTY0Nw==
5
- data.tar.gz: !binary |-
6
- ZDRhNjFjZGE1N2EwNDkwZDMwOTE0NTYzZjI4Yjk3NTI1OWFhOWFhZA==
2
+ SHA1:
3
+ metadata.gz: df206319b5c8ed76be17036d7d9aba9fa7be6ee5
4
+ data.tar.gz: 4527b5b268b86c9c97fe4054918e59c893bc8d9c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjI0MTIzYThiNmY1ZGNhZjEzYmU1YmQ1ZTAxYjY3MDI2YjRkZTIwOTBlZDI1
10
- ZGVlMDljNWU4NTE1ODc4YTYxNDczYjQ5MzMwMGE4ZTA3M2Q3MGZlZWM0YzRi
11
- MDE5MTQ4MmY0OWI2ZjE1ODU4YjI4MGRlODcwN2NkNmNmZTRjMTE=
12
- data.tar.gz: !binary |-
13
- YTE5MTg3M2ZjZmFmNjI3MTA4NzY3MGJkZmZjZTFmZmIxNThjZTYxMWU1MTJh
14
- MWU2MjM0ODgyZTNhOTcxMjZiNjM5NTlmODZjYjhlODRkODQ2MDM0MTA0MWEz
15
- N2Q5NzZkNWZjODFhY2Q5NjRhMmY4NzgzMjAwMGU4OWM1ODBhZmE=
6
+ metadata.gz: 1952d07e7558d6989cb781561ac08fede50723723db53f3e976bc803ea1a7f6587791ec2eff46cf702ed01e6dd0c2dbe7e4b281a21535fbc461b63efbffafbbf
7
+ data.tar.gz: a41330102704b7bddf4471e65d58c6840ffeb9456b497f198b9ba824578c4c9e07238b249bd2fc25f2b2bc7510bc114c57f08bc9910b06a8938ed7482defe00c
@@ -4,7 +4,7 @@ rvm:
4
4
  - 2.0.0
5
5
  - 1.9.3
6
6
  - jruby
7
- - rbx
7
+ - rbx-19mode
8
8
  gemfile:
9
9
  - gemfiles/Gemfile.rails-4-0
10
10
  - gemfiles/Gemfile.rails-3-2
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gem 'webmock', '~> 1.7'
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
8
  gem 'coveralls'
9
- gem 'json', '~> 1.8.1'
9
+ gem 'json', '~> 1.7.7'
10
10
 
11
11
  # Doc
12
12
  group :development do
@@ -19,10 +19,6 @@ end
19
19
 
20
20
  # Platform specific development dependencies
21
21
  #
22
- platform :rbx do
23
- gem 'rubysl', '~> 2.0'
24
- gem 'rubinius-coverage'
25
- end
26
22
  gem 'msgpack', platform: :ruby
27
23
  gem 'msgpack-jruby', require: 'msgpack', platform: :jruby
28
24
 
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Coverage Status](https://coveralls.io/repos/jgraichen/acfs/badge.png?branch=master)](https://coveralls.io/r/jgraichen/acfs)
6
6
  [![Code Climate](https://codeclimate.com/github/jgraichen/acfs.png)](https://codeclimate.com/github/jgraichen/acfs)
7
7
  [![Dependency Status](https://gemnasium.com/jgraichen/acfs.png)](https://gemnasium.com/jgraichen/acfs)
8
- [![RubyDoc Documentation](http://b.repl.ca/v1/rubydoc-here-blue.png)](http://rubydoc.info/github/jgraichen/acfs/master/frames)
8
+ [![RubyDoc Documentation](https://raw.github.com/jgraichen/shields/master/rubydoc.png)](http://rubydoc.info/github/jgraichen/acfs/master/frames)
9
9
 
10
10
  Acfs is a library to develop API client libraries for single services within a larger service oriented application.
11
11
 
@@ -22,10 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency 'activemodel', '>= 3.1'
23
23
  spec.add_runtime_dependency 'actionpack', '>= 3.1'
24
24
  spec.add_runtime_dependency 'multi_json'
25
-
26
- # Bundle update w/o version resolves to 0.3.3 ...
27
- spec.add_runtime_dependency 'typhoeus', '>= 0.6.5'
28
-
25
+ spec.add_runtime_dependency 'typhoeus'
29
26
  spec.add_runtime_dependency 'rack'
30
27
 
31
28
  spec.add_development_dependency 'bundler', '~> 1.3'
@@ -18,7 +18,7 @@ module Acfs::Model
18
18
  #
19
19
  class Boolean < Base
20
20
 
21
- TRUE_VALUES = %w(true on yes 1)
21
+ TRUE_VALUES = %w(true on yes)
22
22
 
23
23
  # @api public
24
24
  #
@@ -8,7 +8,6 @@ module Acfs
8
8
  class Operation
9
9
  attr_reader :action, :params, :resource, :data, :callback
10
10
  delegate :service, to: :resource
11
- delegate :call, to: :callback
12
11
 
13
12
  def initialize(resource, action, opts = {}, &block)
14
13
  @resource = resource
@@ -11,10 +11,7 @@ module Acfs
11
11
 
12
12
  def initialize(opts)
13
13
  @opts = opts
14
-
15
- @opts[:with].stringify_keys! if @opts[:with].is_a? Hash
16
- @opts[:return].stringify_keys! if @opts[:return].is_a? Hash
17
- @opts[:return].map! { |h| h.stringify_keys! if h.is_a? Hash } if @opts[:return].is_a? Array
14
+ @opts[:with].stringify_keys! if @opts[:with].respond_to? :stringify_keys
18
15
  end
19
16
 
20
17
  def accept?(op)
@@ -23,7 +20,7 @@ module Acfs
23
20
  params = op.full_params.stringify_keys
24
21
  data = op.data.stringify_keys
25
22
 
26
- opts[:with] == params || data == opts[:with] || (opts[:with].nil? && params.empty? && data.empty?)
23
+ opts[:with] == params || data == opts[:with]
27
24
  end
28
25
 
29
26
  def calls
@@ -41,7 +38,7 @@ module Acfs
41
38
  if (err = opts[:raise])
42
39
  raise_error op, err, opts[:return]
43
40
  elsif (data = opts[:return])
44
- op.call data
41
+ op.callback.call data
45
42
  else
46
43
  raise ArgumentError, 'Unsupported stub.'
47
44
  end
@@ -10,6 +10,10 @@ describe Acfs::Stub do
10
10
 
11
11
  before do
12
12
  Acfs::Stub.allow_requests = false
13
+
14
+ #Acfs::Stub.read(MyUser).with(id: 5).and_return({ id: 5, name: 'John', age: 32 })
15
+ #Acfs::Stub.read(MyUser).with(id: 6).and_raise(:not_found)
16
+ #Acfs::Stub.create(MyUser).with(name: '', age: 12).and_return(:invalid, errors: { name: [ 'must be present ']})
13
17
  end
14
18
 
15
19
  describe '#called?' do
@@ -78,23 +82,6 @@ describe Acfs::Stub do
78
82
  expect { Acfs.run }.to raise_error(Acfs::ResourceNotFound)
79
83
  end
80
84
  end
81
-
82
- context 'with type parameter' do
83
- before do
84
- Acfs::Stub.resource Computer, :read, with: { id: 1 }, return: { id: 1, type: 'PC' }
85
- Acfs::Stub.resource Computer, :read, with: { id: 2 }, return: { id: 2, type: 'Mac' }
86
- end
87
-
88
- it 'should create inherited type' do
89
- pc = Computer.find 1
90
- mac = Computer.find 2
91
-
92
- Acfs.run
93
-
94
- expect(pc).to be_a PC
95
- expect(mac).to be_a Mac
96
- end
97
- end
98
85
  end
99
86
 
100
87
  context 'with create action' do
@@ -117,45 +104,6 @@ describe Acfs::Stub do
117
104
  end
118
105
  end
119
106
 
120
- context 'with list action' do
121
- before do
122
- Acfs::Stub.resource MyUser, :list,
123
- return: [{ id: 1, name: 'John Smith', age: 32 }, { id: 2, name: 'Anon', age: 12 }]
124
- end
125
-
126
- it 'should return collection' do
127
- users = MyUser.all
128
- Acfs.run
129
-
130
- expect(users).to have(2).items
131
- end
132
-
133
- it 'should return defined resources' do
134
- users = MyUser.all
135
- Acfs.run
136
-
137
- expect(users[0].id).to eq 1
138
- expect(users[1].id).to eq 2
139
- expect(users[0].name).to eq 'John Smith'
140
- expect(users[1].name).to eq 'Anon'
141
- end
142
-
143
- context 'with type parameter' do
144
- before do
145
- Acfs::Stub.resource Computer, :list,
146
- return: [{id: 1, type: 'PC'}, {id: 2, type: 'Mac'}]
147
- end
148
-
149
- it 'should create inherited type' do
150
- computers = Computer.all
151
- Acfs.run
152
-
153
- expect(computers.first).to be_a PC
154
- expect(computers.last).to be_a Mac
155
- end
156
- end
157
- end
158
-
159
107
  context 'with update action' do
160
108
  before do
161
109
  Acfs::Stub.resource MyUser, :read, with: { id: 1 }, return: { id: 1, name: 'John Smith', age: 32 }
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.2.b209
4
+ version: 0.23.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-29 00:00:00.000000000 Z
11
+ date: 2013-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: actionpack
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: multi_json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: typhoeus
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.6.5
75
+ version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.6.5
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rack
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
@@ -179,7 +179,6 @@ files:
179
179
  - spec/acfs/configuration_spec.rb
180
180
  - spec/acfs/middleware/json_decoder_spec.rb
181
181
  - spec/acfs/middleware/msgpack_decoder_spec.rb
182
- - spec/acfs/model/attributes/boolean_spec.rb
183
182
  - spec/acfs/model/attributes/date_time_spec.rb
184
183
  - spec/acfs/model/attributes/float_spec.rb
185
184
  - spec/acfs/model/attributes/list_spec.rb
@@ -213,17 +212,17 @@ require_paths:
213
212
  - lib
214
213
  required_ruby_version: !ruby/object:Gem::Requirement
215
214
  requirements:
216
- - - ! '>='
215
+ - - '>='
217
216
  - !ruby/object:Gem::Version
218
217
  version: '0'
219
218
  required_rubygems_version: !ruby/object:Gem::Requirement
220
219
  requirements:
221
- - - ! '>'
220
+ - - '>='
222
221
  - !ruby/object:Gem::Version
223
- version: 1.3.1
222
+ version: '0'
224
223
  requirements: []
225
224
  rubyforge_project:
226
- rubygems_version: 2.1.11
225
+ rubygems_version: 2.0.3
227
226
  signing_key:
228
227
  specification_version: 4
229
228
  summary: An abstract API base client for service oriented application.
@@ -231,7 +230,6 @@ test_files:
231
230
  - spec/acfs/configuration_spec.rb
232
231
  - spec/acfs/middleware/json_decoder_spec.rb
233
232
  - spec/acfs/middleware/msgpack_decoder_spec.rb
234
- - spec/acfs/model/attributes/boolean_spec.rb
235
233
  - spec/acfs/model/attributes/date_time_spec.rb
236
234
  - spec/acfs/model/attributes/float_spec.rb
237
235
  - spec/acfs/model/attributes/list_spec.rb
@@ -255,3 +253,4 @@ test_files:
255
253
  - spec/spec_helper.rb
256
254
  - spec/support/response.rb
257
255
  - spec/support/service.rb
256
+ has_rdoc:
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Acfs::Model::Attributes::Boolean do
4
- subject { Acfs::Model::Attributes::Boolean.new }
5
-
6
- describe 'cast' do
7
- it 'should preserve boolean values' do
8
- expect(subject.cast(false)).to eq false
9
- expect(subject.cast(true)).to eq true
10
- end
11
-
12
- it 'should cast TRUE_VALUES to true' do
13
- expect(subject.cast('yes')).to eq true
14
- expect(subject.cast('on')).to eq true
15
- expect(subject.cast('true')).to eq true
16
- expect(subject.cast('1')).to eq true
17
- end
18
-
19
- it 'should cast any other value to false' do
20
- expect(subject.cast('')).to eq false
21
- expect(subject.cast('wrong')).to eq false
22
- expect(subject.cast('random')).to eq false
23
- end
24
- end
25
- end