Class: OmniAuth::Strategies::Unsplash

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/unsplash.rb

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/omniauth/strategies/unsplash.rb', line 39

def authorize_params
  super.tap do |params|
    %w[ scope ].each do |v|
      if request.params[v]
        params[v.to_sym] = request.params[v]
      end
    end

    params[:scope] ||= 'public'
  end
end

#callback_urlObject



34
35
36
37
# File 'lib/omniauth/strategies/unsplash.rb', line 34

def callback_url
  options[:callback_url] ||
    (full_host + script_name + callback_path)
end

#raw_infoObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/omniauth/strategies/unsplash.rb', line 51

def raw_info
  if options[:extra_data]
    JSON.parse(access_token.get('/me').body)
  else
    {}
  end
  # TODO: catch correct RateLimiting exception
  # rescue JSON::ParseError
  #   {}
end