invitation 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0724862de922a3160c5377adb5b82c528338d99
4
- data.tar.gz: 4da9685c29934fac4f2032745cd82f26bfc4e659
3
+ metadata.gz: d20b7998d1b4e813f82b634d8ed324f3b3c4a250
4
+ data.tar.gz: 5e983a833985e6f7713a5ab2e51f901e768ae304
5
5
  SHA512:
6
- metadata.gz: 00cafe245f0461abbed65b703385fd947966f34ff3c5951ae5ec400b4afefae8c72a3a10094a76c7cc2e41b28efc2777e0825093e3db244fba460be42fe49a9b
7
- data.tar.gz: 7d4cf63f017e0df43630c5eced0746534f7805a4f68a8dc67d76078129c69f61514782b2ff21ca01a53457cba6e26c2182b70b0a68e34164979e5c58b957b958
6
+ metadata.gz: 8675a33a4639c43d14beaa2e50caf1113b032bea2b38b66e5fc7375dc9631fbd8c70762ca8bcf4017836ac565e3aa7b53b90b0ff3f48cccf9077efc1e81d26ad
7
+ data.tar.gz: 971bfcc4ac6f9d6cccd8544879513c93ae887c5a9a68f2180433ae53fd10001b6227f94acc0dbf588706cadbfe0bc5a4c88555725c2805948a03b6e91772ae67
@@ -1,5 +1,4 @@
1
1
  class Invitation::InvitesController < ApplicationController
2
-
3
2
  def new
4
3
  @invite = invite_from_params
5
4
  render template: 'invites/new'
@@ -8,7 +7,7 @@ class Invitation::InvitesController < ApplicationController
8
7
  def create
9
8
  @invite = invite_from_params
10
9
  @invite.sender_id = current_user.id
11
- logger.info '@invite: ' + @invite.inspect
10
+ logger.debug '@invite: ' + @invite.inspect
12
11
  if @invite.save
13
12
  #if the user already exists
14
13
  if @invite.recipient != nil
@@ -22,7 +21,10 @@ class Invitation::InvitesController < ApplicationController
22
21
  else
23
22
  flash[:error] = t('invitation.flash.invite_error')
24
23
  end
25
- redirect_to url_after_invite
24
+ respond_to do |format|
25
+ format.html { redirect_to url_after_invite }
26
+ format.json { render json: @invite.as_json(except: :token) }
27
+ end
26
28
  end
27
29
 
28
30
 
@@ -39,9 +41,9 @@ class Invitation::InvitesController < ApplicationController
39
41
  def after_invite_new_user
40
42
  end
41
43
 
42
- # Url sender is redirected to after creating invite.
44
+ #
43
45
  def url_after_invite
44
- Invitation.configuration.url_after_invite
46
+ @invite.invitable
45
47
  end
46
48
 
47
49
  # Build new Invite from params.
@@ -17,7 +17,7 @@ module Invitation
17
17
  # desc: "Specify the model class name if you will use anything other than 'User'"
18
18
 
19
19
  def verify
20
- if options[:model] && !File.exists?(model_path)
20
+ if options[:model] && !File.exist?(model_path)
21
21
  puts "Exiting: the model class you specified, #{options[:model]}, is not found."
22
22
  exit 1
23
23
  end
@@ -29,15 +29,6 @@ module Invitation
29
29
  attr_accessor :mailer_sender
30
30
 
31
31
 
32
- # Path that Invitation will redirect users to after an invitation is issued.
33
- #
34
- # Defaults to '/'
35
- #
36
- # Override the invites_controller method if a more complex url is required.
37
- # @return [String]
38
- attr_accessor :url_after_invite
39
-
40
-
41
32
  # Enable or disable Invitation's built-in routes.
42
33
  #
43
34
  # Defaults to 'true'.
@@ -55,7 +46,6 @@ module Invitation
55
46
  @user_model = ::User
56
47
  @user_registration_url = ->(params) { Rails.application.routes.url_helpers.sign_up_url(params) }
57
48
  @mailer_sender = 'reply@example.com'
58
- @url_after_invite = '/'
59
49
  @routes = true
60
50
  end
61
51
 
@@ -1,3 +1,3 @@
1
1
  module Invitation
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invitation
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
7
  - Justin Tomich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-09 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails