Class: Bstat2google::GoogleTarget
Instance Attribute Summary collapse
-
#col ⇒ Object
Returns the value of attribute col.
-
#gmail ⇒ Object
Returns the value of attribute gmail.
-
#mapped_cols ⇒ Object
Returns the value of attribute mapped_cols.
-
#password ⇒ Object
Returns the value of attribute password.
-
#row ⇒ Object
Returns the value of attribute row.
-
#sheet_id ⇒ Object
Returns the value of attribute sheet_id.
-
#timestamp_cell ⇒ Object
Returns the value of attribute timestamp_cell.
-
#worksheet_no ⇒ Object
Returns the value of attribute worksheet_no.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ GoogleTarget
constructor
A new instance of GoogleTarget.
- #write(bucket_stats) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ GoogleTarget
Returns a new instance of GoogleTarget.
69 70 71 |
# File 'lib/bstat2google.rb', line 69 def initialize(attrs = {}) attrs.each {|k,v| self.send("#{k}=", v)} end |
Instance Attribute Details
#col ⇒ Object
Returns the value of attribute col.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def col @col end |
#gmail ⇒ Object
Returns the value of attribute gmail.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def gmail @gmail end |
#mapped_cols ⇒ Object
Returns the value of attribute mapped_cols.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def mapped_cols @mapped_cols end |
#password ⇒ Object
Returns the value of attribute password.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def password @password end |
#row ⇒ Object
Returns the value of attribute row.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def row @row end |
#sheet_id ⇒ Object
Returns the value of attribute sheet_id.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def sheet_id @sheet_id end |
#timestamp_cell ⇒ Object
Returns the value of attribute timestamp_cell.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def end |
#worksheet_no ⇒ Object
Returns the value of attribute worksheet_no.
68 69 70 |
# File 'lib/bstat2google.rb', line 68 def worksheet_no @worksheet_no end |
Instance Method Details
#write(bucket_stats) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/bstat2google.rb', line 72 def write(bucket_stats) puts "-------------------------" puts "BucketId: #{bucket_stats.id}" puts "Error: #{bucket_stats.id}" if bucket_stats.error ap bucket_stats.kpis session = GoogleDrive.login(gmail, password) ws = session.spreadsheet_by_key(sheet_id).worksheets[worksheet_no.to_i] if mapped_cols.first == "USE_CATEGORIES" bucket_stats.kpis.keys.each_with_index do |kpi_value, i| ws[row.to_i, col.to_i+i] = kpi_value end else mapped_cols.each_with_index do |kpi_term, i| ws[row.to_i, col.to_i+i] = bucket_stats.kpis[kpi_term] end end ws[] = Time.now.strftime("%d/%m/%y %H:%M") ws.save end |