openapi_rest 0.0.1

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/LICENSE.txt +21 -0
  3. data/README.md +141 -0
  4. data/Rakefile +11 -0
  5. data/bin/console +14 -0
  6. data/bin/setup +8 -0
  7. data/lib/generators/openapi_rest/install_generator.rb +11 -0
  8. data/lib/generators/openapi_rest/openapi_doc.rb +3 -0
  9. data/lib/generators/templates/api_docs.yml +162 -0
  10. data/lib/openapi_rest.rb +22 -0
  11. data/lib/openapi_rest/api_config.rb +12 -0
  12. data/lib/openapi_rest/api_doc.rb +19 -0
  13. data/lib/openapi_rest/api_doc_parser.rb +110 -0
  14. data/lib/openapi_rest/api_model.rb +36 -0
  15. data/lib/openapi_rest/api_parameters.rb +76 -0
  16. data/lib/openapi_rest/api_validator.rb +20 -0
  17. data/lib/openapi_rest/extension.rb +35 -0
  18. data/lib/openapi_rest/operations/filter.rb +24 -0
  19. data/lib/openapi_rest/operations/paginate.rb +19 -0
  20. data/lib/openapi_rest/operations/sort.rb +27 -0
  21. data/lib/openapi_rest/query_builder.rb +70 -0
  22. data/lib/openapi_rest/query_response.rb +89 -0
  23. data/lib/openapi_rest/railtie.rb +9 -0
  24. data/lib/openapi_rest/rest_renderer.rb +75 -0
  25. data/lib/openapi_rest/validators/format.rb +24 -0
  26. data/lib/openapi_rest/validators/pattern.rb +21 -0
  27. data/lib/openapi_rest/version.rb +3 -0
  28. data/test/openapi_rest/api_config_test.rb +9 -0
  29. data/test/openapi_rest/api_doc_parser_test.rb +71 -0
  30. data/test/openapi_rest/api_doc_test.rb +15 -0
  31. data/test/openapi_rest/api_model_test.rb +49 -0
  32. data/test/openapi_rest/api_parameters_test.rb +57 -0
  33. data/test/openapi_rest/api_validator_test.rb +23 -0
  34. data/test/openapi_rest/query_builder_test.rb +32 -0
  35. data/test/openapi_rest/query_response_test.rb +129 -0
  36. data/test/spec_helper.rb +8 -0
  37. data/test/support/data.rb +3 -0
  38. data/test/support/models.rb +3 -0
  39. data/test/support/schema.rb +13 -0
  40. metadata +139 -0
@@ -0,0 +1,8 @@
1
+ require 'active_record'
2
+
3
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3",
4
+ :database => File.dirname(__FILE__) + "/openapi_rest.sqlite3")
5
+
6
+ load File.dirname(__FILE__) + '/support/schema.rb'
7
+ load File.dirname(__FILE__) + '/support/models.rb'
8
+ load File.dirname(__FILE__) + '/support/data.rb'
@@ -0,0 +1,3 @@
1
+ Product.create(product_id: '0000')
2
+ Product.create(product_id: '1111')
3
+ Product.create(product_id: '5555')
@@ -0,0 +1,3 @@
1
+ class Product < ActiveRecord::Base
2
+ validates_presence_of :product_id
3
+ end
@@ -0,0 +1,13 @@
1
+ ActiveRecord::Schema.define do
2
+ self.verbose = false
3
+
4
+ create_table :products, :force => true do |t|
5
+ t.string :product_id
6
+ t.string :description
7
+ t.string :name
8
+ t.string :capacity
9
+ t.string :image
10
+
11
+ t.timestamps(null: true)
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openapi_rest
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gonzalo Aune
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.2'
69
+ description: This gem aims to provide an easier way to implement REST api endpoints
70
+ using OpenAPI specs in a Rails project.
71
+ email:
72
+ - gonzalo@bizimply.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - LICENSE.txt
78
+ - README.md
79
+ - Rakefile
80
+ - bin/console
81
+ - bin/setup
82
+ - lib/generators/openapi_rest/install_generator.rb
83
+ - lib/generators/openapi_rest/openapi_doc.rb
84
+ - lib/generators/templates/api_docs.yml
85
+ - lib/openapi_rest.rb
86
+ - lib/openapi_rest/api_config.rb
87
+ - lib/openapi_rest/api_doc.rb
88
+ - lib/openapi_rest/api_doc_parser.rb
89
+ - lib/openapi_rest/api_model.rb
90
+ - lib/openapi_rest/api_parameters.rb
91
+ - lib/openapi_rest/api_validator.rb
92
+ - lib/openapi_rest/extension.rb
93
+ - lib/openapi_rest/operations/filter.rb
94
+ - lib/openapi_rest/operations/paginate.rb
95
+ - lib/openapi_rest/operations/sort.rb
96
+ - lib/openapi_rest/query_builder.rb
97
+ - lib/openapi_rest/query_response.rb
98
+ - lib/openapi_rest/railtie.rb
99
+ - lib/openapi_rest/rest_renderer.rb
100
+ - lib/openapi_rest/validators/format.rb
101
+ - lib/openapi_rest/validators/pattern.rb
102
+ - lib/openapi_rest/version.rb
103
+ - test/openapi_rest/api_config_test.rb
104
+ - test/openapi_rest/api_doc_parser_test.rb
105
+ - test/openapi_rest/api_doc_test.rb
106
+ - test/openapi_rest/api_model_test.rb
107
+ - test/openapi_rest/api_parameters_test.rb
108
+ - test/openapi_rest/api_validator_test.rb
109
+ - test/openapi_rest/query_builder_test.rb
110
+ - test/openapi_rest/query_response_test.rb
111
+ - test/spec_helper.rb
112
+ - test/support/data.rb
113
+ - test/support/models.rb
114
+ - test/support/schema.rb
115
+ homepage: https://www.bizimply.com
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.4.8
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: OpenAPI rest
139
+ test_files: []