{"action":"created","comment":{"url":"https://api.github.com/repos/greencommons/commons/pulls/comments/97092148","pull_request_review_id":17697481,"id":97092148,"diff_hunk":"@@ -0,0 +1,52 @@\n+require 'aws-sdk'\n+require 'tempfile'\n+\n+class ProcessFilesInS3BucketFolders\n+  def initialize(bucket_name, prefix_folders, file_ext)\n+    @bucket_name = bucket_name\n+    @prefix_folders = prefix_folders\n+    @file_ext = file_ext\n+  end\n+\n+  def each\n+    filtered_files.each do |file_key|\n+      Tempfile.open('s3data', dir, binmode: true) do |tempfile|\n+        s3.get_object(\n+          response_target: tempfile.path,\n+          bucket: bucket_name,\n+          key: file_key,\n+        )\n+\n+        yield(tempfile, file_key)\n+      end\n+    end\n+  end\n+\n+  private\n+\n+  attr_reader :bucket_name, :prefix_folders, :file_ext\n+\n+  def dir\n+    \"#{Rails.root}/tmp\"\n+  end\n+\n+  def filtered_files\n+    file_keys.grep(/#{file_ext}/)\n+  end\n+\n+  def file_keys\n+    arr = []\n+    @prefix_folders.each do |prefix_folder|","path":"lib/etl/extract/process_files_in_s3_bucket_folders.rb","position":39,"original_position":39,"commit_id":"57f513ae0869847fb9d36343290a0414ff4c0a73","original_commit_id":"57f513ae0869847fb9d36343290a0414ff4c0a73","user":{"login":"gtourtellot","id":9680325,"avatar_url":"https://avatars.githubusercontent.com/u/9680325?v=3","gravatar_id":"","url":"https://api.github.com/users/gtourtellot","html_url":"https://github.com/gtourtellot","followers_url":"https://api.github.com/users/gtourtellot/followers","following_url":"https://api.github.com/users/gtourtellot/following{/other_user}","gists_url":"https://api.github.com/users/gtourtellot/gists{/gist_id}","starred_url":"https://api.github.com/users/gtourtellot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtourtellot/subscriptions","organizations_url":"https://api.github.com/users/gtourtellot/orgs","repos_url":"https://api.github.com/users/gtourtellot/repos","events_url":"https://api.github.com/users/gtourtellot/events{/privacy}","received_events_url":"https://api.github.com/users/gtourtellot/received_events","type":"User","site_admin":false},"body":"OK, good tips, I'll make those changes.","created_at":"2017-01-20T15:23:48Z","updated_at":"2017-01-20T15:23:48Z","html_url":"https://github.com/greencommons/commons/pull/109#discussion_r97092148","pull_request_url":"https://api.github.com/repos/greencommons/commons/pulls/109","_links":{"self":{"href":"https://api.github.com/repos/greencommons/commons/pulls/comments/97092148"},"html":{"href":"https://github.com/greencommons/commons/pull/109#discussion_r97092148"},"pull_request":{"href":"https://api.github.com/repos/greencommons/commons/pulls/109"}}},"pull_request":{"url":"https://api.github.com/repos/greencommons/commons/pulls/109","id":101761644,"html_url":"https://github.com/greencommons/commons/pull/109","diff_url":"https://github.com/greencommons/commons/pull/109.diff","patch_url":"https://github.com/greencommons/commons/pull/109.patch","issue_url":"https://api.github.com/repos/greencommons/commons/issues/109","number":109,"state":"open","locked":false,"title":"Add support for ETL of JSON resource and group data.","user":{"login":"gtourtellot","id":9680325,"avatar_url":"https://avatars.githubusercontent.com/u/9680325?v=3","gravatar_id":"","url":"https://api.github.com/users/gtourtellot","html_url":"https://github.com/gtourtellot","followers_url":"https://api.github.com/users/gtourtellot/followers","following_url":"https://api.github.com/users/gtourtellot/following{/other_user}","gists_url":"https://api.github.com/users/gtourtellot/gists{/gist_id}","starred_url":"https://api.github.com/users/gtourtellot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtourtellot/subscriptions","organizations_url":"https://api.github.com/users/gtourtellot/orgs","repos_url":"https://api.github.com/users/gtourtellot/repos","events_url":"https://api.github.com/users/gtourtellot/events{/privacy}","received_events_url":"https://api.github.com/users/gtourtellot/received_events","type":"User","site_admin":false},"body":"* ETL.md shows rakes to use and new ETL files.\r\n* Groups and Resources JSON schema are compatible with and extend db/schema.rb defs.\r\n* Local data in lib/etl/data are useful for simple tests.\r\n* Ingestion of JSON from S3 is supported.\r\n* S3 JSON data derives from sources including EPUBs augmented with ONIX data.","created_at":"2017-01-16T21:35:12Z","updated_at":"2017-01-20T15:23:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c712d330748506fda01cb3d8e4d3bf9b88fb97f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/greencommons/commons/pulls/109/commits","review_comments_url":"https://api.github.com/repos/greencommons/commons/pulls/109/comments","review_comment_url":"https://api.github.com/repos/greencommons/commons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greencommons/commons/issues/109/comments","statuses_url":"https://api.github.com/repos/greencommons/commons/statuses/57f513ae0869847fb9d36343290a0414ff4c0a73","head":{"label":"greencommons:gt-etl-json","ref":"gt-etl-json","sha":"57f513ae0869847fb9d36343290a0414ff4c0a73","user":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"repo":{"id":69374875,"name":"commons","full_name":"greencommons/commons","owner":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greencommons/commons","description":null,"fork":false,"url":"https://api.github.com/repos/greencommons/commons","forks_url":"https://api.github.com/repos/greencommons/commons/forks","keys_url":"https://api.github.com/repos/greencommons/commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greencommons/commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greencommons/commons/teams","hooks_url":"https://api.github.com/repos/greencommons/commons/hooks","issue_events_url":"https://api.github.com/repos/greencommons/commons/issues/events{/number}","events_url":"https://api.github.com/repos/greencommons/commons/events","assignees_url":"https://api.github.com/repos/greencommons/commons/assignees{/user}","branches_url":"https://api.github.com/repos/greencommons/commons/branches{/branch}","tags_url":"https://api.github.com/repos/greencommons/commons/tags","blobs_url":"https://api.github.com/repos/greencommons/commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greencommons/commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greencommons/commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/greencommons/commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greencommons/commons/statuses/{sha}","languages_url":"https://api.github.com/repos/greencommons/commons/languages","stargazers_url":"https://api.github.com/repos/greencommons/commons/stargazers","contributors_url":"https://api.github.com/repos/greencommons/commons/contributors","subscribers_url":"https://api.github.com/repos/greencommons/commons/subscribers","subscription_url":"https://api.github.com/repos/greencommons/commons/subscription","commits_url":"https://api.github.com/repos/greencommons/commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/greencommons/commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/greencommons/commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/greencommons/commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/greencommons/commons/contents/{+path}","compare_url":"https://api.github.com/repos/greencommons/commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greencommons/commons/merges","archive_url":"https://api.github.com/repos/greencommons/commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greencommons/commons/downloads","issues_url":"https://api.github.com/repos/greencommons/commons/issues{/number}","pulls_url":"https://api.github.com/repos/greencommons/commons/pulls{/number}","milestones_url":"https://api.github.com/repos/greencommons/commons/milestones{/number}","notifications_url":"https://api.github.com/repos/greencommons/commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greencommons/commons/labels{/name}","releases_url":"https://api.github.com/repos/greencommons/commons/releases{/id}","deployments_url":"https://api.github.com/repos/greencommons/commons/deployments","created_at":"2016-09-27T16:07:48Z","updated_at":"2016-12-02T22:59:42Z","pushed_at":"2017-01-20T14:19:09Z","git_url":"git://github.com/greencommons/commons.git","ssh_url":"git@github.com:greencommons/commons.git","clone_url":"https://github.com/greencommons/commons.git","svn_url":"https://github.com/greencommons/commons","homepage":"http://greencommons.herokuapp.com","size":537,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":14,"forks":1,"open_issues":14,"watchers":2,"default_branch":"master"}},"base":{"label":"greencommons:master","ref":"master","sha":"ae603e2949e743d917367f732f513c71b8f559b3","user":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"repo":{"id":69374875,"name":"commons","full_name":"greencommons/commons","owner":{"login":"greencommons","id":18314434,"avatar_url":"https://avatars.githubusercontent.com/u/18314434?v=3","gravatar_id":"","url":"https://api.github.com/users/greencommons","html_url":"https://github.com/greencommons","followers_url":"https://api.github.com/users/greencommons/followers","following_url":"https://api.github.com/users/greencommons/following{/other_user}","gists_url":"https://api.github.com/users/greencommons/gists{/gist_id}","starred_url":"https://api.github.com/users/greencommons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greencommons/subscriptions","organizations_url":"https://api.github.com/users/greencommons/orgs","repos_url":"https://api.github.com/users/greencommons/repos","events_url":"https://api.github.com/users/greencommons/events{/privacy}","received_events_url":"https://api.github.com/users/greencommons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greencommons/commons","description":null,"fork":false,"url":"https://api.github.com/repos/greencommons/commons","forks_url":"https://api.github.com/repos/greencommons/commons/forks","keys_url":"https://api.github.com/repos/greencommons/commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greencommons/commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greencommons/commons/teams","hooks_url":"https://api.github.com/repos/greencommons/commons/hooks","issue_events_url":"https://api.github.com/repos/greencommons/commons/issues/events{/number}","events_url":"https://api.github.com/repos/greencommons/commons/events","assignees_url":"https://api.github.com/repos/greencommons/commons/assignees{/user}","branches_url":"https://api.github.com/repos/greencommons/commons/branches{/branch}","tags_url":"https://api.github.com/repos/greencommons/commons/tags","blobs_url":"https://api.github.com/repos/greencommons/commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greencommons/commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greencommons/commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/greencommons/commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greencommons/commons/statuses/{sha}","languages_url":"https://api.github.com/repos/greencommons/commons/languages","stargazers_url":"https://api.github.com/repos/greencommons/commons/stargazers","contributors_url":"https://api.github.com/repos/greencommons/commons/contributors","subscribers_url":"https://api.github.com/repos/greencommons/commons/subscribers","subscription_url":"https://api.github.com/repos/greencommons/commons/subscription","commits_url":"https://api.github.com/repos/greencommons/commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/greencommons/commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/greencommons/commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/greencommons/commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/greencommons/commons/contents/{+path}","compare_url":"https://api.github.com/repos/greencommons/commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greencommons/commons/merges","archive_url":"https://api.github.com/repos/greencommons/commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greencommons/commons/downloads","issues_url":"https://api.github.com/repos/greencommons/commons/issues{/number}","pulls_url":"https://api.github.com/repos/greencommons/commons/pulls{/number}","milestones_url":"https://api.github.com/repos/greencommons/commons/milestones{/number}","notifications_url":"https://api.github.com/repos/greencommons/commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greencommons/commons/labels{/name}","releases_url":"https://api.github.com/repos/greencommons/commons/releases{/id}","deployments_url":"https://api.github.com/repos/greencommons/commons/deployments","created_at":"2016-09-27T16:07:48Z","updated_at":"2016-12-02T22:59:42Z","pushed_at":"2017-01-20T14:19:09Z","git_url":"git://github.com/greencommons/commons.git","ssh_url":"git@github.com:greencommons/commons.git","clone_url":"https://github.com/greencommons/commons.git","svn_url":"https://github.com/greencommons/commons","homepage":"http://greencommons.herokuapp.com","size":537,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":14,"forks":1,"open_issues":14,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greencommons/commons/pulls/109"},"html":{"href":"https://github.com/greencommons/commons/pull/109"},"issue":{"href":"https://api.github.com/repos/greencommons/commons/issues/109"},"comments":{"href":"https://api.github.com/repos/greencommons/commons/issues/109/comments"},"review_comments":{"href":"https://api.github.com/repos/greencommons/commons/pulls/109/comments"},"review_comment":{"href":"https://api.github.com/repos/greencommons/commons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greencommons/commons/pulls/109/commits"},"statuses":{"href":"https://api.github.com/repos/greencommons/commons/statuses/57f513ae0869847fb9d36343290a0414ff4c0a73"}}}}
{"actor":{"display_login":"gtourtellot"}}