Module: DHL::Ecommerce::Operations::List::ClassMethods

Defined in:
lib/dhl/ecommerce/operations/list.rb

Instance Method Summary collapse

Instance Method Details

#allObject



6
7
8
9
10
# File 'lib/dhl/ecommerce/operations/list.rb', line 6

def all
  response = DHL::Ecommerce.request :get, "https://api.dhlglobalmail.com/v1/#{resource_name.downcase}s"
  response["#{resource_name}s"][resource_name] = [response["#{resource_name}s"][resource_name]] unless response["#{resource_name}s"][resource_name].is_a? Array
  response["#{resource_name}s"][resource_name].map do |attributes| new attributes end
end