Class: Akeneo::FamilyService

Inherits:
ServiceBase show all
Defined in:
lib/akeneo/family_service.rb

Constant Summary

Constants inherited from ServiceBase

ServiceBase::API_VERSION, ServiceBase::DEFAULT_PAGINATION_LIMIT, ServiceBase::DEFAULT_PAGINATION_TYPE

Constants included from Cache

Cache::DEFAULT_EXPIRES_IN

Instance Method Summary collapse

Methods inherited from ServiceBase

#initialize

Methods included from Cache

disabled=, #get_request, prepended

Constructor Details

This class inherits a constructor from Akeneo::ServiceBase

Instance Method Details

#allObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/akeneo/family_service.rb', line 7

def all
  Enumerator.new do |families|
    request_url = "/families?#{limit_param}"

    loop do
      response = get_request(request_url)
      extract_collection_items(response).each { |family| families << family }
      request_url = extract_next_page_path(response)
      break unless request_url
    end
  end
end

#find(code) ⇒ Object



20
21
22
23
24
# File 'lib/akeneo/family_service.rb', line 20

def find(code)
  response = get_request("/families/#{code}")

  response.parsed_response if response.success?
end

#variant(code, variant_code) ⇒ Object



26
27
28
29
30
# File 'lib/akeneo/family_service.rb', line 26

def variant(code, variant_code)
  response = get_request("/families/#{code}/variants/#{variant_code}")

  response.parsed_response if response.success?
end