Module: GoogleContentApi
- Defined in:
- lib/google_content_api.rb,
lib/google_content_api/product.rb,
lib/google_content_api/version.rb,
lib/google_content_api/sub_account.rb,
lib/google_content_api/authorization.rb
Defined Under Namespace
Classes: Authorization, Product, SubAccount
Constant Summary
collapse
- VERSION =
"0.1.7"
Class Method Summary
collapse
Class Method Details
.config(options = {}) ⇒ Object
11
12
13
|
# File 'lib/google_content_api.rb', line 11
def self.config(options = {})
@@config ||= YAML.load( File.read(options[:config_file] || "config/google_content_api.yml") )
end
|
.urls(type, account_id, options = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/google_content_api.rb', line 15
def self.urls(type, account_id, options = {})
base_url = "https://content.googleapis.com/content/v1/#{account_id}"
url = case type
when "managed_accounts"
"#{base_url}/managedaccounts"
when "products"
"#{base_url}/items/products/schema/batch?warnings="
when "item", "product"
raise "must supply language, country and item id" \
if options[:language].nil? || options[:country].nil? || options[:item_id].nil?
"#{base_url}/items/products/generic/online:#{options[:language].downcase}:#{options[:country].upcase}:#{options[:item_id]}?warnings"
when "item_to_update"
"#{base_url}/items/products/schema/online:#{options[:language].downcase}:#{options[:country].upcase}:#{options[:item_id]}"
else
raise "unknown zone"
end
options[:dry_run] ? url + "&dry-run=" : url
end
|