-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rocco Basso
committed
Nov 10, 2018
0 parents
commit 614c038
Showing
72 changed files
with
8,069 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore Byebug command history file. | ||
.byebug_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
source 'https://rubygems.org' | ||
|
||
git_source(:github) do |repo_name| | ||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") | ||
"https://github.com/#{repo_name}.git" | ||
end | ||
|
||
gem 'rails', '= 5.1.5' | ||
|
||
gem 'elasticsearch-model' | ||
gem 'elasticsearch-rails' | ||
gem 'graphql' | ||
gem 'pg' | ||
gem 'puma', '~> 3.0' | ||
|
||
group :development, :test do | ||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | ||
gem 'pry' | ||
gem 'graphiql-rails' # GraphiQL as a Rails engine, in development | ||
end | ||
|
||
group :development do | ||
gem 'listen', '~> 3.0.5' | ||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | ||
gem 'spring' | ||
gem 'spring-watcher-listen', '~> 2.0.0' | ||
end | ||
|
||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actioncable (5.1.5) | ||
actionpack (= 5.1.5) | ||
nio4r (~> 2.0) | ||
websocket-driver (~> 0.6.1) | ||
actionmailer (5.1.5) | ||
actionpack (= 5.1.5) | ||
actionview (= 5.1.5) | ||
activejob (= 5.1.5) | ||
mail (~> 2.5, >= 2.5.4) | ||
rails-dom-testing (~> 2.0) | ||
actionpack (5.1.5) | ||
actionview (= 5.1.5) | ||
activesupport (= 5.1.5) | ||
rack (~> 2.0) | ||
rack-test (>= 0.6.3) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.2) | ||
actionview (5.1.5) | ||
activesupport (= 5.1.5) | ||
builder (~> 3.1) | ||
erubi (~> 1.4) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.0, >= 1.0.3) | ||
activejob (5.1.5) | ||
activesupport (= 5.1.5) | ||
globalid (>= 0.3.6) | ||
activemodel (5.1.5) | ||
activesupport (= 5.1.5) | ||
activerecord (5.1.5) | ||
activemodel (= 5.1.5) | ||
activesupport (= 5.1.5) | ||
arel (~> 8.0) | ||
activesupport (5.1.5) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (~> 0.7) | ||
minitest (~> 5.1) | ||
tzinfo (~> 1.1) | ||
arel (8.0.0) | ||
builder (3.2.3) | ||
coderay (1.1.2) | ||
concurrent-ruby (1.0.5) | ||
crass (1.0.4) | ||
elasticsearch (6.1.0) | ||
elasticsearch-api (= 6.1.0) | ||
elasticsearch-transport (= 6.1.0) | ||
elasticsearch-api (6.1.0) | ||
multi_json | ||
elasticsearch-model (6.0.0) | ||
activesupport (> 3) | ||
elasticsearch (> 1) | ||
hashie | ||
elasticsearch-rails (6.0.0) | ||
elasticsearch-transport (6.1.0) | ||
faraday | ||
multi_json | ||
erubi (1.7.1) | ||
faraday (0.15.3) | ||
multipart-post (>= 1.2, < 3) | ||
ffi (1.9.25) | ||
globalid (0.4.1) | ||
activesupport (>= 4.2.0) | ||
graphiql-rails (1.4.11) | ||
railties | ||
sprockets-rails | ||
graphql (1.8.10) | ||
hashie (3.6.0) | ||
i18n (0.9.5) | ||
concurrent-ruby (~> 1.0) | ||
listen (3.0.8) | ||
rb-fsevent (~> 0.9, >= 0.9.4) | ||
rb-inotify (~> 0.9, >= 0.9.7) | ||
loofah (2.2.2) | ||
crass (~> 1.0.2) | ||
nokogiri (>= 1.5.9) | ||
mail (2.7.0) | ||
mini_mime (>= 0.1.1) | ||
method_source (0.9.0) | ||
mini_mime (1.0.1) | ||
mini_portile2 (2.3.0) | ||
minitest (5.11.3) | ||
multi_json (1.13.1) | ||
multipart-post (2.0.0) | ||
nio4r (2.3.1) | ||
nokogiri (1.8.5) | ||
mini_portile2 (~> 2.3.0) | ||
pg (1.1.3) | ||
pry (0.11.3) | ||
coderay (~> 1.1.0) | ||
method_source (~> 0.9.0) | ||
puma (3.12.0) | ||
rack (2.0.5) | ||
rack-test (1.1.0) | ||
rack (>= 1.0, < 3) | ||
rails (5.1.5) | ||
actioncable (= 5.1.5) | ||
actionmailer (= 5.1.5) | ||
actionpack (= 5.1.5) | ||
actionview (= 5.1.5) | ||
activejob (= 5.1.5) | ||
activemodel (= 5.1.5) | ||
activerecord (= 5.1.5) | ||
activesupport (= 5.1.5) | ||
bundler (>= 1.3.0) | ||
railties (= 5.1.5) | ||
sprockets-rails (>= 2.0.0) | ||
rails-dom-testing (2.0.3) | ||
activesupport (>= 4.2.0) | ||
nokogiri (>= 1.6) | ||
rails-html-sanitizer (1.0.4) | ||
loofah (~> 2.2, >= 2.2.2) | ||
railties (5.1.5) | ||
actionpack (= 5.1.5) | ||
activesupport (= 5.1.5) | ||
method_source | ||
rake (>= 0.8.7) | ||
thor (>= 0.18.1, < 2.0) | ||
rake (12.3.1) | ||
rb-fsevent (0.10.3) | ||
rb-inotify (0.9.10) | ||
ffi (>= 0.5.0, < 2) | ||
spring (2.0.2) | ||
activesupport (>= 4.2) | ||
spring-watcher-listen (2.0.1) | ||
listen (>= 2.7, < 4.0) | ||
spring (>= 1.2, < 3.0) | ||
sprockets (3.7.2) | ||
concurrent-ruby (~> 1.0) | ||
rack (> 1, < 3) | ||
sprockets-rails (3.2.1) | ||
actionpack (>= 4.0) | ||
activesupport (>= 4.0) | ||
sprockets (>= 3.0.0) | ||
thor (0.20.0) | ||
thread_safe (0.3.6) | ||
tzinfo (1.2.5) | ||
thread_safe (~> 0.1) | ||
websocket-driver (0.6.5) | ||
websocket-extensions (>= 0.1.0) | ||
websocket-extensions (0.1.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
elasticsearch-model | ||
elasticsearch-rails | ||
graphiql-rails | ||
graphql | ||
listen (~> 3.0.5) | ||
pg | ||
pry | ||
puma (~> 3.0) | ||
rails (= 5.1.5) | ||
spring | ||
spring-watcher-listen (~> 2.0.0) | ||
tzinfo-data | ||
|
||
BUNDLED WITH | ||
1.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# README | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
|
||
Things you may want to cover: | ||
|
||
* Ruby version | ||
|
||
* System dependencies | ||
|
||
* Configuration | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
|
||
* How to run the test suite | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
|
||
* ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative 'config/application' | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Channel < ActionCable::Channel::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Connection < ActionCable::Connection::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class ApplicationController < ActionController::API | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class GraphqlController < ApplicationController | ||
def query | ||
variables = ensure_hash(params[:variables]) | ||
query = params[:query] | ||
operation_name = params[:operationName] | ||
context = { | ||
# Query context goes here, for example: | ||
# current_user: current_user, | ||
} | ||
|
||
result = ParkingApiSchema.execute( | ||
query, | ||
variables: variables, | ||
context: context, | ||
operation_name: operation_name | ||
) | ||
render json: result | ||
rescue => e | ||
raise e unless Rails.env.development? | ||
handle_error_in_development e | ||
end | ||
|
||
private | ||
|
||
# Handle form data, JSON body, or a blank value | ||
def ensure_hash(ambiguous_param) | ||
case ambiguous_param | ||
when String | ||
if ambiguous_param.present? | ||
ensure_hash(JSON.parse(ambiguous_param)) | ||
else | ||
{} | ||
end | ||
when Hash, ActionController::Parameters | ||
ambiguous_param | ||
when nil | ||
{} | ||
else | ||
raise ArgumentError, "Unexpected parameter: #{ambiguous_param}" | ||
end | ||
end | ||
|
||
def handle_error_in_development(e) | ||
logger.error e.message | ||
logger.error e.backtrace.join("\n") | ||
|
||
render json: { error: { message: e.message, backtrace: e.backtrace }, data: {} }, status: 500 | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ParkingApiSchema < GraphQL::Schema | ||
mutation(Types::MutationType) | ||
query(Types::QueryType) | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Types | ||
class BaseEnum < GraphQL::Schema::Enum | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Types | ||
class BaseInputObject < GraphQL::Schema::InputObject | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Types | ||
module BaseInterface | ||
include GraphQL::Schema::Interface | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Types | ||
class BaseObject < GraphQL::Schema::Object | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Types | ||
class BaseScalar < GraphQL::Schema::Scalar | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Types | ||
class BaseUnion < GraphQL::Schema::Union | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Types | ||
class MutationType < Types::BaseObject | ||
# TODO: remove me | ||
field :test_field, String, null: false, | ||
description: "An example field added by the generator" | ||
def test_field | ||
"Hello World" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Types::ParkingSpaceType = GraphQL::ObjectType.define do | ||
name "ParkingSpace" | ||
description "a place to park your car" | ||
|
||
# global_id_field :id | ||
|
||
field :id, types.Int, "The numerical unique ID of the parking space" | ||
field :label, types.String, "The parking spots display label" | ||
field :latitude, types.Float, "The latitude of a parking spot" | ||
field :longitude, types.Float, "The longitude of a parking spot" | ||
field :street_address, types.String, "The street address of a parking spot" | ||
field :country, types.String, "The country in which the parking spot is located" | ||
field :state, types.String, "The state in which the parking spot is located" | ||
field :zip_code, types.String, "The zip code for the parking spot" | ||
end |
Oops, something went wrong.