Class: Socialmux::Strategy

Inherits:
Object
  • Object
show all
Defined in:
lib/socialmux/strategy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Strategy

Returns a new instance of Strategy.



11
12
13
14
15
16
17
18
19
20
# File 'lib/socialmux/strategy.rb', line 11

def initialize(options)
  options.assert_valid_keys(:adapter,
                            :current_user,
                            :data,
                            :user_params)

  options.each do |key, value|
    instance_variable_set "@#{key}", value
  end
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



6
7
8
# File 'lib/socialmux/strategy.rb', line 6

def adapter
  @adapter
end

#current_userObject (readonly)

Returns the value of attribute current_user.



7
8
9
# File 'lib/socialmux/strategy.rb', line 7

def current_user
  @current_user
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/socialmux/strategy.rb', line 8

def data
  @data
end

#user_paramsObject (readonly)

Returns the value of attribute user_params.



9
10
11
# File 'lib/socialmux/strategy.rb', line 9

def user_params
  @user_params
end

Instance Method Details

#resultObject



22
23
24
25
26
27
28
# File 'lib/socialmux/strategy.rb', line 22

def result
  authentication_already_taken ||
  returning_user ||
  augmented_current_user ||
  augmented_user_with_same_email ||
  new_user
end