mock_graphql_ai 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +10 -0
- data/Rakefile +7 -0
- data/lib/mock_graphql_ai/version.rb +3 -0
- data/lib/mock_graphql_ai.rb +11 -0
- data/mock_graphql_ai.gemspec +25 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c29b5ae69313f96fc84fdd5a9cdbe604269b4188e79b331f78de42fc37cc9df3
|
4
|
+
data.tar.gz: 4e1c43b9c3a1938e795388488f8b9275d0563abba042142053ca2036cb4de3ef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6696fcc3af08b183aa4ee5529611887551f72fb5c37dc8ae7cdb985e064b7e967702980176516d20834adb73f58b984554487c708996c590fce467e37584e317
|
7
|
+
data.tar.gz: 50e85d87a7a99871995e4c86f6c171a7a4ab76223d77cb2a4b971b9353cfb77f0606d8af3efc26ece87f3913fa476db6e014d6e9ad11ecd2eaa81bb75cf1d0fc
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Moiz Ali
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# MockGraphqlAI
|
2
|
+
|
3
|
+
A thin wrapper to generate mock GraphQL API responses via OpenAI gpt-3.5-turbo in Ruby apps.
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
### Requirements
|
8
|
+
|
9
|
+
This gem requires Ruby 2.6+
|
10
|
+
Also it requires [graphql]('https://github.com/rmosolgo/graphql-ruby') to override its ability to generate responses
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module MockGraphqlAi
|
2
|
+
def self.add_mock_result_assignment(controller_file_path)
|
3
|
+
file_contents = File.read(controller_file_path)
|
4
|
+
modified_contents = file_contents.gsub(
|
5
|
+
/(result\s*=\s*)GraphqlBoilerplateSchema\.execute\(query, variables: variables, context: @context, operation_name: operation_name\)/m,
|
6
|
+
"result = ENV['GRAPHQL_MOCK_MODE'] ? Mocks::Resource.new({ query: query }).call : \\0"
|
7
|
+
)
|
8
|
+
|
9
|
+
File.write(controller_file_path, modified_contents)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('lib/mock_graphql_ai/version', __dir__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'mock_graphql_ai'
|
5
|
+
spec.version = MockGraphqlAi::VERSION
|
6
|
+
spec.authors= ['Moiz Ali']
|
7
|
+
spec.email = ['amoiz4142@gmail.com']
|
8
|
+
spec.summary = "A thin wrapper to generate mock GraphQL API responses via OpenAI gpt-3.5-turbo in Ruby apps."
|
9
|
+
spec.homepage = 'https://github.com/Moiz1524/mock_graphql_ai'
|
10
|
+
spec.license = 'MIT'
|
11
|
+
spec.platform = Gem::Platform::RUBY
|
12
|
+
spec.required_ruby_version = '>= 2.6.0'
|
13
|
+
|
14
|
+
spec.files = Dir['README.md', 'LICENSE', 'CHANGELOG.md', 'lib/**/*.rb',
|
15
|
+
'lib/**/*.rake', 'mock_graphql_ai.gemspec', '.github/*.md',
|
16
|
+
'Gemfile', 'Rakefile']
|
17
|
+
spec.extra_rdoc_files = ['README.md']
|
18
|
+
|
19
|
+
# spec.add_runtime_dependency 'graphql', '~> 2.0', '>= 2.0.19'
|
20
|
+
spec.add_runtime_dependency 'ruby-openai', '~> 0.1.0'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'rubocop', '~> 1.48', '>= 1.48.1'
|
23
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.16'
|
24
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.19'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mock_graphql_ai
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Moiz Ali
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-openai
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.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.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.48'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.48.1
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.48'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.48.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rubocop-performance
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.16'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.16'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rubocop-rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2.19'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.19'
|
75
|
+
description:
|
76
|
+
email:
|
77
|
+
- amoiz4142@gmail.com
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files:
|
81
|
+
- README.md
|
82
|
+
files:
|
83
|
+
- CHANGELOG.md
|
84
|
+
- Gemfile
|
85
|
+
- LICENSE
|
86
|
+
- README.md
|
87
|
+
- Rakefile
|
88
|
+
- lib/mock_graphql_ai.rb
|
89
|
+
- lib/mock_graphql_ai/version.rb
|
90
|
+
- mock_graphql_ai.gemspec
|
91
|
+
homepage: https://github.com/Moiz1524/mock_graphql_ai
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.6.0
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubygems_version: 3.3.7
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: A thin wrapper to generate mock GraphQL API responses via OpenAI gpt-3.5-turbo
|
114
|
+
in Ruby apps.
|
115
|
+
test_files: []
|