Class: Pdf4me::CreateThumbnail

Inherits:
WrapperAction show all
Defined in:
lib/pdf4me/actions/create_thumbnail.rb

Instance Attribute Summary collapse

Attributes inherited from WrapperAction

#client

Instance Method Summary collapse

Methods inherited from WrapperAction

#assign_attributes, #initialize, #run, #run!

Constructor Details

This class inherits a constructor from Pdf4me::WrapperAction

Instance Attribute Details

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 3

def file
  @file
end

#image_formatObject

Returns the value of attribute image_format.



3
4
5
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 3

def image_format
  @image_format
end

#page_numberObject

Returns the value of attribute page_number.



3
4
5
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 3

def page_number
  @page_number
end

#save_pathObject

Returns the value of attribute save_path.



3
4
5
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 3

def save_path
  @save_path
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 3

def width
  @width
end

Instance Method Details

#call_apiObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 44

def call_api
  client.multipart_post(
    path,
    file: File.open(file, 'rb'),
    pageNr: page_number,
    width: width,
    imageFormat: image_format
  ) do |request|
    download(request, save_path)
  end
end

#defaultsObject



30
31
32
33
34
35
36
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 30

def defaults
  {
    width: 100,
    image_format: 'png',
    page_number: 1
  }
end

#pathObject



26
27
28
# File 'lib/pdf4me/actions/create_thumbnail.rb', line 26

def path
  '/Image/CreateThumbnail'
end