Class: Caly::Account
- Inherits:
-
Object
- Object
- Caly::Account
- Defined in:
- lib/caly/account.rb
Instance Attribute Summary collapse
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #caly_provider ⇒ Object
-
#initialize(provider, token) ⇒ Account
constructor
A new instance of Account.
- #list_calendars ⇒ Object
Constructor Details
#initialize(provider, token) ⇒ Account
Returns a new instance of Account.
5 6 7 8 9 10 11 12 |
# File 'lib/caly/account.rb', line 5 def initialize(provider, token) unless Caly::AVAILABLE_PROVIDERS.include?(provider.to_sym) raise ArgumentError.new("#{provider} isn't a supported provider.") end @provider = provider @token = token end |
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
3 4 5 |
# File 'lib/caly/account.rb', line 3 def provider @provider end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
3 4 5 |
# File 'lib/caly/account.rb', line 3 def token @token end |
Class Method Details
.caly_provider_for(name) ⇒ Object
14 15 16 |
# File 'lib/caly/account.rb', line 14 def self.caly_provider_for(name) Caly::Providers.const_get(Util.classify(name)) end |
Instance Method Details
#caly_provider ⇒ Object
18 19 20 |
# File 'lib/caly/account.rb', line 18 def caly_provider @caly_provider ||= self.class.caly_provider_for(provider).new(token) end |
#list_calendars ⇒ Object
22 23 24 |
# File 'lib/caly/account.rb', line 22 def list_calendars caly_provider.list_calendars end |