{"action":"created","comment":{"url":"https://api.github.com/repos/sul-dlss/dor-services/pulls/comments/82015367","pull_request_review_id":2952378,"id":82015367,"diff_hunk":"@@ -10,6 +10,58 @@ module Publishable\n     include Itemizable\n     include Rightsable\n \n+    # Compute the thumbnail for this object following the rules at https://consul.stanford.edu/display/chimera/The+Rules+of+Thumb\n+    # @return [String] the computed thumb filename, with the druid prefix and a slash in front of it, e.g. oo000oo0001/filenamewith space.jp2\n+    def thumb\n+       return if contentMetadata.nil?\n+       cm = contentMetadata.ng_xml\n+       mime_type_finder = \"@mimetype='image/jp2' or @mimeType='image/jp2'\" # allow the mimetype attribute to be lower or camelcase when searching to make it more robust\n+       thumb_image=nil\n+\n+       # these are the finders we will use to search for a thumb resource in contentMetadata, they will be searched in the order provided, stopping when one is reached\n+       thumb_xpath_finders = [\n+           {image_type: 'local', finder: \"/contentMetadata/resource[@type='thumb' and @thumb='yes']/file[#{mime_type_finder}]\"},      # first find a file of mimetype jp2 explicitly marked as a thumb in the resource type and with a thumb=yes attribute\n+           {image_type: 'external', finder: \"/contentMetadata/resource[@type='thumb' and @thumb='yes']/externalFile[#{mime_type_finder}]\"}, # same thing for external files\n+           {image_type: 'local', finder: \"/contentMetadata/resource[(@type='page' or @type='image') and @thumb='yes']/file[#{mime_type_finder}]\"},# next find any image or page resource types with the thumb=yes attribute of mimetype jp2\n+           {image_type: 'external', finder: \"/contentMetadata/resource[(@type='page' or @type='image') and @thumb='yes']/externalFile[#{mime_type_finder}]\"},# same thing for external file\n+           {image_type: 'local', finder: \"/contentMetadata/resource[@type='thumb']/file[#{mime_type_finder}]\"}, # next find a file of mimetype jp2 or resource type=thumb but no marked with the thumb directive\n+           {image_type: 'external', finder: \"/contentMetadata/resource[@type='thumb']/externalFile[#{mime_type_finder}]\"}, # same thing for external file\n+           {image_type: 'local', finder: \"/contentMetadata/resource[@type='page' or @type='image']/file[#{mime_type_finder}]\"}, # finally find the first very first page or image resource of mimetype jp2","path":"lib/dor/models/publishable.rb","position":20,"original_position":20,"commit_id":"d1da1abb8f77b1e09bca9df551e0dd5c0629c8d3","original_commit_id":"d1da1abb8f77b1e09bca9df551e0dd5c0629c8d3","user":{"login":"peetucket","id":47137,"avatar_url":"https://avatars.githubusercontent.com/u/47137?v=3","gravatar_id":"","url":"https://api.github.com/users/peetucket","html_url":"https://github.com/peetucket","followers_url":"https://api.github.com/users/peetucket/followers","following_url":"https://api.github.com/users/peetucket/following{/other_user}","gists_url":"https://api.github.com/users/peetucket/gists{/gist_id}","starred_url":"https://api.github.com/users/peetucket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peetucket/subscriptions","organizations_url":"https://api.github.com/users/peetucket/orgs","repos_url":"https://api.github.com/users/peetucket/repos","events_url":"https://api.github.com/users/peetucket/events{/privacy}","received_events_url":"https://api.github.com/users/peetucket/received_events","type":"User","site_admin":false},"body":"first, i think you are firstly correct","created_at":"2016-10-05T16:35:24Z","updated_at":"2016-10-05T16:35:24Z","html_url":"https://github.com/sul-dlss/dor-services/pull/237#discussion_r82015367","pull_request_url":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237","_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/dor-services/pulls/comments/82015367"},"html":{"href":"https://github.com/sul-dlss/dor-services/pull/237#discussion_r82015367"},"pull_request":{"href":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237"}}},"pull_request":{"url":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237","id":87558712,"html_url":"https://github.com/sul-dlss/dor-services/pull/237","diff_url":"https://github.com/sul-dlss/dor-services/pull/237.diff","patch_url":"https://github.com/sul-dlss/dor-services/pull/237.patch","issue_url":"https://api.github.com/repos/sul-dlss/dor-services/issues/237","number":237,"state":"open","locked":false,"title":"add a new thumb method to the object to parse the thumb image","user":{"login":"peetucket","id":47137,"avatar_url":"https://avatars.githubusercontent.com/u/47137?v=3","gravatar_id":"","url":"https://api.github.com/users/peetucket","html_url":"https://github.com/peetucket","followers_url":"https://api.github.com/users/peetucket/followers","following_url":"https://api.github.com/users/peetucket/following{/other_user}","gists_url":"https://api.github.com/users/peetucket/gists{/gist_id}","starred_url":"https://api.github.com/users/peetucket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peetucket/subscriptions","organizations_url":"https://api.github.com/users/peetucket/orgs","repos_url":"https://api.github.com/users/peetucket/repos","events_url":"https://api.github.com/users/peetucket/events{/privacy}","received_events_url":"https://api.github.com/users/peetucket/received_events","type":"User","site_admin":false},"body":"given set of rules specified here: https://consul.stanford.edu/display/chimera/The+Rules+of+Thumb\r\n\r\nalso add thumb value to public xml if it exists\r\n\r\nfixes #236 and sul-dlss/discovery-indexing#11","created_at":"2016-09-30T20:11:54Z","updated_at":"2016-10-05T16:35:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03b03f76a3979f2dbc8a115bb4576cd1dc3bb543","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237/commits","review_comments_url":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237/comments","review_comment_url":"https://api.github.com/repos/sul-dlss/dor-services/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sul-dlss/dor-services/issues/237/comments","statuses_url":"https://api.github.com/repos/sul-dlss/dor-services/statuses/d1da1abb8f77b1e09bca9df551e0dd5c0629c8d3","head":{"label":"sul-dlss:add-rule-of-thumb","ref":"add-rule-of-thumb","sha":"d1da1abb8f77b1e09bca9df551e0dd5c0629c8d3","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":4989143,"name":"dor-services","full_name":"sul-dlss/dor-services","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/dor-services","description":"Common DOR services, models, and utility classes used by the SULAIR Digital Library","fork":false,"url":"https://api.github.com/repos/sul-dlss/dor-services","forks_url":"https://api.github.com/repos/sul-dlss/dor-services/forks","keys_url":"https://api.github.com/repos/sul-dlss/dor-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/dor-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/dor-services/teams","hooks_url":"https://api.github.com/repos/sul-dlss/dor-services/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/dor-services/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/dor-services/events","assignees_url":"https://api.github.com/repos/sul-dlss/dor-services/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/dor-services/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/dor-services/tags","blobs_url":"https://api.github.com/repos/sul-dlss/dor-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/dor-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/dor-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/dor-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/dor-services/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/dor-services/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/dor-services/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/dor-services/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/dor-services/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/dor-services/subscription","commits_url":"https://api.github.com/repos/sul-dlss/dor-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/dor-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/dor-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/dor-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/dor-services/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/dor-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/dor-services/merges","archive_url":"https://api.github.com/repos/sul-dlss/dor-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/dor-services/downloads","issues_url":"https://api.github.com/repos/sul-dlss/dor-services/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/dor-services/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/dor-services/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/dor-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/dor-services/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/dor-services/releases{/id}","deployments_url":"https://api.github.com/repos/sul-dlss/dor-services/deployments","created_at":"2012-07-11T13:12:49Z","updated_at":"2016-09-07T00:38:56Z","pushed_at":"2016-10-04T18:55:10Z","git_url":"git://github.com/sul-dlss/dor-services.git","ssh_url":"git@github.com:sul-dlss/dor-services.git","clone_url":"https://github.com/sul-dlss/dor-services.git","svn_url":"https://github.com/sul-dlss/dor-services","homepage":null,"size":4063,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":46,"forks":1,"open_issues":46,"watchers":6,"default_branch":"master"}},"base":{"label":"sul-dlss:master","ref":"master","sha":"8fe792f4da4d43a58eced9d163fd9652a08fab51","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":4989143,"name":"dor-services","full_name":"sul-dlss/dor-services","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/dor-services","description":"Common DOR services, models, and utility classes used by the SULAIR Digital Library","fork":false,"url":"https://api.github.com/repos/sul-dlss/dor-services","forks_url":"https://api.github.com/repos/sul-dlss/dor-services/forks","keys_url":"https://api.github.com/repos/sul-dlss/dor-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/dor-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/dor-services/teams","hooks_url":"https://api.github.com/repos/sul-dlss/dor-services/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/dor-services/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/dor-services/events","assignees_url":"https://api.github.com/repos/sul-dlss/dor-services/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/dor-services/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/dor-services/tags","blobs_url":"https://api.github.com/repos/sul-dlss/dor-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/dor-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/dor-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/dor-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/dor-services/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/dor-services/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/dor-services/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/dor-services/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/dor-services/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/dor-services/subscription","commits_url":"https://api.github.com/repos/sul-dlss/dor-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/dor-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/dor-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/dor-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/dor-services/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/dor-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/dor-services/merges","archive_url":"https://api.github.com/repos/sul-dlss/dor-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/dor-services/downloads","issues_url":"https://api.github.com/repos/sul-dlss/dor-services/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/dor-services/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/dor-services/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/dor-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/dor-services/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/dor-services/releases{/id}","deployments_url":"https://api.github.com/repos/sul-dlss/dor-services/deployments","created_at":"2012-07-11T13:12:49Z","updated_at":"2016-09-07T00:38:56Z","pushed_at":"2016-10-04T18:55:10Z","git_url":"git://github.com/sul-dlss/dor-services.git","ssh_url":"git@github.com:sul-dlss/dor-services.git","clone_url":"https://github.com/sul-dlss/dor-services.git","svn_url":"https://github.com/sul-dlss/dor-services","homepage":null,"size":4063,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":46,"forks":1,"open_issues":46,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237"},"html":{"href":"https://github.com/sul-dlss/dor-services/pull/237"},"issue":{"href":"https://api.github.com/repos/sul-dlss/dor-services/issues/237"},"comments":{"href":"https://api.github.com/repos/sul-dlss/dor-services/issues/237/comments"},"review_comments":{"href":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237/comments"},"review_comment":{"href":"https://api.github.com/repos/sul-dlss/dor-services/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sul-dlss/dor-services/pulls/237/commits"},"statuses":{"href":"https://api.github.com/repos/sul-dlss/dor-services/statuses/d1da1abb8f77b1e09bca9df551e0dd5c0629c8d3"}}}}
{"actor":{"display_login":"peetucket"}}