class Yt::Collections::Authentications
@private
Attributes
auth_params[RW]
Private Instance Methods
attributes_for_new_item(data)
click to toggle source
# File lib/yt/collections/authentications.rb, line 12 def attributes_for_new_item(data) data['refresh_token'] ||= auth_params[:refresh_token] data end
expected?(error)
click to toggle source
# File lib/yt/collections/authentications.rb, line 42 def expected?(error) error.kind == 'invalid_grant' && invalid_code_errors.exclude?(error.description) end
invalid_code_errors()
click to toggle source
# File lib/yt/collections/authentications.rb, line 49 def invalid_code_errors ["Code was already redeemed.", "Invalid code."] end
list_params()
click to toggle source
Calls superclass method
# File lib/yt/collections/authentications.rb, line 17 def list_params super.tap do |params| params[:host] = 'accounts.google.com' params[:path] = '/o/oauth2/token' params[:request_format] = :form params[:method] = :post params[:auth] = nil params[:body] = auth_params params[:camelize_body] = false end end
more_pages?()
click to toggle source
# File lib/yt/collections/authentications.rb, line 29 def more_pages? auth_params.values.all? end
next_page()
click to toggle source
# File lib/yt/collections/authentications.rb, line 33 def next_page request = Yt::Request.new(list_params).tap do |request| print "#{request.as_curl}\n" if Yt.configuration.developing? end Array.wrap request.run.body rescue Yt::Error => error expected?(error) ? [] : raise(error) end