schemaless_rest_api 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/schemaless_rest_api +7 -7
- data/lib/schemaless_rest_api/entities.rb +9 -9
- data/lib/schemaless_rest_api/mongo_client.rb +47 -0
- data/lib/schemaless_rest_api/rest_server.rb +141 -61
- data/lib/schemaless_rest_api/version.rb +1 -1
- data/lib/schemaless_rest_api.rb +36 -30
- metadata +46 -22
- data/.idea/.gitignore +0 -2
- data/.idea/inspectionProfiles/Project_Default.xml +0 -6
- data/.idea/misc.xml +0 -7
- data/.idea/modules.xml +0 -8
- data/.idea/vcs.xml +0 -6
- data/.rspec +0 -3
- data/.rubocop.yml +0 -13
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/CHANGELOG.md +0 -5
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -12
- data/LICENSE.txt +0 -21
- data/README.md +0 -42
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/schemaless_rest_api.gemspec +0 -41
- data/sig/schemaless_rest_api.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a86e21c3979d2542206f5c993491444ee5e91e38d348eaaf4cc4a6a242eaf11f
|
4
|
+
data.tar.gz: 2c82b7556b1ed4ce916224bdcc9404efe20283d7a7c7f2564bc750968b9f9cc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abfb1f463d723d366327e16067e751e2e616d7026adabd83365ddf0f5841e69f422ebcfbb1a8b7a6c756606241b8d400052ac496bbf011e9bd807ced28c0ebfb
|
7
|
+
data.tar.gz: 37a864e55ffd3740404a7ce7d632c3496c9d1e546d4e9a75092a5dfe3655e127a69f2a82c0253f7dccff5faaa7dcb5559549e702f0da760aaad36696300f55a5
|
data/exe/schemaless_rest_api
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
-
require "schemaless_rest_api"
|
6
|
-
|
7
|
-
RestServer.run!
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require "schemaless_rest_api"
|
6
|
+
|
7
|
+
RestServer.run!
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Entities mapped by environment variables
|
4
|
-
class Entities
|
5
|
-
@models = {}
|
6
|
-
class << self
|
7
|
-
attr_accessor :models
|
8
|
-
end
|
9
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Entities mapped by environment variables
|
4
|
+
class Entities
|
5
|
+
@models = {}
|
6
|
+
class << self
|
7
|
+
attr_accessor :models
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'mongo'
|
2
|
+
|
3
|
+
module MongoClient
|
4
|
+
class << self
|
5
|
+
# @return Client to work with MongoDb
|
6
|
+
attr_accessor :client
|
7
|
+
|
8
|
+
def insert(model, data, id)
|
9
|
+
collection = MongoClient.client[model]
|
10
|
+
collection.insert_one({ id: id, **data})
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(model, id)
|
14
|
+
find_all(model, { id: id } )
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_all(model)
|
18
|
+
collection = MongoClient.client[model]
|
19
|
+
collection.find.collect do |match|
|
20
|
+
match.delete("_id")
|
21
|
+
match
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def find_all(model, query)
|
26
|
+
collection = MongoClient.client[model]
|
27
|
+
collection.find( query ).collect do |match|
|
28
|
+
match.delete("_id")
|
29
|
+
match
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(model, id, data)
|
34
|
+
collection = MongoClient.client[model]
|
35
|
+
collection.update_one({ id: id }, { id: id, **data})
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete(model, id)
|
39
|
+
collection = MongoClient.client[model]
|
40
|
+
collection.delete_one({ id: id })
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
MongoClient.client = Mongo::Client.new(
|
46
|
+
[ "#{ENV['mongodb']}:27017" ],
|
47
|
+
:database => 'api')
|
@@ -1,61 +1,141 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "sinatra"
|
4
|
-
require
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
set :
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sinatra"
|
4
|
+
require 'docdsl'
|
5
|
+
require "puma"
|
6
|
+
require 'route_downcaser'
|
7
|
+
|
8
|
+
class RestServer < Sinatra::Base
|
9
|
+
set :server, :puma
|
10
|
+
enable :logging if ENV["debug"] == "true"
|
11
|
+
set :bind, "0.0.0.0"
|
12
|
+
use RouteDowncaser::DowncaseRouteMiddleware
|
13
|
+
|
14
|
+
register Sinatra::DocDsl
|
15
|
+
|
16
|
+
page do
|
17
|
+
title "Schmaless REST API"
|
18
|
+
header "REST API using models #{Entities.models.keys}"
|
19
|
+
introduction "REST APIs allowing CRUD on:
|
20
|
+
#{Entities.models.keys.join("\n")}"
|
21
|
+
end
|
22
|
+
|
23
|
+
doc_endpoint "/docs"
|
24
|
+
|
25
|
+
def has_id?(model, id)
|
26
|
+
Entities.models[model].key?(id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def not_have(id)
|
30
|
+
[404, JSON.generate({ error: "'#{id}' not found" })]
|
31
|
+
end
|
32
|
+
|
33
|
+
documentation "Get summary" do
|
34
|
+
response "Basic basic summary of API"
|
35
|
+
end
|
36
|
+
get "/" do
|
37
|
+
summary = { models: Entities.models.keys.to_s,
|
38
|
+
docs_url: '<a href=/docs>/docs</a>' }
|
39
|
+
summary[:db] = MongoClient.client.summary.to_s if ENV['mongodb']
|
40
|
+
JSON.generate(summary)
|
41
|
+
rescue Exception => e
|
42
|
+
[500, e.message]
|
43
|
+
end
|
44
|
+
|
45
|
+
Entities.models.each_key do |model|
|
46
|
+
documentation "Create instance of #{model}" do
|
47
|
+
payload "Whatever JSON you want. Needs to be valid JSON"
|
48
|
+
response "Id of created #{model}"
|
49
|
+
status 201
|
50
|
+
end
|
51
|
+
post "/#{model.downcase}" do
|
52
|
+
id = SecureRandom.uuid
|
53
|
+
data = JSON.parse(request.body.read)
|
54
|
+
if ENV['mongodb']
|
55
|
+
MongoClient.insert(model, data, id)
|
56
|
+
else
|
57
|
+
Entities.models[model][id] = data
|
58
|
+
end
|
59
|
+
[201, id]
|
60
|
+
end
|
61
|
+
|
62
|
+
documentation "Retrieve all instances of #{model} or filtered by query param" do
|
63
|
+
response "Data in #{model}"
|
64
|
+
query_param :key_to_search_in_data, "Value of key"
|
65
|
+
status 200
|
66
|
+
end
|
67
|
+
get "/#{model.downcase}" do
|
68
|
+
puts request.path.downcase
|
69
|
+
if ENV['mongodb']
|
70
|
+
if params == {}
|
71
|
+
JSON.generate(MongoClient.get_all(model))
|
72
|
+
else
|
73
|
+
[200, JSON.generate(MongoClient.find_all(model, params))]
|
74
|
+
end
|
75
|
+
else
|
76
|
+
return [200, Entities.models[model].to_s] if params == {}
|
77
|
+
|
78
|
+
Entities.models[model].values.find_all { |val| val[params.keys[0]] == params.values[0] }
|
79
|
+
end
|
80
|
+
rescue Exception => e
|
81
|
+
[404, "Nothing found using #{params}. Only first param considered. #{e.message}"]
|
82
|
+
end
|
83
|
+
|
84
|
+
documentation "Retrieve specific instance of #{model} by id" do
|
85
|
+
response "Data in #{model}"
|
86
|
+
status 200
|
87
|
+
status 404
|
88
|
+
end
|
89
|
+
get "/#{model.downcase}/:id" do |id|
|
90
|
+
puts request.path.downcase
|
91
|
+
if ENV['mongodb']
|
92
|
+
results = MongoClient.find(model, id)
|
93
|
+
return not_have(id) unless results.first
|
94
|
+
JSON.generate(results.first)
|
95
|
+
else
|
96
|
+
return not_have(id) unless has_id?(model, id)
|
97
|
+
|
98
|
+
JSON.generate(Entities.models[model][id])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
documentation "Update id of #{model} to be provided data" do
|
103
|
+
payload "Whatever JSON you want updated to be. Needs to be valid JSON"
|
104
|
+
response "Data in #{model}"
|
105
|
+
status 204
|
106
|
+
status 404
|
107
|
+
end
|
108
|
+
put "/#{model.downcase}/:id" do |id|
|
109
|
+
puts request.path.downcase
|
110
|
+
data = JSON.parse(request.body.read)
|
111
|
+
if ENV['mongodb']
|
112
|
+
results = MongoClient.find(model, id)
|
113
|
+
return not_have(id) unless results.first
|
114
|
+
MongoClient.update(model, id, data)
|
115
|
+
else
|
116
|
+
return not_have(id) unless has_id?(model, id)
|
117
|
+
|
118
|
+
Entities.models[model][id] = data
|
119
|
+
end
|
120
|
+
204
|
121
|
+
end
|
122
|
+
|
123
|
+
documentation "Update id of #{model} to be deleted" do
|
124
|
+
response "Empty"
|
125
|
+
status 204
|
126
|
+
end
|
127
|
+
delete "/#{model.downcase}/:id" do |id|
|
128
|
+
puts request.path.downcase
|
129
|
+
if ENV['mongodb']
|
130
|
+
results = MongoClient.find(model, id)
|
131
|
+
return not_have(id) unless results.first
|
132
|
+
MongoClient.delete(model, id)
|
133
|
+
else
|
134
|
+
return not_have(id) unless has_id?(model, id)
|
135
|
+
|
136
|
+
Entities.models[model].delete(id)
|
137
|
+
end
|
138
|
+
204
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
data/lib/schemaless_rest_api.rb
CHANGED
@@ -1,30 +1,36 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "schemaless_rest_api/version"
|
4
|
-
require_relative "schemaless_rest_api/entities"
|
5
|
-
|
6
|
-
require "json"
|
7
|
-
require "securerandom"
|
8
|
-
|
9
|
-
def extract_models
|
10
|
-
error_msg = "Make 'models' environment variable an array (e.g ['model1', 'model2'])"
|
11
|
-
raise "Please set 'models' ENV variable. #{error_msg}" if ENV["models"].nil?
|
12
|
-
|
13
|
-
models = eval(ENV["models"])
|
14
|
-
raise error_msg unless models.is_a? Array
|
15
|
-
|
16
|
-
models
|
17
|
-
end
|
18
|
-
|
19
|
-
extract_models.each do |model|
|
20
|
-
Entities.models[model.to_sym] = {}
|
21
|
-
end
|
22
|
-
|
23
|
-
puts "Modelling #{Entities.models.keys}"
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "schemaless_rest_api/version"
|
4
|
+
require_relative "schemaless_rest_api/entities"
|
5
|
+
|
6
|
+
require "json"
|
7
|
+
require "securerandom"
|
8
|
+
|
9
|
+
def extract_models
|
10
|
+
error_msg = "Make 'models' environment variable an array (e.g ['model1', 'model2'])"
|
11
|
+
raise "Please set 'models' ENV variable. #{error_msg}" if ENV["models"].nil?
|
12
|
+
|
13
|
+
models = eval(ENV["models"])
|
14
|
+
raise error_msg unless models.is_a? Array
|
15
|
+
|
16
|
+
models
|
17
|
+
end
|
18
|
+
|
19
|
+
extract_models.each do |model|
|
20
|
+
Entities.models[model.to_sym] = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
puts "Modelling #{Entities.models.keys}"
|
24
|
+
|
25
|
+
if ENV['mongodb']
|
26
|
+
require_relative 'schemaless_rest_api/mongo_client'
|
27
|
+
else
|
28
|
+
puts "[INFO] Using in memory storage. Pass in 'mongodb' ENV variable to store
|
29
|
+
in db"
|
30
|
+
end
|
31
|
+
require_relative "schemaless_rest_api/rest_server"
|
32
|
+
|
33
|
+
module SchemalessRestApi
|
34
|
+
class Error < StandardError; end
|
35
|
+
# Your code goes here...
|
36
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schemaless_rest_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mongo
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: sinatra
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,6 +38,20 @@ dependencies:
|
|
24
38
|
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra-docdsl
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: puma
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +80,20 @@ dependencies:
|
|
52
80
|
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: route_downcaser
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
description: |-
|
56
98
|
Simple schema less rest API that can be run in docker and have entities configured through a simple list of environment variables.
|
57
99
|
It follows convention over configuration to allow you to get a REST api that stores unstructured data fast.
|
@@ -62,30 +104,12 @@ executables:
|
|
62
104
|
extensions: []
|
63
105
|
extra_rdoc_files: []
|
64
106
|
files:
|
65
|
-
- ".idea/.gitignore"
|
66
|
-
- ".idea/inspectionProfiles/Project_Default.xml"
|
67
|
-
- ".idea/misc.xml"
|
68
|
-
- ".idea/modules.xml"
|
69
|
-
- ".idea/vcs.xml"
|
70
|
-
- ".rspec"
|
71
|
-
- ".rubocop.yml"
|
72
|
-
- ".ruby-gemset"
|
73
|
-
- ".ruby-version"
|
74
|
-
- CHANGELOG.md
|
75
|
-
- CODE_OF_CONDUCT.md
|
76
|
-
- Gemfile
|
77
|
-
- LICENSE.txt
|
78
|
-
- README.md
|
79
|
-
- Rakefile
|
80
|
-
- bin/console
|
81
|
-
- bin/setup
|
82
107
|
- exe/schemaless_rest_api
|
83
108
|
- lib/schemaless_rest_api.rb
|
84
109
|
- lib/schemaless_rest_api/entities.rb
|
110
|
+
- lib/schemaless_rest_api/mongo_client.rb
|
85
111
|
- lib/schemaless_rest_api/rest_server.rb
|
86
112
|
- lib/schemaless_rest_api/version.rb
|
87
|
-
- schemaless_rest_api.gemspec
|
88
|
-
- sig/schemaless_rest_api.rbs
|
89
113
|
homepage: https://gitlab.com/samuel-garratt/schemaless_rest_api
|
90
114
|
licenses:
|
91
115
|
- MIT
|
@@ -108,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
132
|
- !ruby/object:Gem::Version
|
109
133
|
version: '0'
|
110
134
|
requirements: []
|
111
|
-
rubygems_version: 3.2.
|
135
|
+
rubygems_version: 3.2.3
|
112
136
|
signing_key:
|
113
137
|
specification_version: 4
|
114
138
|
summary: TSimple schema less rest API that have entities configured through environment
|
data/.idea/.gitignore
DELETED
data/.idea/misc.xml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="JavaScriptSettings">
|
4
|
-
<option name="languageLevel" value="ES6" />
|
5
|
-
</component>
|
6
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3" project-jdk-type="RUBY_SDK" />
|
7
|
-
</project>
|
data/.idea/modules.xml
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectModuleManager">
|
4
|
-
<modules>
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/schemaless_rest_api.iml" filepath="$PROJECT_DIR$/.idea/schemaless_rest_api.iml" />
|
6
|
-
</modules>
|
7
|
-
</component>
|
8
|
-
</project>
|
data/.idea/vcs.xml
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
schemaless_rest_api
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-3.0.0
|
data/CHANGELOG.md
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
-
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
-
|
9
|
-
## Our Standards
|
10
|
-
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
-
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
-
|
19
|
-
Examples of unacceptable behavior include:
|
20
|
-
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
22
|
-
advances of any kind
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
-
* Public or private harassment
|
25
|
-
* Publishing others' private information, such as a physical or email
|
26
|
-
address, without their explicit permission
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
-
professional setting
|
29
|
-
|
30
|
-
## Enforcement Responsibilities
|
31
|
-
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
-
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
-
|
36
|
-
## Scope
|
37
|
-
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
-
|
40
|
-
## Enforcement
|
41
|
-
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
-
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
-
|
46
|
-
## Enforcement Guidelines
|
47
|
-
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
-
|
50
|
-
### 1. Correction
|
51
|
-
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
-
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
-
|
56
|
-
### 2. Warning
|
57
|
-
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
-
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
-
|
62
|
-
### 3. Temporary Ban
|
63
|
-
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
-
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
-
|
68
|
-
### 4. Permanent Ban
|
69
|
-
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
-
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
-
|
74
|
-
## Attribution
|
75
|
-
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
-
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
-
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
82
|
-
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2021 TODO: Write your name
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# SchemalessRestApi
|
2
|
-
|
3
|
-
Simple schema less rest API that can be run in docker and have entities configured through a simple list of environment variables.
|
4
|
-
It follows convention over configuration to allow you to get a REST api that stores unstructured data fast.
|
5
|
-
|
6
|
-
## Installation
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
gem 'schemaless_rest_api'
|
12
|
-
```
|
13
|
-
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle install
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install schemaless_rest_api
|
21
|
-
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
TODO: Write usage instructions here
|
25
|
-
|
26
|
-
## Development
|
27
|
-
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
-
|
30
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
-
|
32
|
-
## Contributing
|
33
|
-
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/schemaless_rest_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/schemaless_rest_api/blob/master/CODE_OF_CONDUCT.md).
|
35
|
-
|
36
|
-
## License
|
37
|
-
|
38
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
39
|
-
|
40
|
-
## Code of Conduct
|
41
|
-
|
42
|
-
Everyone interacting in the SchemalessRestApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/schemaless_rest_api/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "schemaless_rest_api"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/schemaless_rest_api.gemspec
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/schemaless_rest_api/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "schemaless_rest_api"
|
7
|
-
spec.version = SchemalessRestApi::VERSION
|
8
|
-
spec.authors = ["Samuel Garratt"]
|
9
|
-
spec.email = ["samuel.garratt@sentify.co"]
|
10
|
-
|
11
|
-
spec.summary = "TSimple schema less rest API that have entities configured through environment variables"
|
12
|
-
spec.description = "Simple schema less rest API that can be run in docker and have entities configured through a simple list of environment variables.
|
13
|
-
It follows convention over configuration to allow you to get a REST api that stores unstructured data fast."
|
14
|
-
spec.homepage = "https://gitlab.com/samuel-garratt/schemaless_rest_api"
|
15
|
-
spec.license = "MIT"
|
16
|
-
spec.required_ruby_version = ">= 2.6.0"
|
17
|
-
|
18
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
-
spec.metadata["source_code_uri"] = "https://gitlab.com/samuel-garratt/schemaless_rest_api"
|
20
|
-
spec.metadata["changelog_uri"] = "https://gitlab.com/samuel-garratt/schemaless_rest_api/CHANGELOG.md"
|
21
|
-
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
-
end
|
28
|
-
end
|
29
|
-
spec.bindir = "exe"
|
30
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
# Uncomment to register a new dependency of your gem
|
34
|
-
# spec.add_dependency "mongodb", "~> 1.0"
|
35
|
-
spec.add_dependency "sinatra"
|
36
|
-
# spec.add_dependency "sinatra-docdsl"
|
37
|
-
spec.add_dependency "puma"
|
38
|
-
spec.add_dependency "thor"
|
39
|
-
# For more information and examples about making a new gem, checkout our
|
40
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
41
|
-
end
|
data/sig/schemaless_rest_api.rbs
DELETED