Skip to content

Commit 120dff2

Browse files
committed
base de Proyecto
0 parents  commit 120dff2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1346
-0
lines changed

Gemfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
source 'https://rubygems.org'
2+
3+
4+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5+
gem 'rails', '>= 5.0.0.beta3', '< 5.1'
6+
# Use sqlite3 as the database for Active Record
7+
gem 'sqlite3'
8+
# Use Puma as the app server
9+
gem 'puma'
10+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
11+
# gem 'jbuilder', '~> 2.0'
12+
# Use Redis adapter to run Action Cable in production
13+
# gem 'redis', '~> 3.0'
14+
# Use ActiveModel has_secure_password
15+
# gem 'bcrypt', '~> 3.1.7'
16+
17+
# Use Capistrano for deployment
18+
# gem 'capistrano-rails', group: :development
19+
20+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
21+
# gem 'rack-cors'
22+
23+
group :development, :test do
24+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
25+
gem 'byebug'
26+
end
27+
28+
group :development do
29+
gem 'listen', '~> 3.0.5'
30+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
31+
gem 'spring'
32+
gem 'spring-watcher-listen', '~> 2.0.0'
33+
end
34+
35+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
36+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actioncable (5.0.0.beta3)
5+
actionpack (= 5.0.0.beta3)
6+
nio4r (~> 1.2)
7+
websocket-driver (~> 0.6.1)
8+
actionmailer (5.0.0.beta3)
9+
actionpack (= 5.0.0.beta3)
10+
actionview (= 5.0.0.beta3)
11+
activejob (= 5.0.0.beta3)
12+
mail (~> 2.5, >= 2.5.4)
13+
rails-dom-testing (~> 1.0, >= 1.0.5)
14+
actionpack (5.0.0.beta3)
15+
actionview (= 5.0.0.beta3)
16+
activesupport (= 5.0.0.beta3)
17+
rack (~> 2.x)
18+
rack-test (~> 0.6.3)
19+
rails-dom-testing (~> 1.0, >= 1.0.5)
20+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21+
actionview (5.0.0.beta3)
22+
activesupport (= 5.0.0.beta3)
23+
builder (~> 3.1)
24+
erubis (~> 2.7.0)
25+
rails-dom-testing (~> 1.0, >= 1.0.5)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
27+
activejob (5.0.0.beta3)
28+
activesupport (= 5.0.0.beta3)
29+
globalid (>= 0.3.6)
30+
activemodel (5.0.0.beta3)
31+
activesupport (= 5.0.0.beta3)
32+
activerecord (5.0.0.beta3)
33+
activemodel (= 5.0.0.beta3)
34+
activesupport (= 5.0.0.beta3)
35+
arel (~> 7.0)
36+
activesupport (5.0.0.beta3)
37+
concurrent-ruby (~> 1.0)
38+
i18n (~> 0.7)
39+
minitest (~> 5.1)
40+
tzinfo (~> 1.1)
41+
arel (7.0.0)
42+
builder (3.2.2)
43+
byebug (8.2.2)
44+
concurrent-ruby (1.0.1)
45+
erubis (2.7.0)
46+
ffi (1.9.10)
47+
globalid (0.3.6)
48+
activesupport (>= 4.1.0)
49+
i18n (0.7.0)
50+
json (1.8.3)
51+
listen (3.0.6)
52+
rb-fsevent (>= 0.9.3)
53+
rb-inotify (>= 0.9.7)
54+
loofah (2.0.3)
55+
nokogiri (>= 1.5.9)
56+
mail (2.6.3)
57+
mime-types (>= 1.16, < 3)
58+
method_source (0.8.2)
59+
mime-types (2.99.1)
60+
mini_portile2 (2.0.0)
61+
minitest (5.8.4)
62+
nio4r (1.2.1)
63+
nokogiri (1.6.7.2)
64+
mini_portile2 (~> 2.0.0.rc2)
65+
puma (3.0.2)
66+
rack (2.0.0.alpha)
67+
json
68+
rack-test (0.6.3)
69+
rack (>= 1.0)
70+
rails (5.0.0.beta3)
71+
actioncable (= 5.0.0.beta3)
72+
actionmailer (= 5.0.0.beta3)
73+
actionpack (= 5.0.0.beta3)
74+
actionview (= 5.0.0.beta3)
75+
activejob (= 5.0.0.beta3)
76+
activemodel (= 5.0.0.beta3)
77+
activerecord (= 5.0.0.beta3)
78+
activesupport (= 5.0.0.beta3)
79+
bundler (>= 1.3.0, < 2.0)
80+
railties (= 5.0.0.beta3)
81+
sprockets-rails (>= 2.0.0)
82+
rails-deprecated_sanitizer (1.0.3)
83+
activesupport (>= 4.2.0.alpha)
84+
rails-dom-testing (1.0.7)
85+
activesupport (>= 4.2.0.beta, < 5.0)
86+
nokogiri (~> 1.6.0)
87+
rails-deprecated_sanitizer (>= 1.0.1)
88+
rails-html-sanitizer (1.0.3)
89+
loofah (~> 2.0)
90+
railties (5.0.0.beta3)
91+
actionpack (= 5.0.0.beta3)
92+
activesupport (= 5.0.0.beta3)
93+
method_source
94+
rake (>= 0.8.7)
95+
thor (>= 0.18.1, < 2.0)
96+
rake (10.5.0)
97+
rb-fsevent (0.9.7)
98+
rb-inotify (0.9.7)
99+
ffi (>= 0.5.0)
100+
spring (1.6.4)
101+
spring-watcher-listen (2.0.0)
102+
listen (>= 2.7, < 4.0)
103+
spring (~> 1.2)
104+
sprockets (3.5.2)
105+
concurrent-ruby (~> 1.0)
106+
rack (> 1, < 3)
107+
sprockets-rails (3.0.3)
108+
actionpack (>= 4.0)
109+
activesupport (>= 4.0)
110+
sprockets (>= 3.0.0)
111+
sqlite3 (1.3.11)
112+
thor (0.19.1)
113+
thread_safe (0.3.5)
114+
tzinfo (1.2.2)
115+
thread_safe (~> 0.1)
116+
websocket-driver (0.6.3)
117+
websocket-extensions (>= 0.1.0)
118+
websocket-extensions (0.1.2)
119+
120+
PLATFORMS
121+
ruby
122+
123+
DEPENDENCIES
124+
byebug
125+
listen (~> 3.0.5)
126+
puma
127+
rails (>= 5.0.0.beta3, < 5.1)
128+
spring
129+
spring-watcher-listen (~> 2.0.0)
130+
sqlite3
131+
tzinfo-data
132+
133+
BUNDLED WITH
134+
1.11.2

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## README
2+
3+
This README would normally document whatever steps are necessary to get the
4+
application up and running.
5+
6+
Things you may want to cover:
7+
8+
* Ruby version
9+
10+
* System dependencies
11+
12+
* Configuration
13+
14+
* Database creation
15+
16+
* Database initialization
17+
18+
* How to run the test suite
19+
20+
* Services (job queues, cache servers, search engines, etc.)
21+
22+
* Deployment instructions
23+
24+
* ...

Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require File.expand_path('../config/application', __FILE__)
5+
6+
Rails.application.load_tasks
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2+
module ApplicationCable
3+
class Channel < ActionCable::Channel::Base
4+
end
5+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2+
module ApplicationCable
3+
class Connection < ActionCable::Connection::Base
4+
end
5+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::API
2+
end

app/controllers/clients_controller.rb

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
class ClientsController < ApplicationController
2+
before_action :set_client, only: [:show, :update, :destroy]
3+
4+
# GET /clients
5+
def index
6+
@clients = Client.all
7+
8+
render json: @clients
9+
end
10+
11+
# GET /clients/1
12+
def show
13+
render json: @client
14+
end
15+
16+
# POST /clients
17+
def create
18+
@client = Client.new(client_params)
19+
20+
if @client.save
21+
render json: @client, status: :created, location: @client
22+
else
23+
render json: @client.errors, status: :unprocessable_entity
24+
end
25+
end
26+
27+
# PATCH/PUT /clients/1
28+
def update
29+
if @client.update(client_params)
30+
render json: @client
31+
else
32+
render json: @client.errors, status: :unprocessable_entity
33+
end
34+
end
35+
36+
# DELETE /clients/1
37+
def destroy
38+
@client.destroy
39+
end
40+
41+
private
42+
# Use callbacks to share common setup or constraints between actions.
43+
def set_client
44+
@client = Client.find(params[:id])
45+
end
46+
47+
# Only allow a trusted parameter "white list" through.
48+
def client_params
49+
params.require(:client).permit(:notes, :rating)
50+
end
51+
end

app/controllers/concerns/.keep

Whitespace-only changes.

app/controllers/people_controller.rb

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
class PeopleController < ApplicationController
2+
before_action :set_person, only: [:show, :update, :destroy]
3+
4+
# GET /people
5+
def index
6+
@people = Person.all
7+
8+
render json: @people
9+
end
10+
11+
# GET /people/1
12+
def show
13+
render json: @person
14+
end
15+
16+
# POST /people
17+
def create
18+
@person = Person.new(person_params)
19+
20+
if @person.save
21+
render json: @person, status: :created, location: @person
22+
else
23+
render json: @person.errors, status: :unprocessable_entity
24+
end
25+
end
26+
27+
# PATCH/PUT /people/1
28+
def update
29+
if @person.update(person_params)
30+
render json: @person
31+
else
32+
render json: @person.errors, status: :unprocessable_entity
33+
end
34+
end
35+
36+
# DELETE /people/1
37+
def destroy
38+
@person.destroy
39+
end
40+
41+
private
42+
# Use callbacks to share common setup or constraints between actions.
43+
def set_person
44+
@person = Person.find(params[:id])
45+
end
46+
47+
# Only allow a trusted parameter "white list" through.
48+
def person_params
49+
params.require(:person).permit(:name, :email, :phone, :address)
50+
end
51+
end

app/controllers/users_controller.rb

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
class UsersController < ApplicationController
2+
before_action :set_user, only: [:show, :update, :destroy]
3+
4+
# GET /users
5+
def index
6+
@users = User.all
7+
8+
render json: @users
9+
end
10+
11+
# GET /users/1
12+
def show
13+
render json: @user
14+
end
15+
16+
# POST /users
17+
def create
18+
@user = User.new(user_params)
19+
20+
if @user.save
21+
render json: @user, status: :created, location: @user
22+
else
23+
render json: @user.errors, status: :unprocessable_entity
24+
end
25+
end
26+
27+
# PATCH/PUT /users/1
28+
def update
29+
if @user.update(user_params)
30+
render json: @user
31+
else
32+
render json: @user.errors, status: :unprocessable_entity
33+
end
34+
end
35+
36+
# DELETE /users/1
37+
def destroy
38+
@user.destroy
39+
end
40+
41+
private
42+
# Use callbacks to share common setup or constraints between actions.
43+
def set_user
44+
@user = User.find(params[:id])
45+
end
46+
47+
# Only allow a trusted parameter "white list" through.
48+
def user_params
49+
params.require(:user).permit(:user_name, :password_hash)
50+
end
51+
end

app/jobs/application_job.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationJob < ActiveJob::Base
2+
end

app/mailers/application_mailer.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationMailer < ActionMailer::Base
2+
default from: '[email protected]'
3+
layout 'mailer'
4+
end

app/models/application_record.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

app/models/client.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Client < ApplicationRecord
2+
belongs_to :person
3+
end

app/models/concerns/.keep

Whitespace-only changes.

app/models/person.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Person < ApplicationRecord
2+
has_many :clients, dependent: :destroy
3+
has_many :users, dependent: :destroy
4+
end

app/models/user.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class User < ApplicationRecord
2+
belongs_to :person
3+
end

0 commit comments

Comments
 (0)