Module: Googletastic
- Defined in:
- lib/googletastic.rb
Defined Under Namespace
Modules: Analytics, Helpers, Mixins, PrettyPrint, Sync Classes: AccessRule, Album, AppEngine, Apps, Attendee, Base, Calendar, Comment, Document, Event, Form, Group, Head, Image, Person, Row, Spreadsheet, Table, Thumbnail, Worksheet
Constant Summary collapse
- VERSION =
:stopdoc:
'0.0.5.2'
Class Attribute Summary collapse
-
.clients ⇒ Object
Returns the value of attribute clients.
-
.keys ⇒ Object
Returns the value of attribute keys.
-
.options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
- .[](value) ⇒ Object
- .client_for(model) ⇒ Object
- .credentials ⇒ Object
- .options_for(klass, value = {}) ⇒ Object
Class Attribute Details
.clients ⇒ Object
Returns the value of attribute clients.
64 65 66 |
# File 'lib/googletastic.rb', line 64 def clients @clients end |
.keys ⇒ Object
Returns the value of attribute keys.
64 65 66 |
# File 'lib/googletastic.rb', line 64 def keys @keys end |
.options ⇒ Object
Returns the value of attribute options.
64 65 66 |
# File 'lib/googletastic.rb', line 64 def @options end |
Class Method Details
.[](value) ⇒ Object
96 97 98 |
# File 'lib/googletastic.rb', line 96 def self.[](value) self.(value) end |
.client_for(model) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/googletastic.rb', line 74 def self.client_for(model) self.clients ||= {} model = model.to_sym return self.clients[model] if self.clients.has_key?(model) client = ("GData::Client::#{model.to_s.camelize}").constantize.new(:source => credentials[:application]) client.clientlogin(credentials[:username], credentials[:password], nil, nil, nil, credentials[:account_type]) self.clients[model] = client end |
.credentials ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/googletastic.rb', line 66 def self.credentials return self.keys if self.keys config_file = "#{RAILS_ROOT}/config/gdata.yml" raise "Sorry, you must have #{config_file}" unless File.exists?(config_file) self.keys = YAML.load_file(config_file).symbolize_keys end |
.options_for(klass, value = {}) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/googletastic.rb', line 83 def self.(klass, value = {}) self. ||= {} klass = klass.is_a?(Class) ? klass : klass.class name = klass.to_s.underscore.downcase.to_sym if value and !value.blank? value.symbolize_keys! self.[name] = value else self.[name] ||= {} end self.[name] end |