Class: Picasa::API::Base
- Inherits:
-
Object
- Object
- Picasa::API::Base
- Defined in:
- lib/picasa/api/base.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#authorization_header ⇒ Object
readonly
Returns the value of attribute authorization_header.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
- #auth_header ⇒ Object
-
#initialize(credentials = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(credentials = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/picasa/api/base.rb', line 9 def initialize(credentials = {}) @user_id = credentials.fetch(:user_id) @access_token = credentials[:access_token] = credentials[:authorization_header] end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/picasa/api/base.rb', line 4 def access_token @access_token end |
#authorization_header ⇒ Object (readonly)
Returns the value of attribute authorization_header.
4 5 6 |
# File 'lib/picasa/api/base.rb', line 4 def end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/picasa/api/base.rb', line 4 def user_id @user_id end |
Instance Method Details
#auth_header ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/picasa/api/base.rb', line 15 def auth_header {}.tap do |header| token = if access_token "Bearer #{access_token}" elsif end header["Authorization"] = token if token end end |