embulk-output-google_spreadsheets 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b0771007e0a70a86fa020c1715a66a925aace4c
4
- data.tar.gz: ed7c90740ecde87682b5d0895bb9eaa8089c3a1b
3
+ metadata.gz: cc9d14ac105120b4957aea38c2d55b04c92a6e1c
4
+ data.tar.gz: 47d8da8bc92ab354da600cf44f7f6a2f08ad5e1d
5
5
  SHA512:
6
- metadata.gz: b047ba835394f811bc16521315f822a7a57fb05ead9cf89f469954594df55bb39885b9affc8ccdafa1b808be79f6b00bbe5f4df0f99111708b7e7fa84da561e0
7
- data.tar.gz: d87daff65e9aabc9466e1521e1410b59d672abc8a065273874251034a7199e4c60eb90d7e0704b8bb82b73e8418e72e8574b4277eee5aa2ff0bca2406d60f830
6
+ metadata.gz: 2ba749b2bcea3a1577b82c26b40ed1099c3d22a6bddb72de531935aaac857a3cbfe28b2fe9fb3e404dc23be15e67b87a6af86067e312a9e411ea842ad0fa44fa
7
+ data.tar.gz: 67b8204840acc560cdd38e3ec2c2fa821c676716cae8213c8bd192a94363ba44f2b1ee0c447988b0f812b40c2eb0480da98026e749e88325b07292710b60e7f9
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: java
2
+ jdk:
3
+ - oraclejdk8
4
+ sudo: false
5
+ script:
6
+ - ./gradlew --info check
7
+ - ./gradlew --info test
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Google Spreadsheets output plugin for Embulk
1
+ # Google Spreadsheets output plugin for Embulk [![Build Status](https://travis-ci.org/kataring/embulk-output-google_spreadsheets.svg?branch=master)](https://travis-ci.org/kataring/embulk-output-google_spreadsheets) [![Gem Version](https://badge.fury.io/rb/embulk-output-google_spreadsheets.svg)](http://badge.fury.io/rb/embulk-output-google_spreadsheets)
2
2
 
3
3
  Embulk output plugin to load into Google Spreadsheets.
4
4
 
@@ -11,23 +11,23 @@ Embulk output plugin to load into Google Spreadsheets.
11
11
 
12
12
  ## Configuration
13
13
 
14
- - **email**: description (string, required)
15
- - **p12file**: description (string, required)
16
- - **key**: description (string, required)
14
+ - **service_account_email**: description (string, required)
15
+ - **p12_keyfile**: description (string, required)
16
+ - **spreadsheet_id**: description (string, required)
17
17
 
18
18
  ## Example
19
19
 
20
20
  ```yaml
21
21
  out:
22
22
  type: google_spreadsheets
23
- email: 'XXXXXXXXXXXXXXXXXXXXXXXX@developer.gserviceaccount.com'
24
- p12file: '/tmp/embulk.p12'
25
- key: '1RPXaB85DXM7sGlpFYIcpoD2GWFpktgh0jBHlF4m1a0A'
23
+ service_account_email: 'XXXXXXXXXXXXXXXXXXXXXXXX@developer.gserviceaccount.com'
24
+ p12_keyfile: '/tmp/embulk.p12'
25
+ spreadsheet_id: '1RPXaB85DXM7sGlpFYIcpoD2GWFpktgh0jBHlF4m1a0A'
26
26
  ```
27
27
 
28
28
 
29
29
  ## Build
30
30
 
31
31
  ```
32
- $ ./gradlew gem # -t to watch change of files and rebuild continuously
32
+ $ ./gradlew gem
33
33
  ```
data/build.gradle CHANGED
@@ -12,7 +12,7 @@ configurations {
12
12
  provided
13
13
  }
14
14
 
15
- version = "0.1.0"
15
+ version = "0.1.1"
16
16
 
17
17
  dependencies {
18
18
  compile "org.embulk:embulk-core:0.7.4"
@@ -39,18 +39,22 @@ public class GoogleSpreadsheetsOutputPlugin
39
39
  public interface PluginTask
40
40
  extends Task
41
41
  {
42
- @Config("email")
43
- public String getEmail();
42
+ @Config("service_account_email")
43
+ public String getServiceAccountEmail();
44
44
 
45
- @Config("key")
46
- public String getKey();
45
+ @Config("spreadsheet_id")
46
+ public String getSpreadsheetId();
47
47
 
48
- @Config("p12file")
49
- public String getP12file();
48
+ @Config("p12_keyfile")
49
+ public String getP12Keyfile();
50
50
 
51
- @Config("sheet")
51
+ @Config("sheet_index")
52
52
  @ConfigDefault("0")
53
- public int getSheet();
53
+ public int getSheetIndex();
54
+
55
+ @Config("application_name")
56
+ @ConfigDefault("\"Embulk-GoogleSpreadsheets-OutputPlugin\"")
57
+ public String getApplicationName();
54
58
  }
55
59
 
56
60
  private final Logger log;
@@ -95,13 +99,12 @@ public class GoogleSpreadsheetsOutputPlugin
95
99
  {
96
100
  HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
97
101
  JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
98
- //GoogleClientSecrets secret = GoogleClientSecrets.load(jsonFactory, new FileReader("/tmp/embulk.json"));
99
102
  List<String> scopes = Arrays.asList(DriveScopes.DRIVE, "https://spreadsheets.google.com/feeds");
100
103
 
101
104
  return new GoogleCredential.Builder().setTransport(httpTransport)
102
105
  .setJsonFactory(jsonFactory)
103
- .setServiceAccountId(task.getEmail())
104
- .setServiceAccountPrivateKeyFromP12File(new File(task.getP12file()))
106
+ .setServiceAccountId(task.getServiceAccountEmail())
107
+ .setServiceAccountPrivateKeyFromP12File(new File(task.getP12Keyfile()))
105
108
  .setServiceAccountScopes(scopes)
106
109
  .build();
107
110
  }
@@ -125,17 +128,16 @@ public class GoogleSpreadsheetsOutputPlugin
125
128
  public GoogleSpreadsheetsPageOutput(PluginTask task) {
126
129
  try {
127
130
  GoogleCredential credentials = getServiceAccountCredential(task);
128
- //credentials.refreshToken();
129
- service = new SpreadsheetService("embulk-test");
131
+ service = new SpreadsheetService(task.getApplicationName());
130
132
  service.setProtocolVersion(SpreadsheetService.Versions.V3);
131
133
  service.setOAuth2Credentials(credentials);
132
134
 
133
- URL entryUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/" + task.getKey());
135
+ URL entryUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/" + task.getSpreadsheetId());
134
136
  SpreadsheetEntry spreadsheet = service.getEntry(entryUrl, SpreadsheetEntry.class);
135
137
 
136
138
  WorksheetFeed worksheetFeed = service.getFeed(spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class);
137
139
  List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
138
- worksheet = worksheets.get(task.getSheet());
140
+ worksheet = worksheets.get(task.getSheetIndex());
139
141
  }
140
142
  catch (ServiceException e) {
141
143
  throw new RuntimeException(e);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-google_spreadsheets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noriaki Katayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-25 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - .gitignore
49
+ - .travis.yml
49
50
  - LICENSE.txt
50
51
  - README.md
51
52
  - build.gradle
@@ -60,7 +61,7 @@ files:
60
61
  - classpath/commons-codec-1.3.jar
61
62
  - classpath/commons-logging-1.1.1.jar
62
63
  - classpath/core-1.47.1.jar
63
- - classpath/embulk-output-google_spreadsheets-0.1.0.jar
64
+ - classpath/embulk-output-google_spreadsheets-0.1.1.jar
64
65
  - classpath/google-api-client-1.20.0.jar
65
66
  - classpath/google-api-services-drive-v2-rev184-1.20.0.jar
66
67
  - classpath/google-http-client-1.20.0.jar