Class: Epages::REST::Shop

Inherits:
Shop
  • Object
show all
Includes:
API
Defined in:
lib/epages/rest/shop.rb

Instance Attribute Summary

Attributes inherited from Shop

#host, #name, #protocol, #token

Instance Method Summary collapse

Methods included from Webhooks

#activate_webhook, #create_webhook, #deactivate_webhook, #delete_webhook, #webhook

Methods included from Utils

#epages_id, #format_date, #format_dates_options, #parse_legal_info, #parse_links, #parse_price_info, #parse_product_lowest_price, #parse_product_variations, #parse_suggestions_to_products, #parse_variation_object, #parse_variations, #perform_delete_request, #perform_delete_with_object, #perform_get_request, #perform_get_with_key_and_objects, #perform_get_with_object, #perform_get_with_objects, #perform_multipart_post_with_objects, #perform_patch_with_object, #perform_post_request, #perform_post_with_key_and_objects, #perform_post_with_object, #perform_post_with_objects, #perform_put_request, #perform_put_with_object, #perform_request, #perform_request_with_key_and_objects, #perform_request_with_object, #perform_request_with_objects, #process_thread

Methods included from TaxClasses

#tax_class, #tax_classes

Methods included from ShippingMethods

#shipping_method, #shipping_methods

Methods included from Utils

build_shop_from, camelize_keys, camelize_words, options_to_multipart_request, options_to_patch_request, parse_attribute_as, parse_attribute_as_array_of, parse_attributes, symbolize_keys!, to_query_options, underscorize_keys

Methods included from Sales

#sales

Methods included from Products

#assign_categories, #create_product, #delete_from_categories, #export_products, #product, #product_add_slideshow_image, #product_custom_attributes, #product_delete_slideshow_image, #product_lowest_price, #product_slideshow, #product_slideshow_sequence, #product_update_slideshow_sequence, #product_variations, #products, #update_product, #updated_products_by_property, #watched_products

Methods included from Orders

#order, #orders, #update_order

Methods included from Newsletters

#newsletter_subscribers, #newsletters

Methods included from Miscellaneous

#currencies, #info, #locales, #product_suggestions_for, #watched_products

Methods included from Legal

#contact_info, #legal, #privacy_policy, #rights_of_withdrawal, #shipping_info, #terms_and_conditions, #update_contact_info, #update_privacy_policy, #update_rights_of_withdrawal, #update_shipping_info, #update_terms_and_conditions

Methods included from Customers

#create_customer, #customer, #customers, #update_customer

Methods included from Categories

#assign_products, #categories, #category, #create_category, #delete_category, #delete_products, #reorder_subcategories, #subcategories, #update_category

Methods included from Carts

#apply_coupon, #cart, #cart_line_item, #create_cart, #delete_cart_billing_address, #delete_cart_line_item, #delete_cart_shipping_address, #delete_coupon, #order_cart, #update_cart_billing_address, #update_cart_line_item, #update_cart_shipping_address

Methods inherited from Shop

#initialize, #shop_name, #token?

Constructor Details

This class inherits a constructor from Epages::Shop

Instance Method Details

#parallel_calls(requests) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/epages/rest/shop.rb', line 11

def parallel_calls(requests)
  threads = []
  result = requests
  requests.each do |key, values|
    values.each_with_index do |call, i|
      threads << (values.is_a?(Array) ? process_thread(key, call, i) : process_thread(key, values))
    end
  end
  threads.each do |t|
    t.join
    t[:index].nil? ? result[t[:name]] = t[:result] : result[t[:name]][t[:index]] = t[:result]
  end
  result
end