Class: Akeneo::ImageService
Constant Summary
collapse
- BOUNDARY =
'AwesomeBoundary'
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
Instance Method Details
#create_asset(code, options = {}) ⇒ Object
25
26
27
28
|
# File 'lib/akeneo/image_service.rb', line 25
def create_asset(code, options = {})
body = { code: code }.merge(options)
post_request('/assets', body.to_json)
end
|
#create_reference(code, locale, file, filename) ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/akeneo/image_service.rb', line 30
def create_reference(code, locale, file, filename)
uri = reference_uri(code, locale)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(uri.request_uri, )
request.body = reference_body(file, filename)
http.request(request)
end
|
#download(code) ⇒ Object
21
22
23
|
# File 'lib/akeneo/image_service.rb', line 21
def download(code)
download_request(code)
end
|
#find(code) ⇒ Object
15
16
17
18
19
|
# File 'lib/akeneo/image_service.rb', line 15
def find(code)
response = get_request("/assets/#{code}")
response.parsed_response if response.success?
end
|