api_client 0.5.13 → 0.5.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA512:
3
- metadata.gz: 2e42b7b564b5052cfc4f16c402ed50c5799863466e80fff627b0c4941ac190aa5163698f53b1cc6213b2a5cf1d243806eb90b12408731b695434471e81f74b9e
4
- data.tar.gz: b0753a40feb22f1db2511a8ad4c7266de5ebd9fdf1faf04a617b47e0cf742edec024efeffaae6a449f34fb6e72fda44b283969af2b2d04d7cc7d5218d7fb29eb
5
- SHA1:
6
- metadata.gz: 8e6ba65ec2ce249765942b32529d15d47c83f6be
7
- data.tar.gz: 4ad33db01a65a8801882904b233069a5c09615ae
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c6fe2e3701dfb92512d2b7ea531ed439f81fbcad
4
+ data.tar.gz: 5873bdb59a8f035466162c7c490e4939ec155202
5
+ SHA512:
6
+ metadata.gz: 01e91759d90084b309ebd11fa74fbe3f7b300a257912e433f96723c81b06371d337c4f261a742148370a147e56e618ccdadd85f76c23726334564a7551c1d539
7
+ data.tar.gz: a4c648946d64c325b3bf74e5db7ff889d2086ca108033caf31034cd9aa3db31918501e57a54e9f1d81ac129e23f11f2165bc50e403e8368f6861056d33b9568a
data/.travis.yml CHANGED
@@ -1,7 +1,9 @@
1
1
  language: ruby
2
+ before_install:
3
+ - gem install bundler -v 1.11.2
2
4
  script: bundle exec rspec spec
3
5
  rvm:
4
6
  - 1.8.7
5
7
  - 1.9.3
6
- - 2.0.0
7
- - 2.1.2
8
+ - 2.1.8
9
+ - 2.3.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.5.14
2
+
3
+ * make ApiClient::Base marshallable by not storing proc as instance var
4
+
1
5
  # 0.5.13
2
6
 
3
7
  * add raw_body method to Scope which allows to set non-hash request payload
data/api_client.gemspec CHANGED
@@ -13,42 +13,36 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = "api_client"
15
15
 
16
+ # Declare runtime dependencies here:
17
+ def s.add_runtime_dependencies(method)
18
+ if RUBY_PLATFORM == "java"
19
+ send method, 'json_pure'
20
+ send method, 'hashie', [">= 2.0.5"]
21
+ else
22
+ send method, 'yajl-ruby'
23
+ send method, 'hashie', RUBY_VERSION =~ /1\.8/ ? [">= 2.0.5", "<= 3.4.2"] : [">= 2.0.5"]
24
+ end
25
+
26
+ send method, 'faraday', [">= 0.8.1"]
27
+ send method, 'multi_json', [">= 1.6.1"]
28
+ end
29
+
30
+ # Declare development dependencies here:
31
+ s.add_development_dependency 'rspec', '2.14.1'
32
+
16
33
  if s.respond_to? :specification_version then
17
34
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
18
35
  s.specification_version = 3
19
36
 
20
37
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
21
- if RUBY_PLATFORM == "java"
22
- s.add_runtime_dependency(%q<json_pure>)
23
- else
24
- s.add_runtime_dependency(%q<yajl-ruby>)
25
- end
26
- s.add_runtime_dependency(%q<faraday>, [">= 0.8.1"])
27
- s.add_runtime_dependency(%q<hashie>, [">= 2.0.5"])
28
- s.add_runtime_dependency(%q<multi_json>, [">= 1.6.1"])
38
+ s.add_runtime_dependencies(:add_runtime_dependency)
29
39
  else
30
- if RUBY_PLATFORM == "java"
31
- s.add_dependency(%q<json_pure>)
32
- else
33
- s.add_dependency(%q<yajl-ruby>)
34
- end
35
- s.add_dependency(%q<faraday>, [">= 0.8.1"])
36
- s.add_dependency(%q<hashie>, [">= 1.2.0"])
37
- s.add_dependency(%q<multi_json>, [">= 1.6.1"])
40
+ s.add_runtime_dependencies(:add_dependency)
38
41
  end
39
42
  else
40
- if RUBY_PLATFORM == "java"
41
- s.add_dependency(%q<json_pure>)
42
- else
43
- s.add_dependency(%q<yajl-ruby>)
44
- end
45
- s.add_dependency(%q<faraday>, [">= 0.8.1"])
46
- s.add_dependency(%q<hashie>, [">= 1.2.0"])
47
- s.add_dependency(%q<multi_json>, [">= 1.6.1"])
43
+ s.add_runtime_dependencies(:add_dependency)
48
44
  end
49
45
 
50
- s.add_development_dependency "rspec", '2.14.1'
51
-
52
46
  s.files = `git ls-files`.split("\n")
53
47
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
54
48
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -15,7 +15,6 @@ module ApiClient
15
15
  @params = {}
16
16
  @headers = {}
17
17
  @options = {}
18
- @hooks = @scopeable.connection_hooks || []
19
18
  @scopeable.default_scopes.each do |default_scope|
20
19
  self.instance_eval(&default_scope)
21
20
  end
@@ -24,7 +23,8 @@ module ApiClient
24
23
  def connection
25
24
  klass = Connection.const_get((@adapter || Connection.default).to_s.capitalize)
26
25
  @connection = klass.new(@endpoint , @options || {})
27
- @hooks.each { |hook| hook.call(@connection) }
26
+ hooks = @scopeable.connection_hooks || []
27
+ hooks.each { |hook| hook.call(@connection) }
28
28
  @connection
29
29
  end
30
30
 
@@ -1,3 +1,3 @@
1
1
  module ApiClient
2
- VERSION = "0.5.13"
2
+ VERSION = "0.5.14"
3
3
  end
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+
3
+ describe "Marshaling of ApiClient objects" do
4
+ ConnectionProc = Proc.new {}
5
+ AlwaysProc = Proc.new {}
6
+
7
+ class Entity < ApiClient::Base
8
+ connection &ConnectionProc
9
+ always &AlwaysProc
10
+
11
+ def mutated_state?
12
+ @state == "mutated"
13
+ end
14
+
15
+ def mutate_state!
16
+ @state = "mutated"
17
+ end
18
+ end
19
+
20
+ it "is marshallable by default" do
21
+ scope = Entity.params(:foo => 1).headers("token" => "aaa").options("some" => "option")
22
+ entity = scope.build :key => "value"
23
+
24
+ entity.mutated_state?.should == false
25
+ entity.mutate_state!
26
+ entity.mutated_state?.should == true
27
+
28
+ reloaded = Marshal.load(Marshal.dump(entity))
29
+
30
+ reloaded.should == entity
31
+ reloaded.mutated_state?.should == true
32
+ end
33
+ end
metadata CHANGED
@@ -1,80 +1,95 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: api_client
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.13
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.14
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Marcin Bunsch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2016-03-14 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: yajl-ruby
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.14.1
20
+ type: :development
16
21
  prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
19
- - &id006
20
- - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.14.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: yajl-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
23
34
  type: :runtime
24
- version_requirements: *id001
25
- - !ruby/object:Gem::Dependency
26
- name: faraday
27
35
  prerelease: false
28
- requirement: &id002 !ruby/object:Gem::Requirement
29
- requirements:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
30
38
  - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.8.1
33
- type: :runtime
34
- version_requirements: *id002
35
- - !ruby/object:Gem::Dependency
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
36
42
  name: hashie
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.5
48
+ type: :runtime
37
49
  prerelease: false
38
- requirement: &id003 !ruby/object:Gem::Requirement
39
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
40
52
  - - ">="
41
- - !ruby/object:Gem::Version
53
+ - !ruby/object:Gem::Version
42
54
  version: 2.0.5
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.1
43
62
  type: :runtime
44
- version_requirements: *id003
45
- - !ruby/object:Gem::Dependency
46
- name: multi_json
47
63
  prerelease: false
48
- requirement: &id004 !ruby/object:Gem::Requirement
49
- requirements:
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: multi_json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
50
73
  - - ">="
51
- - !ruby/object:Gem::Version
74
+ - !ruby/object:Gem::Version
52
75
  version: 1.6.1
53
76
  type: :runtime
54
- version_requirements: *id004
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
77
  prerelease: false
58
- requirement: &id005 !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "="
61
- - !ruby/object:Gem::Version
62
- version: 2.14.1
63
- type: :development
64
- version_requirements: *id005
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.6.1
65
83
  description: API client builder
66
- email:
84
+ email:
67
85
  - marcin@futuresimple.com
68
86
  executables: []
69
-
70
87
  extensions: []
71
-
72
88
  extra_rdoc_files: []
73
-
74
- files:
75
- - .gitignore
76
- - .rspec
77
- - .travis.yml
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
78
93
  - CHANGELOG.md
79
94
  - Gemfile
80
95
  - LICENSE
@@ -114,6 +129,7 @@ files:
114
129
  - spec/api_client/base/delegation_spec.rb
115
130
  - spec/api_client/base/inheritance_spec.rb
116
131
  - spec/api_client/base/instantiation_spec.rb
132
+ - spec/api_client/base/marshalling_spec.rb
117
133
  - spec/api_client/base/parsing_spec.rb
118
134
  - spec/api_client/base/scoping_spec.rb
119
135
  - spec/api_client/base_spec.rb
@@ -133,32 +149,33 @@ files:
133
149
  - spec/support/matchers.rb
134
150
  homepage: https://github.com/futuresimple/api_client
135
151
  licenses: []
136
-
137
152
  metadata: {}
138
-
139
153
  post_install_message:
140
154
  rdoc_options: []
141
-
142
- require_paths:
155
+ require_paths:
143
156
  - lib
144
- required_ruby_version: !ruby/object:Gem::Requirement
145
- requirements:
146
- - *id006
147
- required_rubygems_version: !ruby/object:Gem::Requirement
148
- requirements:
149
- - *id006
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
150
167
  requirements: []
151
-
152
168
  rubyforge_project: api_client
153
- rubygems_version: 2.4.5
169
+ rubygems_version: 2.6.2
154
170
  signing_key:
155
171
  specification_version: 3
156
172
  summary: API client builder
157
- test_files:
173
+ test_files:
158
174
  - spec/api_client/base/connection_hook_spec.rb
159
175
  - spec/api_client/base/delegation_spec.rb
160
176
  - spec/api_client/base/inheritance_spec.rb
161
177
  - spec/api_client/base/instantiation_spec.rb
178
+ - spec/api_client/base/marshalling_spec.rb
162
179
  - spec/api_client/base/parsing_spec.rb
163
180
  - spec/api_client/base/scoping_spec.rb
164
181
  - spec/api_client/base_spec.rb