# How to Merge Specific Pages of Two or More Text Files using Ruby
# Create an instance of the Document API
@mergerApi = GroupDocsMergerCloud::DocumentApi.from_keys(@client_id, @client_secret)

@item1 = GroupDocsMergerCloud::JoinItem.new
@item1.file_info = GroupDocsMergerCloud::FileInfo.new
@item1.file_info.file_path = 'combine-files/note-one.txt'
@item1.pages = [1, 2]
 
@item2 = GroupDocsMergerCloud::JoinItem.new
@item2.file_info = GroupDocsMergerCloud::FileInfo.new
@item2.file_info.file_path = 'combine-files/note-two.txt'    
@item2.start_page_number = 1
@item2.end_page_number = 3
@item2.range_mode = "OddPages"
 
@options = GroupDocsMergerCloud::JoinOptions.new
@options.join_items = [@item1, @item2]
@options.output_path = 'combine-files/note-final.txt'
 
@result = @mergerApi.join(GroupDocsMergerCloud::JoinRequest.new(@options))
puts("Merged multiple text files pages using Ruby.")