api_struct 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +14 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +105 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +203 -0
  10. data/Rakefile +6 -0
  11. data/api_struct.gemspec +34 -0
  12. data/api_struct.svg +1 -0
  13. data/bin/console +14 -0
  14. data/bin/setup +8 -0
  15. data/circle.yml +3 -0
  16. data/lib/api_struct.rb +19 -0
  17. data/lib/api_struct/client.rb +86 -0
  18. data/lib/api_struct/collection.rb +19 -0
  19. data/lib/api_struct/concerns/underscore.rb +11 -0
  20. data/lib/api_struct/entity.rb +84 -0
  21. data/lib/api_struct/errors/client.rb +41 -0
  22. data/lib/api_struct/errors/entity.rb +7 -0
  23. data/lib/api_struct/extensions/api_client.rb +43 -0
  24. data/lib/api_struct/extensions/dry_monads.rb +18 -0
  25. data/lib/api_struct/settings.rb +7 -0
  26. data/lib/api_struct/version.rb +3 -0
  27. data/spec/api_struct/client_spec.rb +118 -0
  28. data/spec/api_struct/entity_spec.rb +185 -0
  29. data/spec/fixtures/cassettes/posts/1.yml +73 -0
  30. data/spec/fixtures/cassettes/posts/index_success.yml +1335 -0
  31. data/spec/fixtures/cassettes/posts/show_failure.yml +67 -0
  32. data/spec/fixtures/cassettes/posts/show_success.yml +73 -0
  33. data/spec/fixtures/cassettes/posts/suffix.yml +73 -0
  34. data/spec/fixtures/cassettes/posts/update_success.yml +71 -0
  35. data/spec/fixtures/cassettes/todos.yml +143 -0
  36. data/spec/fixtures/cassettes/users/1/posts.yml +1049 -0
  37. data/spec/fixtures/cassettes/users/1/posts/1.yml +797 -0
  38. data/spec/spec_helper.rb +25 -0
  39. data/spec/support/stub.rb +9 -0
  40. metadata +272 -0
@@ -0,0 +1,25 @@
1
+ require 'bundler/setup'
2
+ require 'api_struct'
3
+ require 'vcr'
4
+ require 'webmock/rspec'
5
+ require 'ffaker'
6
+
7
+ Dir[File.expand_path('spec/support/**/*.rb')].each { |file| require file }
8
+
9
+ WebMock.disable_net_connect!(allow_localhost: true)
10
+
11
+ VCR.configure do |config|
12
+ config.cassette_library_dir = 'spec/fixtures/cassettes'
13
+ config.default_cassette_options = { record: :new_episodes }
14
+ config.hook_into :webmock
15
+ config.configure_rspec_metadata!
16
+ end
17
+
18
+ RSpec.configure do |config|
19
+ config.example_status_persistence_file_path = '.rspec_status'
20
+ config.order = :random
21
+ config.run_all_when_everything_filtered = true
22
+ config.expect_with :rspec do |c|
23
+ c.syntax = :expect
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ module Support
2
+ module Stub
3
+ def stub_api(root)
4
+ ApiStruct::Settings.configure do |config|
5
+ config.endpoints = { stub_api: { root: root } }
6
+ end
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,272 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: api_struct
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - bezrukavyi
8
+ - andy1341
9
+ - kirillshevch
10
+ autorequire:
11
+ bindir: exe
12
+ cert_chain: []
13
+ date: 2018-04-06 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: dry-monads
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: 0.3.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: 0.3.1
29
+ - !ruby/object:Gem::Dependency
30
+ name: dry-configurable
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: 0.7.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.7.0
43
+ - !ruby/object:Gem::Dependency
44
+ name: http
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 2.0.3
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.3
57
+ - !ruby/object:Gem::Dependency
58
+ name: hashie
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '3.5'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.5.6
67
+ type: :runtime
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '3.5'
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.5.6
77
+ - !ruby/object:Gem::Dependency
78
+ name: bundler
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.14'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.14'
91
+ - !ruby/object:Gem::Dependency
92
+ name: pry-byebug
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '3.5'
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 3.5.1
101
+ type: :development
102
+ prerelease: false
103
+ version_requirements: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '3.5'
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 3.5.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '12.3'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '12.3'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.52.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.52.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: vcr
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 3.0.3
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 3.0.3
167
+ - !ruby/object:Gem::Dependency
168
+ name: webmock
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '3.2'
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 3.2.1
177
+ type: :development
178
+ prerelease: false
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - "~>"
182
+ - !ruby/object:Gem::Version
183
+ version: '3.2'
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: 3.2.1
187
+ - !ruby/object:Gem::Dependency
188
+ name: ffaker
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '2.7'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '2.7'
201
+ description: ''
202
+ email:
203
+ - yaroslav.bezrukavyi@gmail.com
204
+ - andrii.novikov1341@gmail.com
205
+ - kirills167@gmail.com
206
+ executables: []
207
+ extensions: []
208
+ extra_rdoc_files: []
209
+ files:
210
+ - ".gitignore"
211
+ - ".rspec"
212
+ - ".rubocop.yml"
213
+ - ".ruby-version"
214
+ - Gemfile
215
+ - Gemfile.lock
216
+ - LICENSE.txt
217
+ - README.md
218
+ - Rakefile
219
+ - api_struct.gemspec
220
+ - api_struct.svg
221
+ - bin/console
222
+ - bin/setup
223
+ - circle.yml
224
+ - lib/api_struct.rb
225
+ - lib/api_struct/client.rb
226
+ - lib/api_struct/collection.rb
227
+ - lib/api_struct/concerns/underscore.rb
228
+ - lib/api_struct/entity.rb
229
+ - lib/api_struct/errors/client.rb
230
+ - lib/api_struct/errors/entity.rb
231
+ - lib/api_struct/extensions/api_client.rb
232
+ - lib/api_struct/extensions/dry_monads.rb
233
+ - lib/api_struct/settings.rb
234
+ - lib/api_struct/version.rb
235
+ - spec/api_struct/client_spec.rb
236
+ - spec/api_struct/entity_spec.rb
237
+ - spec/fixtures/cassettes/posts/1.yml
238
+ - spec/fixtures/cassettes/posts/index_success.yml
239
+ - spec/fixtures/cassettes/posts/show_failure.yml
240
+ - spec/fixtures/cassettes/posts/show_success.yml
241
+ - spec/fixtures/cassettes/posts/suffix.yml
242
+ - spec/fixtures/cassettes/posts/update_success.yml
243
+ - spec/fixtures/cassettes/todos.yml
244
+ - spec/fixtures/cassettes/users/1/posts.yml
245
+ - spec/fixtures/cassettes/users/1/posts/1.yml
246
+ - spec/spec_helper.rb
247
+ - spec/support/stub.rb
248
+ homepage: https://github.com/rubygarage/api_struct
249
+ licenses:
250
+ - MIT
251
+ metadata: {}
252
+ post_install_message:
253
+ rdoc_options: []
254
+ require_paths:
255
+ - lib
256
+ required_ruby_version: !ruby/object:Gem::Requirement
257
+ requirements:
258
+ - - ">="
259
+ - !ruby/object:Gem::Version
260
+ version: '0'
261
+ required_rubygems_version: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ version: '0'
266
+ requirements: []
267
+ rubyforge_project:
268
+ rubygems_version: 2.6.11
269
+ signing_key:
270
+ specification_version: 4
271
+ summary: API wrapper builder with response serialization
272
+ test_files: []