Skip to content

Commit

Permalink
Replace service with cistern
Browse files Browse the repository at this point in the history
  • Loading branch information
omgitsads committed May 25, 2016
1 parent b7ba65b commit 3e149e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/zendesk2/help_center/article.rb
Expand Up @@ -48,7 +48,7 @@ class Zendesk2::HelpCenter::Article
def translations
requires :identity

service.help_center_translations(source_id: self.identity, source_type: "Article")
cistern.help_center_translations(source_id: self.identity, source_type: "Article")
end

def save!
Expand Down
2 changes: 1 addition & 1 deletion lib/zendesk2/help_center/category.rb
Expand Up @@ -50,7 +50,7 @@ def sections
def translations
requires :identity

service.help_center_translations(source_id: self.identity, source_type: "Category")
cistern.help_center_translations(source_id: self.identity, source_type: "Category")
end

def save!
Expand Down
4 changes: 2 additions & 2 deletions lib/zendesk2/help_center/create_help_center_translation.rb
Expand Up @@ -15,7 +15,7 @@ def translation_params
end

def mock
identity = service.serial_id
identity = cistern.serial_id

record = {
"id" => identity,
Expand All @@ -30,7 +30,7 @@ def mock
"locale" => locale,
}.merge(translation_params)

service.data[:help_center_translations][mock_translation_key] = record
cistern.data[:help_center_translations][mock_translation_key] = record

mock_response("translation" => record)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/zendesk2/help_center/section.rb
Expand Up @@ -76,6 +76,6 @@ def access_policy
def translations
requires :identity

service.help_center_translations(source_id: self.identity, source_type: "Section")
cistern.help_center_translations(source_id: self.identity, source_type: "Section")
end
end
6 changes: 3 additions & 3 deletions lib/zendesk2/help_center/translation.rb
Expand Up @@ -29,18 +29,18 @@ class Zendesk2::HelpCenter::Translation
def destroy!
requires :locale, :source_id, :source_type

service.destroy_help_center_translation("translation" => Cistern::Hash.slice(self.attributes, :source_id, :source_type, :locale))
cistern.destroy_help_center_translation("translation" => Cistern::Hash.slice(self.attributes, :source_id, :source_type, :locale))
end

def save!
response = if new_record?
requires :locale, :source_id, :source_type

service.create_help_center_translation("translation" => self.attributes)
cistern.create_help_center_translation("translation" => self.attributes)
else
requires :identity

service.update_help_center_translation("translation" => self.attributes)
cistern.update_help_center_translation("translation" => self.attributes)
end

merge_attributes(response.body["translation"])
Expand Down

0 comments on commit 3e149e0

Please sign in to comment.