{"action":"created","comment":{"url":"https://api.github.com/repos/yast/yast-snapper/pulls/comments/31213903","id":31213903,"diff_hunk":"@@ -0,0 +1,241 @@\n+# encoding: utf-8\n+\n+# ------------------------------------------------------------------------------\n+# Copyright (c) 2015 SUSE LLC. All Rights Reserved.\n+#\n+# This program is free software; you can redistribute it and/or modify it under\n+# the terms of version 2 of the GNU General Public License as published by the\n+# Free Software Foundation.\n+#\n+# This program is distributed in the hope that it will be useful, but WITHOUT\n+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License along with\n+# this program; if not, contact Novell, Inc.\n+#\n+# To contact Novell about this file by physical or electronic mail, you may find\n+# current contact information at www.novell.com.\n+# ------------------------------------------------------------------------------\n+\n+require \"yast\"\n+require \"dbus\"\n+\n+module Yast\n+\n+  class SnapperDbusClass < Module\n+\n+    include Yast::Logger\n+\n+    def main\n+\n+      log.info(\"connecting to snapperd\")\n+\n+      @system_bus = DBus::SystemBus.instance()\n+      @service = @system_bus.service(\"org.opensuse.Snapper\")\n+      @dbus_object = @service.object(\"/org/opensuse/Snapper\")\n+      @dbus_object.default_iface = \"org.opensuse.Snapper\"\n+      @dbus_object.introspect()\n+\n+    end\n+\n+\n+    # Escape a String or Hash for snapperd. See snapper dbus documentation for details.\n+    def escape(str)\n+\n+      ret = str.dup\n+\n+      if ret.is_a?(::String)\n+\n+        ret.force_encoding(Encoding::ASCII_8BIT)\n+        ret.gsub!(/(\\\\|[\\x80-\\xff])/n) do |tmp|\n+          if tmp == \"\\\\\"\n+            \"\\\\\\\\\"\n+          else\n+            \"\\\\x\" + tmp[0].ord.to_s(16)\n+          end\n+        end\n+\n+      elsif ret.is_a?(Hash)\n+\n+        ret = ret.map { |k, v| [ escape(k), escape(v) ] }.to_h","path":"src/modules/SnapperDbus.rb","position":61,"original_position":61,"commit_id":"d00df449f9a1d1729ddad2663cc4de193bfcc925","original_commit_id":"d00df449f9a1d1729ddad2663cc4de193bfcc925","user":{"login":"aschnell","id":908062,"avatar_url":"https://avatars.githubusercontent.com/u/908062?v=3","gravatar_id":"","url":"https://api.github.com/users/aschnell","html_url":"https://github.com/aschnell","followers_url":"https://api.github.com/users/aschnell/followers","following_url":"https://api.github.com/users/aschnell/following{/other_user}","gists_url":"https://api.github.com/users/aschnell/gists{/gist_id}","starred_url":"https://api.github.com/users/aschnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschnell/subscriptions","organizations_url":"https://api.github.com/users/aschnell/orgs","repos_url":"https://api.github.com/users/aschnell/repos","events_url":"https://api.github.com/users/aschnell/events{/privacy}","received_events_url":"https://api.github.com/users/aschnell/received_events","type":"User","site_admin":false},"body":"I think it is since, see http://ruby-doc.org/core-2.2.0/Enumerable.html#method-i-map. AFAIS there is no map!.","created_at":"2015-05-28T08:49:00Z","updated_at":"2015-05-28T08:49:00Z","html_url":"https://github.com/yast/yast-snapper/pull/34#discussion_r31213903","pull_request_url":"https://api.github.com/repos/yast/yast-snapper/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/yast/yast-snapper/pulls/comments/31213903"},"html":{"href":"https://github.com/yast/yast-snapper/pull/34#discussion_r31213903"},"pull_request":{"href":"https://api.github.com/repos/yast/yast-snapper/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/yast/yast-snapper/pulls/34","id":36316998,"html_url":"https://github.com/yast/yast-snapper/pull/34","diff_url":"https://github.com/yast/yast-snapper/pull/34.diff","patch_url":"https://github.com/yast/yast-snapper/pull/34.patch","issue_url":"https://api.github.com/repos/yast/yast-snapper/issues/34","number":34,"state":"open","locked":false,"title":"- used snapper dbus interface","user":{"login":"aschnell","id":908062,"avatar_url":"https://avatars.githubusercontent.com/u/908062?v=3","gravatar_id":"","url":"https://api.github.com/users/aschnell","html_url":"https://github.com/aschnell","followers_url":"https://api.github.com/users/aschnell/followers","following_url":"https://api.github.com/users/aschnell/following{/other_user}","gists_url":"https://api.github.com/users/aschnell/gists{/gist_id}","starred_url":"https://api.github.com/users/aschnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschnell/subscriptions","organizations_url":"https://api.github.com/users/aschnell/orgs","repos_url":"https://api.github.com/users/aschnell/repos","events_url":"https://api.github.com/users/aschnell/events{/privacy}","received_events_url":"https://api.github.com/users/aschnell/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-27T15:36:02Z","updated_at":"2015-05-28T08:49:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd8ead3efd15fe553cc02190576df3337edc6c4b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yast/yast-snapper/pulls/34/commits","review_comments_url":"https://api.github.com/repos/yast/yast-snapper/pulls/34/comments","review_comment_url":"https://api.github.com/repos/yast/yast-snapper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yast/yast-snapper/issues/34/comments","statuses_url":"https://api.github.com/repos/yast/yast-snapper/statuses/d00df449f9a1d1729ddad2663cc4de193bfcc925","head":{"label":"aschnell:master","ref":"master","sha":"d00df449f9a1d1729ddad2663cc4de193bfcc925","user":{"login":"aschnell","id":908062,"avatar_url":"https://avatars.githubusercontent.com/u/908062?v=3","gravatar_id":"","url":"https://api.github.com/users/aschnell","html_url":"https://github.com/aschnell","followers_url":"https://api.github.com/users/aschnell/followers","following_url":"https://api.github.com/users/aschnell/following{/other_user}","gists_url":"https://api.github.com/users/aschnell/gists{/gist_id}","starred_url":"https://api.github.com/users/aschnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschnell/subscriptions","organizations_url":"https://api.github.com/users/aschnell/orgs","repos_url":"https://api.github.com/users/aschnell/repos","events_url":"https://api.github.com/users/aschnell/events{/privacy}","received_events_url":"https://api.github.com/users/aschnell/received_events","type":"User","site_admin":false},"repo":{"id":35225243,"name":"yast-snapper","full_name":"aschnell/yast-snapper","owner":{"login":"aschnell","id":908062,"avatar_url":"https://avatars.githubusercontent.com/u/908062?v=3","gravatar_id":"","url":"https://api.github.com/users/aschnell","html_url":"https://github.com/aschnell","followers_url":"https://api.github.com/users/aschnell/followers","following_url":"https://api.github.com/users/aschnell/following{/other_user}","gists_url":"https://api.github.com/users/aschnell/gists{/gist_id}","starred_url":"https://api.github.com/users/aschnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschnell/subscriptions","organizations_url":"https://api.github.com/users/aschnell/orgs","repos_url":"https://api.github.com/users/aschnell/repos","events_url":"https://api.github.com/users/aschnell/events{/privacy}","received_events_url":"https://api.github.com/users/aschnell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aschnell/yast-snapper","description":"YaST module snapper","fork":true,"url":"https://api.github.com/repos/aschnell/yast-snapper","forks_url":"https://api.github.com/repos/aschnell/yast-snapper/forks","keys_url":"https://api.github.com/repos/aschnell/yast-snapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aschnell/yast-snapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aschnell/yast-snapper/teams","hooks_url":"https://api.github.com/repos/aschnell/yast-snapper/hooks","issue_events_url":"https://api.github.com/repos/aschnell/yast-snapper/issues/events{/number}","events_url":"https://api.github.com/repos/aschnell/yast-snapper/events","assignees_url":"https://api.github.com/repos/aschnell/yast-snapper/assignees{/user}","branches_url":"https://api.github.com/repos/aschnell/yast-snapper/branches{/branch}","tags_url":"https://api.github.com/repos/aschnell/yast-snapper/tags","blobs_url":"https://api.github.com/repos/aschnell/yast-snapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aschnell/yast-snapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aschnell/yast-snapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/aschnell/yast-snapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aschnell/yast-snapper/statuses/{sha}","languages_url":"https://api.github.com/repos/aschnell/yast-snapper/languages","stargazers_url":"https://api.github.com/repos/aschnell/yast-snapper/stargazers","contributors_url":"https://api.github.com/repos/aschnell/yast-snapper/contributors","subscribers_url":"https://api.github.com/repos/aschnell/yast-snapper/subscribers","subscription_url":"https://api.github.com/repos/aschnell/yast-snapper/subscription","commits_url":"https://api.github.com/repos/aschnell/yast-snapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/aschnell/yast-snapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/aschnell/yast-snapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/aschnell/yast-snapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/aschnell/yast-snapper/contents/{+path}","compare_url":"https://api.github.com/repos/aschnell/yast-snapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aschnell/yast-snapper/merges","archive_url":"https://api.github.com/repos/aschnell/yast-snapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aschnell/yast-snapper/downloads","issues_url":"https://api.github.com/repos/aschnell/yast-snapper/issues{/number}","pulls_url":"https://api.github.com/repos/aschnell/yast-snapper/pulls{/number}","milestones_url":"https://api.github.com/repos/aschnell/yast-snapper/milestones{/number}","notifications_url":"https://api.github.com/repos/aschnell/yast-snapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aschnell/yast-snapper/labels{/name}","releases_url":"https://api.github.com/repos/aschnell/yast-snapper/releases{/id}","created_at":"2015-05-07T14:37:55Z","updated_at":"2015-05-08T15:08:25Z","pushed_at":"2015-05-27T19:14:47Z","git_url":"git://github.com/aschnell/yast-snapper.git","ssh_url":"git@github.com:aschnell/yast-snapper.git","clone_url":"https://github.com/aschnell/yast-snapper.git","svn_url":"https://github.com/aschnell/yast-snapper","homepage":"http://en.opensuse.org/Portal:YaST","size":406,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yast:master","ref":"master","sha":"68a7d3bc489cc7967b35b7580098016b3b050092","user":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?v=3","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368216,"name":"yast-snapper","full_name":"yast/yast-snapper","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars.githubusercontent.com/u/909990?v=3","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-snapper","description":"YaST module snapper","fork":false,"url":"https://api.github.com/repos/yast/yast-snapper","forks_url":"https://api.github.com/repos/yast/yast-snapper/forks","keys_url":"https://api.github.com/repos/yast/yast-snapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-snapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-snapper/teams","hooks_url":"https://api.github.com/repos/yast/yast-snapper/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-snapper/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-snapper/events","assignees_url":"https://api.github.com/repos/yast/yast-snapper/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-snapper/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-snapper/tags","blobs_url":"https://api.github.com/repos/yast/yast-snapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-snapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-snapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-snapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-snapper/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-snapper/languages","stargazers_url":"https://api.github.com/repos/yast/yast-snapper/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-snapper/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-snapper/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-snapper/subscription","commits_url":"https://api.github.com/repos/yast/yast-snapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-snapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-snapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-snapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/yast/yast-snapper/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-snapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-snapper/merges","archive_url":"https://api.github.com/repos/yast/yast-snapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-snapper/downloads","issues_url":"https://api.github.com/repos/yast/yast-snapper/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-snapper/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-snapper/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-snapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-snapper/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-snapper/releases{/id}","created_at":"2012-05-18T10:26:26Z","updated_at":"2015-04-17T07:49:47Z","pushed_at":"2015-05-27T19:14:47Z","git_url":"git://github.com/yast/yast-snapper.git","ssh_url":"git@github.com:yast/yast-snapper.git","clone_url":"https://github.com/yast/yast-snapper.git","svn_url":"https://github.com/yast/yast-snapper","homepage":"http://en.opensuse.org/Portal:YaST","size":545,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yast/yast-snapper/pulls/34"},"html":{"href":"https://github.com/yast/yast-snapper/pull/34"},"issue":{"href":"https://api.github.com/repos/yast/yast-snapper/issues/34"},"comments":{"href":"https://api.github.com/repos/yast/yast-snapper/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/yast/yast-snapper/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/yast/yast-snapper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yast/yast-snapper/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/yast/yast-snapper/statuses/d00df449f9a1d1729ddad2663cc4de193bfcc925"}}}}