lib/contentful/management/locale.rb in contentful-management-0.2.1 vs lib/contentful/management/locale.rb in contentful-management-0.3.0
- old
+ new
@@ -1,6 +1,5 @@
-# -*- encoding: utf-8 -*-
require_relative 'resource'
module Contentful
module Management
# Resource class for Locale.
@@ -42,20 +41,29 @@
# :contentManagementApi
# :contentDeliveryApi
# :publish
# Returns a Contentful::Management::Locale.
def self.create(space_id, attributes)
- request = Request.new("/#{ space_id }/locales", 'name' => attributes.fetch(:name), 'code' => attributes.fetch(:code))
+ request = Request.new(
+ "/#{ space_id }/locales",
+ 'name' => attributes.fetch(:name),
+ 'code' => attributes.fetch(:code)
+ )
response = request.post
result = ResourceBuilder.new(response, {'Locale' => Locale}, {})
result.run
end
# Updates a locale.
# Takes a hash with attributes.
# Returns a Contentful::Management::Locale.
def update(attributes)
- request = Request.new("/#{ space.id }/locales/#{ id }", {'name' => attributes.fetch(:name)}, id = nil, version: sys[:version])
+ request = Request.new(
+ "/#{ space.id }/locales/#{ id }",
+ {'name' => attributes.fetch(:name)},
+ id = nil,
+ version: sys[:version]
+ )
response = request.put
result = ResourceBuilder.new(response, {'Locale' => Locale}, {})
refresh_data(result.run)
end
end