{"action":"created","comment":{"url":"https://api.github.com/repos/lanej/zendesk2/pulls/comments/64555455","id":64555455,"diff_hunk":"@@ -0,0 +1,58 @@\n+class Zendesk2::HelpCenter::Translation\n+  include Zendesk2::Model\n+\n+  extend Zendesk2::Attributes\n+\n+  # @return [Integer] Automatically assigned when the translation is created\n+  identity :id, type: :integer # ro:yes required:no\n+\n+  # @return [String] The API url of the translation\n+  attribute :url, type: :string # ro:yes required:no\n+  # @return [String] The url of the translation in Help Center\n+  attribute :html_url, type: :string # ro:yes required:no\n+  # @return [Integer]\tThe id of the item that has this translation\n+  attribute :source_id, type: :integer # ro:yes required:no\n+  # @return [String] The type of the item that has this translation. Can be Article, Section, or Category\n+  attribute :source_type, type: :string # ro:yes required:no\n+  # @return [String] The locale of the translation\n+  attribute :locale, type: :string # ro:no required:yes\n+  # @return [String] The title of the translation\n+  attribute :title, type: :string # ro:no required:yes\n+  # @return [String] The body of the translation. Empty by default\n+  attribute :body, type: :string # ro:no required:no\n+  # @return [Boolean] True if the translation is outdated; false otherwise. False by default\n+  attribute :outdated, type: :boolean # ro:no required:no\n+  # @return [Boolean] True if the translation is a draft; false otherwise. False by default\n+  attribute :draft, type: :boolean # ro:no required:no\n+\n+  def destroy!\n+    requires :locale, :source_id, :source_type\n+\n+    service.destroy_help_center_translation(\"translation\" => Cistern::Hash.slice(self.attributes, :source_id, :source_type, :locale))\n+  end\n+\n+  def save!\n+    response = if new_record?\n+                 requires :locale, :source_id, :source_type\n+\n+                 service.create_help_center_translation(\"translation\" => self.attributes)\n+               else\n+                 requires :identity\n+\n+                 service.update_help_center_translation(\"translation\" => self.attributes)\n+               end\n+\n+    merge_attributes(response.body[\"translation\"])\n+  end\n+\n+  def source=(source)\n+    if source.is_a?(Zendesk2::HelpCenter::Article)\n+      self.source_type = \"Article\"\n+    elsif source.is_a?(Zendesk2::HelpCenter::Section)\n+      self.source_type = \"Section\"\n+    elsif source.is_a?(Zendesk2::HelpCenter::Category)\n+      self.source_type = \"Category\"","path":"lib/zendesk2/help_center/translation.rb","position":null,"original_position":54,"commit_id":"0514c07b508cdbc8324e49a2e854915bb6822961","original_commit_id":"0dae236ac1606b1fe1951230977369d2281a2fb4","user":{"login":"omgitsads","id":4619,"avatar_url":"https://avatars.githubusercontent.com/u/4619?v=3","gravatar_id":"","url":"https://api.github.com/users/omgitsads","html_url":"https://github.com/omgitsads","followers_url":"https://api.github.com/users/omgitsads/followers","following_url":"https://api.github.com/users/omgitsads/following{/other_user}","gists_url":"https://api.github.com/users/omgitsads/gists{/gist_id}","starred_url":"https://api.github.com/users/omgitsads/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omgitsads/subscriptions","organizations_url":"https://api.github.com/users/omgitsads/orgs","repos_url":"https://api.github.com/users/omgitsads/repos","events_url":"https://api.github.com/users/omgitsads/events{/privacy}","received_events_url":"https://api.github.com/users/omgitsads/received_events","type":"User","site_admin":true},"body":"Not sure what you mean here. The `source_type` is an [attribute on the resource](https://developer.zendesk.com/rest_api/docs/help_center/translations#json-format), the `source=` method is simply a helper for when you're creating a translation record:\r\n\r\n```\r\nclient.help_center_translations.create!(source: article, title: \"Hello\", body: \"World!\", locale: \"en-us\")\r\n```\r\nvs\r\n```\r\nclient.help_center_translations.create!(source_type: \"Article\", source_id: article.id, title: \"Hello\", body: \"World!\", locale: \"en-us\")\r\n```\r\n\r\nor are you just talking about removing from the model\r\n\r\n```\r\n# @return [Integer]\tThe id of the item that has this translation\r\nattribute :source_id, type: :integer # ro:yes required:no\r\n# @return [String] The type of the item that has this translation. Can be Article, Section, or Category\r\nattribute :source_type, type: :string # ro:yes required:no\r\n```\r\n\r\nand adding them when the module is included?","created_at":"2016-05-25T11:21:10Z","updated_at":"2016-05-25T11:21:10Z","html_url":"https://github.com/lanej/zendesk2/pull/48#discussion_r64555455","pull_request_url":"https://api.github.com/repos/lanej/zendesk2/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/lanej/zendesk2/pulls/comments/64555455"},"html":{"href":"https://github.com/lanej/zendesk2/pull/48#discussion_r64555455"},"pull_request":{"href":"https://api.github.com/repos/lanej/zendesk2/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/lanej/zendesk2/pulls/48","id":71223557,"html_url":"https://github.com/lanej/zendesk2/pull/48","diff_url":"https://github.com/lanej/zendesk2/pull/48.diff","patch_url":"https://github.com/lanej/zendesk2/pull/48.patch","issue_url":"https://api.github.com/repos/lanej/zendesk2/issues/48","number":48,"state":"open","locked":false,"title":"Help center translations API","user":{"login":"omgitsads","id":4619,"avatar_url":"https://avatars.githubusercontent.com/u/4619?v=3","gravatar_id":"","url":"https://api.github.com/users/omgitsads","html_url":"https://github.com/omgitsads","followers_url":"https://api.github.com/users/omgitsads/followers","following_url":"https://api.github.com/users/omgitsads/following{/other_user}","gists_url":"https://api.github.com/users/omgitsads/gists{/gist_id}","starred_url":"https://api.github.com/users/omgitsads/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omgitsads/subscriptions","organizations_url":"https://api.github.com/users/omgitsads/orgs","repos_url":"https://api.github.com/users/omgitsads/repos","events_url":"https://api.github.com/users/omgitsads/events{/privacy}","received_events_url":"https://api.github.com/users/omgitsads/received_events","type":"User","site_admin":true},"body":"https://developer.zendesk.com/rest_api/docs/help_center/translations\r\n\r\nTranslations API to update article title & body, section title and\r\ncategory title.","created_at":"2016-05-24T13:51:08Z","updated_at":"2016-05-25T11:21:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7275915e4fa6343182d7d6487bdf6e4288b229a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lanej/zendesk2/pulls/48/commits","review_comments_url":"https://api.github.com/repos/lanej/zendesk2/pulls/48/comments","review_comment_url":"https://api.github.com/repos/lanej/zendesk2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lanej/zendesk2/issues/48/comments","statuses_url":"https://api.github.com/repos/lanej/zendesk2/statuses/0514c07b508cdbc8324e49a2e854915bb6822961","head":{"label":"omgitsads:help-center-translations","ref":"help-center-translations","sha":"0514c07b508cdbc8324e49a2e854915bb6822961","user":{"login":"omgitsads","id":4619,"avatar_url":"https://avatars.githubusercontent.com/u/4619?v=3","gravatar_id":"","url":"https://api.github.com/users/omgitsads","html_url":"https://github.com/omgitsads","followers_url":"https://api.github.com/users/omgitsads/followers","following_url":"https://api.github.com/users/omgitsads/following{/other_user}","gists_url":"https://api.github.com/users/omgitsads/gists{/gist_id}","starred_url":"https://api.github.com/users/omgitsads/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omgitsads/subscriptions","organizations_url":"https://api.github.com/users/omgitsads/orgs","repos_url":"https://api.github.com/users/omgitsads/repos","events_url":"https://api.github.com/users/omgitsads/events{/privacy}","received_events_url":"https://api.github.com/users/omgitsads/received_events","type":"User","site_admin":true},"repo":{"id":7240313,"name":"zendesk2","full_name":"omgitsads/zendesk2","owner":{"login":"omgitsads","id":4619,"avatar_url":"https://avatars.githubusercontent.com/u/4619?v=3","gravatar_id":"","url":"https://api.github.com/users/omgitsads","html_url":"https://github.com/omgitsads","followers_url":"https://api.github.com/users/omgitsads/followers","following_url":"https://api.github.com/users/omgitsads/following{/other_user}","gists_url":"https://api.github.com/users/omgitsads/gists{/gist_id}","starred_url":"https://api.github.com/users/omgitsads/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omgitsads/subscriptions","organizations_url":"https://api.github.com/users/omgitsads/orgs","repos_url":"https://api.github.com/users/omgitsads/repos","events_url":"https://api.github.com/users/omgitsads/events{/privacy}","received_events_url":"https://api.github.com/users/omgitsads/received_events","type":"User","site_admin":true},"private":false,"html_url":"https://github.com/omgitsads/zendesk2","description":"Zendesk API V2 client using cistern","fork":true,"url":"https://api.github.com/repos/omgitsads/zendesk2","forks_url":"https://api.github.com/repos/omgitsads/zendesk2/forks","keys_url":"https://api.github.com/repos/omgitsads/zendesk2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omgitsads/zendesk2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omgitsads/zendesk2/teams","hooks_url":"https://api.github.com/repos/omgitsads/zendesk2/hooks","issue_events_url":"https://api.github.com/repos/omgitsads/zendesk2/issues/events{/number}","events_url":"https://api.github.com/repos/omgitsads/zendesk2/events","assignees_url":"https://api.github.com/repos/omgitsads/zendesk2/assignees{/user}","branches_url":"https://api.github.com/repos/omgitsads/zendesk2/branches{/branch}","tags_url":"https://api.github.com/repos/omgitsads/zendesk2/tags","blobs_url":"https://api.github.com/repos/omgitsads/zendesk2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omgitsads/zendesk2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omgitsads/zendesk2/git/refs{/sha}","trees_url":"https://api.github.com/repos/omgitsads/zendesk2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omgitsads/zendesk2/statuses/{sha}","languages_url":"https://api.github.com/repos/omgitsads/zendesk2/languages","stargazers_url":"https://api.github.com/repos/omgitsads/zendesk2/stargazers","contributors_url":"https://api.github.com/repos/omgitsads/zendesk2/contributors","subscribers_url":"https://api.github.com/repos/omgitsads/zendesk2/subscribers","subscription_url":"https://api.github.com/repos/omgitsads/zendesk2/subscription","commits_url":"https://api.github.com/repos/omgitsads/zendesk2/commits{/sha}","git_commits_url":"https://api.github.com/repos/omgitsads/zendesk2/git/commits{/sha}","comments_url":"https://api.github.com/repos/omgitsads/zendesk2/comments{/number}","issue_comment_url":"https://api.github.com/repos/omgitsads/zendesk2/issues/comments{/number}","contents_url":"https://api.github.com/repos/omgitsads/zendesk2/contents/{+path}","compare_url":"https://api.github.com/repos/omgitsads/zendesk2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omgitsads/zendesk2/merges","archive_url":"https://api.github.com/repos/omgitsads/zendesk2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omgitsads/zendesk2/downloads","issues_url":"https://api.github.com/repos/omgitsads/zendesk2/issues{/number}","pulls_url":"https://api.github.com/repos/omgitsads/zendesk2/pulls{/number}","milestones_url":"https://api.github.com/repos/omgitsads/zendesk2/milestones{/number}","notifications_url":"https://api.github.com/repos/omgitsads/zendesk2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omgitsads/zendesk2/labels{/name}","releases_url":"https://api.github.com/repos/omgitsads/zendesk2/releases{/id}","deployments_url":"https://api.github.com/repos/omgitsads/zendesk2/deployments","created_at":"2012-12-19T12:37:11Z","updated_at":"2016-05-11T14:18:35Z","pushed_at":"2016-05-25T11:12:28Z","git_url":"git://github.com/omgitsads/zendesk2.git","ssh_url":"git@github.com:omgitsads/zendesk2.git","clone_url":"https://github.com/omgitsads/zendesk2.git","svn_url":"https://github.com/omgitsads/zendesk2","homepage":null,"size":576,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lanej:master","ref":"master","sha":"feb6845333d0d80134369e4aa14d80dc6cdc5f5a","user":{"login":"lanej","id":79638,"avatar_url":"https://avatars.githubusercontent.com/u/79638?v=3","gravatar_id":"","url":"https://api.github.com/users/lanej","html_url":"https://github.com/lanej","followers_url":"https://api.github.com/users/lanej/followers","following_url":"https://api.github.com/users/lanej/following{/other_user}","gists_url":"https://api.github.com/users/lanej/gists{/gist_id}","starred_url":"https://api.github.com/users/lanej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanej/subscriptions","organizations_url":"https://api.github.com/users/lanej/orgs","repos_url":"https://api.github.com/users/lanej/repos","events_url":"https://api.github.com/users/lanej/events{/privacy}","received_events_url":"https://api.github.com/users/lanej/received_events","type":"User","site_admin":false},"repo":{"id":4646709,"name":"zendesk2","full_name":"lanej/zendesk2","owner":{"login":"lanej","id":79638,"avatar_url":"https://avatars.githubusercontent.com/u/79638?v=3","gravatar_id":"","url":"https://api.github.com/users/lanej","html_url":"https://github.com/lanej","followers_url":"https://api.github.com/users/lanej/followers","following_url":"https://api.github.com/users/lanej/following{/other_user}","gists_url":"https://api.github.com/users/lanej/gists{/gist_id}","starred_url":"https://api.github.com/users/lanej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanej/subscriptions","organizations_url":"https://api.github.com/users/lanej/orgs","repos_url":"https://api.github.com/users/lanej/repos","events_url":"https://api.github.com/users/lanej/events{/privacy}","received_events_url":"https://api.github.com/users/lanej/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lanej/zendesk2","description":"Zendesk API V2 client using Cistern","fork":false,"url":"https://api.github.com/repos/lanej/zendesk2","forks_url":"https://api.github.com/repos/lanej/zendesk2/forks","keys_url":"https://api.github.com/repos/lanej/zendesk2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lanej/zendesk2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lanej/zendesk2/teams","hooks_url":"https://api.github.com/repos/lanej/zendesk2/hooks","issue_events_url":"https://api.github.com/repos/lanej/zendesk2/issues/events{/number}","events_url":"https://api.github.com/repos/lanej/zendesk2/events","assignees_url":"https://api.github.com/repos/lanej/zendesk2/assignees{/user}","branches_url":"https://api.github.com/repos/lanej/zendesk2/branches{/branch}","tags_url":"https://api.github.com/repos/lanej/zendesk2/tags","blobs_url":"https://api.github.com/repos/lanej/zendesk2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lanej/zendesk2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lanej/zendesk2/git/refs{/sha}","trees_url":"https://api.github.com/repos/lanej/zendesk2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lanej/zendesk2/statuses/{sha}","languages_url":"https://api.github.com/repos/lanej/zendesk2/languages","stargazers_url":"https://api.github.com/repos/lanej/zendesk2/stargazers","contributors_url":"https://api.github.com/repos/lanej/zendesk2/contributors","subscribers_url":"https://api.github.com/repos/lanej/zendesk2/subscribers","subscription_url":"https://api.github.com/repos/lanej/zendesk2/subscription","commits_url":"https://api.github.com/repos/lanej/zendesk2/commits{/sha}","git_commits_url":"https://api.github.com/repos/lanej/zendesk2/git/commits{/sha}","comments_url":"https://api.github.com/repos/lanej/zendesk2/comments{/number}","issue_comment_url":"https://api.github.com/repos/lanej/zendesk2/issues/comments{/number}","contents_url":"https://api.github.com/repos/lanej/zendesk2/contents/{+path}","compare_url":"https://api.github.com/repos/lanej/zendesk2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lanej/zendesk2/merges","archive_url":"https://api.github.com/repos/lanej/zendesk2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lanej/zendesk2/downloads","issues_url":"https://api.github.com/repos/lanej/zendesk2/issues{/number}","pulls_url":"https://api.github.com/repos/lanej/zendesk2/pulls{/number}","milestones_url":"https://api.github.com/repos/lanej/zendesk2/milestones{/number}","notifications_url":"https://api.github.com/repos/lanej/zendesk2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lanej/zendesk2/labels{/name}","releases_url":"https://api.github.com/repos/lanej/zendesk2/releases{/id}","deployments_url":"https://api.github.com/repos/lanej/zendesk2/deployments","created_at":"2012-06-13T05:40:59Z","updated_at":"2016-05-25T00:17:45Z","pushed_at":"2016-05-25T11:12:28Z","git_url":"git://github.com/lanej/zendesk2.git","ssh_url":"git@github.com:lanej/zendesk2.git","clone_url":"https://github.com/lanej/zendesk2.git","svn_url":"https://github.com/lanej/zendesk2","homepage":"http://lanej.io/zendesk2/","size":1155,"stargazers_count":17,"watchers_count":17,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":12,"mirror_url":null,"open_issues_count":5,"forks":12,"open_issues":5,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lanej/zendesk2/pulls/48"},"html":{"href":"https://github.com/lanej/zendesk2/pull/48"},"issue":{"href":"https://api.github.com/repos/lanej/zendesk2/issues/48"},"comments":{"href":"https://api.github.com/repos/lanej/zendesk2/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/lanej/zendesk2/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/lanej/zendesk2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lanej/zendesk2/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/lanej/zendesk2/statuses/0514c07b508cdbc8324e49a2e854915bb6822961"}}}}
{"actor":{"display_login":"omgitsads"}}