Class: OmniAuth::Strategies::Cafepress

Inherits:
Object
  • Object
show all
Includes:
OmniAuth::Strategy
Defined in:
lib/omniauth/strategies/cafepress.rb

Instance Method Summary collapse

Instance Method Details

#raw_infoObject



42
43
44
45
46
47
48
49
50
# File 'lib/omniauth/strategies/cafepress.rb', line 42

def raw_info
  @raw_info ||= MultiXml.parse(Faraday.get("#{options[:token_url]}?v=3&appKey=#{options[:app_key]}&email=#{request.params['email']}&password=#{request.params['password']}").body)
rescue ::MultiXml::ParseError => e
  fail!(:xml_error, e)
rescue ::Faraday::Error::TimeoutError => e
  fail!(:timeout, e)
rescue Exception
  fail! :general_exception
end

#request_phaseObject



15
16
17
18
19
20
21
22
# File 'lib/omniauth/strategies/cafepress.rb', line 15

def request_phase
  form = OmniAuth::Form.new(title: "User Info", url: callback_path)
  options.fields.each do |field|
    form.text_field field.to_s.capitalize.gsub("_", " "), field.to_s
  end
  form.button "Sign In"
  form.to_response
end