api_client 0.5.24-java → 0.5.25-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/api_client/base.rb +77 -0
  4. data/lib/api_client/connection/abstract.rb +81 -0
  5. data/lib/api_client/connection/basic.rb +129 -0
  6. data/lib/api_client/connection/json.rb +14 -0
  7. data/lib/api_client/connection/middlewares/request/json.rb +34 -0
  8. data/lib/api_client/connection/middlewares/request/logger.rb +64 -0
  9. data/lib/api_client/connection/middlewares/request/oauth.rb +22 -0
  10. data/lib/api_client/connection/oauth.rb +18 -0
  11. data/lib/api_client/errors.rb +31 -0
  12. data/lib/api_client/mixins/configuration.rb +24 -0
  13. data/lib/api_client/mixins/connection_hooks.rb +24 -0
  14. data/lib/api_client/mixins/delegation.rb +23 -0
  15. data/lib/api_client/mixins/inheritance.rb +19 -0
  16. data/lib/api_client/mixins/instantiation.rb +29 -0
  17. data/lib/api_client/mixins/scoping.rb +49 -0
  18. data/lib/api_client/resource/base.rb +67 -0
  19. data/lib/api_client/resource/name_resolver.rb +37 -0
  20. data/lib/api_client/resource/scope.rb +73 -0
  21. data/lib/api_client/scope.rb +125 -0
  22. data/lib/api_client/utils.rb +18 -0
  23. data/lib/api_client/version.rb +3 -0
  24. data/spec/api_client/base/connection_hook_spec.rb +18 -0
  25. data/spec/api_client/base/delegation_spec.rb +15 -0
  26. data/spec/api_client/base/inheritance_spec.rb +44 -0
  27. data/spec/api_client/base/instantiation_spec.rb +55 -0
  28. data/spec/api_client/base/marshalling_spec.rb +33 -0
  29. data/spec/api_client/base/parsing_spec.rb +38 -0
  30. data/spec/api_client/base/scoping_spec.rb +60 -0
  31. data/spec/api_client/base_spec.rb +107 -0
  32. data/spec/api_client/connection/abstract_spec.rb +21 -0
  33. data/spec/api_client/connection/basic_spec.rb +191 -0
  34. data/spec/api_client/connection/oauth_spec.rb +27 -0
  35. data/spec/api_client/connection/request/json_spec.rb +30 -0
  36. data/spec/api_client/connection/request/logger_spec.rb +18 -0
  37. data/spec/api_client/connection/request/oauth_spec.rb +26 -0
  38. data/spec/api_client/resource/base_spec.rb +97 -0
  39. data/spec/api_client/resource/name_spec.rb +19 -0
  40. data/spec/api_client/resource/scope_spec.rb +122 -0
  41. data/spec/api_client/scope_spec.rb +204 -0
  42. data/spec/api_client/utils_spec.rb +32 -0
  43. data/spec/support/matchers.rb +5 -0
  44. metadata +62 -1
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ describe ApiClient::Utils do
4
+
5
+ describe '.deep_merge' do
6
+
7
+ it "merges two hashes updating the first one" do
8
+ hash_a = { :a => 1, :b => 2 }
9
+ hash_b = { :b => 3, :c => 45 }
10
+ ApiClient::Utils.deep_merge hash_a, hash_b
11
+ hash_a.should == { :a => 1, :b => 3, :c=>45 }
12
+ hash_b.should == { :b => 3, :c => 45 }
13
+ end
14
+
15
+ it "deeply merges two hashes recursively" do
16
+ hash_a = { :a => { :foo => 2, :boo => { :wat => 'wat' } }, :b => 2 }
17
+ hash_b = { :b => 3, :c => 45, :a => { :boo => { :wat => "WAT????" } } }
18
+ ApiClient::Utils.deep_merge hash_a, hash_b
19
+ hash_a.should == { :a => { :foo => 2, :boo => { :wat => 'WAT????' } }, :b => 3, :c => 45 }
20
+ end
21
+
22
+ it "require correct key type" do
23
+ hash_a = { :a => 1 }
24
+ hash_b = { 'a' => 2 }
25
+ ApiClient::Utils.deep_merge hash_a, hash_b
26
+ hash_a.should == { :a => 1, 'a' => 2 }
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
@@ -0,0 +1,5 @@
1
+ RSpec::Matchers.define :inherit_from do |parent|
2
+ match do |klass|
3
+ klass.ancestors.include?(parent)
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.24
4
+ version: 0.5.25
5
5
  platform: java
6
6
  authors:
7
7
  - Zendesk
@@ -100,7 +100,48 @@ files:
100
100
  - README.md
101
101
  - Rakefile
102
102
  - lib/api_client.rb
103
+ - lib/api_client/base.rb
104
+ - lib/api_client/connection/abstract.rb
105
+ - lib/api_client/connection/basic.rb
106
+ - lib/api_client/connection/json.rb
107
+ - lib/api_client/connection/middlewares/request/json.rb
108
+ - lib/api_client/connection/middlewares/request/logger.rb
109
+ - lib/api_client/connection/middlewares/request/oauth.rb
110
+ - lib/api_client/connection/oauth.rb
111
+ - lib/api_client/errors.rb
112
+ - lib/api_client/mixins/configuration.rb
113
+ - lib/api_client/mixins/connection_hooks.rb
114
+ - lib/api_client/mixins/delegation.rb
115
+ - lib/api_client/mixins/inheritance.rb
116
+ - lib/api_client/mixins/instantiation.rb
117
+ - lib/api_client/mixins/scoping.rb
118
+ - lib/api_client/resource/base.rb
119
+ - lib/api_client/resource/name_resolver.rb
120
+ - lib/api_client/resource/scope.rb
121
+ - lib/api_client/scope.rb
122
+ - lib/api_client/utils.rb
123
+ - lib/api_client/version.rb
124
+ - spec/api_client/base/connection_hook_spec.rb
125
+ - spec/api_client/base/delegation_spec.rb
126
+ - spec/api_client/base/inheritance_spec.rb
127
+ - spec/api_client/base/instantiation_spec.rb
128
+ - spec/api_client/base/marshalling_spec.rb
129
+ - spec/api_client/base/parsing_spec.rb
130
+ - spec/api_client/base/scoping_spec.rb
131
+ - spec/api_client/base_spec.rb
132
+ - spec/api_client/connection/abstract_spec.rb
133
+ - spec/api_client/connection/basic_spec.rb
134
+ - spec/api_client/connection/oauth_spec.rb
135
+ - spec/api_client/connection/request/json_spec.rb
136
+ - spec/api_client/connection/request/logger_spec.rb
137
+ - spec/api_client/connection/request/oauth_spec.rb
138
+ - spec/api_client/resource/base_spec.rb
139
+ - spec/api_client/resource/name_spec.rb
140
+ - spec/api_client/resource/scope_spec.rb
141
+ - spec/api_client/scope_spec.rb
142
+ - spec/api_client/utils_spec.rb
103
143
  - spec/spec_helper.rb
144
+ - spec/support/matchers.rb
104
145
  homepage: https://github.com/futuresimple/api_client
105
146
  licenses:
106
147
  - Apache License Version 2.0
@@ -126,3 +167,23 @@ specification_version: 3
126
167
  summary: API client builder
127
168
  test_files:
128
169
  - spec/spec_helper.rb
170
+ - spec/support/matchers.rb
171
+ - spec/api_client/utils_spec.rb
172
+ - spec/api_client/scope_spec.rb
173
+ - spec/api_client/base_spec.rb
174
+ - spec/api_client/resource/name_spec.rb
175
+ - spec/api_client/resource/scope_spec.rb
176
+ - spec/api_client/resource/base_spec.rb
177
+ - spec/api_client/connection/basic_spec.rb
178
+ - spec/api_client/connection/abstract_spec.rb
179
+ - spec/api_client/connection/oauth_spec.rb
180
+ - spec/api_client/connection/request/logger_spec.rb
181
+ - spec/api_client/connection/request/json_spec.rb
182
+ - spec/api_client/connection/request/oauth_spec.rb
183
+ - spec/api_client/base/scoping_spec.rb
184
+ - spec/api_client/base/inheritance_spec.rb
185
+ - spec/api_client/base/instantiation_spec.rb
186
+ - spec/api_client/base/connection_hook_spec.rb
187
+ - spec/api_client/base/marshalling_spec.rb
188
+ - spec/api_client/base/parsing_spec.rb
189
+ - spec/api_client/base/delegation_spec.rb