remotty-rails 0.0.1 → 0.0.2

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: 0775052ff14b274bde5cb2946958851c7679d547
4
- data.tar.gz: 9e29cbf6c8d47dfa73ae6717b985715a790ab400
3
+ metadata.gz: 3caea27a28a28b64f6ea59fdb326c9ea32f5e3ae
4
+ data.tar.gz: 03717a04e39d8f9814ea4777ac8c558a2710ec2d
5
5
  SHA512:
6
- metadata.gz: daba021256deb24ad4492d4f12c9ff94b96d616c989cf8076227c50e432aa990b73a12a49adc04a8619bcd28e98bc13f16bd7923b78138e84b252e8999f48b30
7
- data.tar.gz: 0a3b34fef53c7a60239b97f0cc47175d371c3092fca263d88cf7a3041832297b9a8f12160a6580b2b44b73861f82310877f79ccf1ca4089a26c44f084e683ca7
6
+ metadata.gz: ef893e27bed967ade7d6b626aeabf6b1dc5a78628199da80bb445b769419d78120e8aa3b502de5f35d2fd1cc412a707cc0afd661a96a92bed8fc064ce3623b82
7
+ data.tar.gz: 8d371b18d992246d7dd6bcd91b525e20c461bce541ef4d303fd25d0859ec71ccadcdcec2999d120e46f89a8e083164329b6c8db35104dc76acbb4aa8535e2312
data/README.md CHANGED
@@ -125,7 +125,7 @@ $ rake db:migrate
125
125
 
126
126
  * `config/routes.rb` update
127
127
 
128
- `devise_for :users`를 지우고 추가함
128
+ `devise_for :users` 부분을 수정
129
129
 
130
130
  ```ruby
131
131
  devise_for :users,
@@ -139,6 +139,11 @@ devise_for :users,
139
139
  confirmations: 'remotty/users/confirmations',
140
140
  passwords: 'remotty/users/passwords',
141
141
  omniauth_callbacks: 'remotty/users/omniauth_callbacks'}
142
+
143
+ devise_scope :user do
144
+ post 'api/v1/session/avatar' => 'users/registrations#avatar'
145
+ delete 'api/v1/session/avatar' => 'users/registrations#remove_avatar'
146
+ end
142
147
  ```
143
148
 
144
149
  ## Recommend Setting
@@ -167,21 +172,14 @@ config.action_mailer.default_url_options = { host: 'localhost:9000' }
167
172
  config.action_mailer.delivery_method = :letter_opener
168
173
  ```
169
174
 
175
+ ## Configuration
176
+
170
177
  ### custom mail view
171
178
 
172
179
 
173
180
  `views/devise/mailer/confirmation_instructions.html.erb` create
174
181
  `views/devise/mailer/reset_password_instructions.html.erb` create
175
182
 
176
-
177
- ### token 유효기간 변경
178
-
179
- `initializers/devise.rb` update
180
-
181
- ```ruby
182
- config.remember_for = 2.weeks
183
- ```
184
-
185
183
  ### omniauth setting
186
184
 
187
185
  `devise.rb` update
@@ -225,6 +223,14 @@ class ApplicationController < ActionController::API
225
223
  end
226
224
  ```
227
225
 
226
+ ### token 유효기간 변경
227
+
228
+ `initializers/devise.rb` update
229
+
230
+ ```ruby
231
+ config.remember_for = 2.weeks
232
+ ```
233
+
228
234
  ## Contributing
229
235
 
230
236
  1. Fork it ( https://github.com/remotty/remotty-rails/fork )
@@ -13,7 +13,9 @@ class Users::PasswordsController < Devise::PasswordsController
13
13
  yield resource if block_given?
14
14
 
15
15
  if successfully_sent?(resource)
16
- render nothing: true, status: :no_content
16
+ render json: {
17
+ msg: find_message("send_instructions")
18
+ }
17
19
  else
18
20
  render_error 'VALIDATION_ERROR', resource.errors.full_messages.first
19
21
  end
@@ -1,6 +1,6 @@
1
1
  class Remotty::Users::RegistrationsController < Devise::RegistrationsController
2
2
  include Remotty::Users::BaseController
3
-
3
+ before_action :authenticate_scope!, only: [:avatar, :remove_avatar]
4
4
  wrap_parameters :user, include: [:email, :name, :password, :password_confirmation, :current_password]
5
5
 
6
6
  # POST /resource
@@ -91,6 +91,32 @@ class Remotty::Users::RegistrationsController < Devise::RegistrationsController
91
91
  end
92
92
  end
93
93
 
94
+ # POST /resource/avatar
95
+ # 회원 프로필 이미지 수정
96
+ def avatar
97
+ resource.avatar = params[:file]
98
+
99
+ if resource.save
100
+ render json: resource
101
+ else
102
+ render_error 'VALIDATION_ERROR',
103
+ resource.errors.full_messages.first
104
+ end
105
+ end
106
+
107
+ # DELETE /resource/avatar
108
+ # 회원 프로필 이미지 삭제
109
+ def remove_avatar
110
+ resource.avatar = nil
111
+
112
+ if resource.save
113
+ render json: resource
114
+ else
115
+ render_error 'VALIDATION_ERROR',
116
+ resource.errors.full_messages.first
117
+ end
118
+ end
119
+
94
120
  # DELETE /resource
95
121
  # 회원탈퇴
96
122
  def destroy
@@ -24,6 +24,10 @@ module Remotty::Rails
24
24
  i18n_message
25
25
  end
26
26
  end
27
+
28
+ def respond
29
+ http_auth
30
+ end
27
31
  end
28
32
  end
29
33
  end
@@ -1,5 +1,5 @@
1
1
  module Remotty
2
2
  module Rails
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ require 'remotty/rails/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "remotty-rails"
8
8
  spec.version = Remotty::Rails::VERSION
9
- spec.authors = ["subicura", "bbugguj"]
9
+ spec.authors = ["Chungsub Kim", "Jaehue Jang"]
10
10
  spec.email = ["subicura@subicura.com", "bbugguj@gmail.com"]
11
11
  spec.summary = 'rails base package by remotty'
12
12
  spec.description = 'token based authentication and more useful library..'
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remotty-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - subicura
8
- - bbugguj
7
+ - Chungsub Kim
8
+ - Jaehue Jang
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-17 00:00:00.000000000 Z
12
+ date: 2014-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-cors