Class: GoogleContentApi::Product
- Inherits:
-
Object
- Object
- GoogleContentApi::Product
- Defined in:
- lib/google_content_api/product.rb
Class Method Summary collapse
- .create ⇒ Object
- .create_products(sub_account_id, products, dry_run = false) ⇒ Object (also: create_items)
- .delete(sub_account_id, params) ⇒ Object
- .update ⇒ Object
Class Method Details
.create ⇒ Object
39 40 41 |
# File 'lib/google_content_api/product.rb', line 39 def create raise "not implemented" end |
.create_products(sub_account_id, products, dry_run = false) ⇒ Object Also known as: create_items
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/google_content_api/product.rb', line 6 def create_products(sub_account_id, products, dry_run = false) token = Authorization.fetch_token products_url = GoogleContentApi.urls("products", sub_account_id, :dry_run => dry_run) xml = create_product_items_batch_xml(products) Faraday.headers = { "Content-Type" => "application/atom+xml", "Authorization" => "AuthSub token=#{token}" } response = Faraday.post products_url, xml if response.status == 200 response else raise "Unable to batch insert products - received status #{response.status}. body: #{response.body}" end end |
.delete(sub_account_id, params) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/google_content_api/product.rb', line 25 def delete(sub_account_id, params) token = Authorization.fetch_token product_url = GoogleContentApi.urls("product", sub_account_id, :language => params[:language], :country => params[:country], :item_id => params[:item_id], :dry_run => params[:dry_run]) Faraday.headers = { "Authorization" => "AuthSub token=#{token}" } response = Faraday.delete product_url if response.status == 200 response else raise "Unable to delete product - received status #{response.status}. body: #{response.body}" end end |
.update ⇒ Object
43 44 45 |
# File 'lib/google_content_api/product.rb', line 43 def update raise "not implemented" end |