baseapi 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 904662daeeb12fb565077b6839548daf20315418
4
- data.tar.gz: ed9edb5d2ffcf324b1e5b9fb42e59792ba16d0f3
3
+ metadata.gz: b486cc640688c880add31f0b1df884a6d4081d6f
4
+ data.tar.gz: 9f5b742b010b10813ecd0e13597b6e4a89d16788
5
5
  SHA512:
6
- metadata.gz: 2d09018cba86a13be2b5df874be3cb00ea6df35c7f2fb2c907ff4f7169f1a236993f5490f15769a24b0c8c49a9bef74fb1f1b5cdc407184be7d410c5cc8420bf
7
- data.tar.gz: a19846ddb2a0d2b3add6dd48096835e90e8ea23d0f5d1fb096ea9da69b92063950c5ab4062597d1d4eff793833a9e047b2a3f65479cd34109035238e10db45ee
6
+ metadata.gz: ba207bcdb7d590eca91a3a549bd25067a9395a29eec03f2b5d6934a0f0e241192e86fb2fd04d92aaed60a5b5611237d442ec43a4733cff44115745fd7045641e
7
+ data.tar.gz: 33e784e1606e9dab1fb1d93fd11ffe1b3c3079f35f0d8b7692d8f3357f71c26667343ce386c117e29c1416845027b08403967263cea6af4af9b6c3ce9c0b8fbc
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Baseapi
2
2
 
3
- When you create a web application in the rails, If you want to CRUD operations in Ajax, might this gem is useful.
4
- We only define the empty Controller and Model for us to define the CRUD in.
3
+ Restful API Controller can make simply by include the Baseapi module to your Controller.
5
4
 
6
5
  ## Installation
7
6
 
@@ -21,21 +20,22 @@ Or install it yourself as:
21
20
 
22
21
  ## Usage
23
22
 
24
- Introduction create default JBuilder of view:
23
+ Introduction create default JBuilder of view.
25
24
 
26
25
  $ bundle exec baseapi setup
27
26
 
28
- Create a Model (app/models/user.rb):
27
+ Create a Model (app/models/user.rb)
29
28
 
30
29
  class User < ActiveRecord::Base
31
30
  end
32
31
 
33
- Extend the BaseApiController is when you create a Controller (app/controllers/users_controller.rb):
32
+ include the Baseapi module to Controller (app/controlers/users_controller.rb)
34
33
 
35
- class UsersController < BaseApiController
34
+ class UsersController < ApplicationController
35
+ include BaseApi
36
36
  end
37
37
 
38
- Routing configuration (config/routes.rb):
38
+ Routing configuration (config/routes.rb)
39
39
 
40
40
  constraints(:format => /json/) do
41
41
  resources :users, only:[:index, :show, :create, :update, :destroy]
@@ -334,8 +334,7 @@ You can request as follows in doing so
334
334
 
335
335
  ### Override
336
336
 
337
- You can corresponding to the logical deletion, if you want to search condition to like and or, you will be able to override the processing in the Model
338
-
337
+ you will be able to override the processing in the Model.
339
338
 
340
339
  Get all
341
340
 
@@ -451,10 +450,7 @@ The short so please read the [code](https://github.com/arakawamoriyuki/baseapi/b
451
450
 
452
451
  ### hook action (v0.1.4~)
453
452
 
454
- Controller of 'create, update, destroy' function in advance by attaching the prefix of before, you can post processing
455
- Delete the related table or may be useful for error handling
456
- It may be good even before_action, but you may use if you want to process in the transaction.
457
- It is always surrounded by model of transaction.
453
+ Controller of 'create, update, destroy' function in advance by attaching the prefix of before, you can post processing.
458
454
 
459
455
  class CompaniesController < BaseApiController
460
456
  # Name Required items
@@ -471,7 +467,8 @@ It is always surrounded by model of transaction.
471
467
  end
472
468
  end
473
469
 
474
- And if not sent the name to api in the above example, it returns an error in the json. Message is a string that was passed to raise.
470
+ And if not sent the name to api in the above example, it returns an error in the json.
471
+ Message is a string that was passed to raise.
475
472
 
476
473
  {
477
474
  error: true,
@@ -487,18 +484,18 @@ create JBuilder of view (0.1.17)
487
484
 
488
485
  Used by default [^2]
489
486
 
490
- /app/views/application/ooo.json.jbuilder # if include BaseApi
491
- /app/views/base_api/ooo.json.jbuilder # if extend BaseApi
487
+ /app/views/application/xxx.json.jbuilder # if include BaseApi
488
+ /app/views/base_api/xxx.json.jbuilder # if extend BaseApi
492
489
 
493
490
  but you can also make
494
491
 
495
- /app/views/{models}/ooo.json.jbuilder
492
+ /app/views/{models}/xxx.json.jbuilder
496
493
 
497
- It will return to a single data (action:show,create,delete,update)
494
+ It will return to a single data (action: show, create, delete, update)
498
495
 
499
496
  model.json.jbuilder
500
497
 
501
- It will return multiple data (action:index)
498
+ It will return multiple data (action: index)
502
499
 
503
500
  models.json.jbuilder
504
501
 
@@ -1,5 +1,4 @@
1
1
  class BaseApiController < ActionController::Base
2
- protect_from_forgery with: :exception
3
2
 
4
3
  before_action :set_Model
5
4
  before_action :set_models, only: [:index]
@@ -1,3 +1,3 @@
1
1
  module Baseapi
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baseapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moriyuki Arakawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler