Skip to content

Commit 49077f1

Browse files
Merge pull request #2 from rizwanniazigroupdocs/master
Updated GroupDocs.Viewer Cloud Ruby Examples with V2
2 parents effa217 + eed6a84 commit 49077f1

155 files changed

Lines changed: 1133 additions & 46828 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

.project renamed to Examples/.project

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
<projects>
66
</projects>
77
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
813
<buildCommand>
914
<name>org.eclipse.dltk.core.scriptbuilder</name>
1015
<arguments>

Gemfile renamed to Examples/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ gemspec
55
group :development, :test do
66
gem 'rake', '~> 12.0.0'
77
end
8-
gem "groupdocs_viewer_cloud", "~> 18.11"
8+
gem "groupdocs_viewer_cloud", "~> 19.3.2"

Gemfile.lock renamed to Examples/Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
groupdocs_viewer_cloud (18.12)
4+
groupdocs_viewer_cloud (19.3.2)
55
addressable (~> 2.5.0, >= 2.5.0)
66
faraday (~> 0.14.0)
77
mimemagic (~> 0.3.2)
@@ -13,7 +13,7 @@ GEM
1313
public_suffix (>= 2.0.2, < 4.0)
1414
faraday (0.14.0)
1515
multipart-post (>= 1.2, < 3)
16-
groupdocs_viewer_cloud (18.11.0)
16+
groupdocs_viewer_cloud (19.3.2)
1717
faraday (~> 0.14.0)
1818
mimemagic (~> 0.3.2)
1919
mimemagic (0.3.2)
@@ -26,7 +26,7 @@ PLATFORMS
2626
x64-mingw32
2727

2828
DEPENDENCIES
29-
groupdocs_viewer_cloud (~> 18.11, >= 18.10)
29+
groupdocs_viewer_cloud (~> 19.3.2, >= 19.3.2)
3030
groupdocs_viewer_cloud!
3131
minitest (~> 5.11, >= 5.11.3)
3232
rake (~> 12.0.0)

Examples/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2003-2019 Aspose Pty Ltd
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Examples/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GroupDocs.Viewer Cloud Ruby SDK
2+
Ruby gem for communicating with the GroupDocs.Viewer Cloud API
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Load the gem
2+
require 'groupdocs_viewer_cloud'
3+
4+
#require 'aspose_storage_cloud'
5+
$app_sid = ""
6+
$app_key = ""
7+
$storage_name = ""
8+
$host_url = "http://api.groupdocs.cloud" # Put your Host URL here
9+
$myStorage = "MyStorage"
10+
11+
class Common_Utilities
12+
def self.Get_ViewerApi_Instance()
13+
# Create instance of the API
14+
return GroupDocsViewerCloud::ViewerApi.from_keys($app_sid, $app_key)
15+
end
16+
17+
def self.Get_StorageApi_Instance()
18+
# Create instance of the API
19+
return GroupDocsViewerCloud::StorageApi.from_keys($app_sid, $app_key)
20+
end
21+
22+
def self.Get_FolderApi_Instance()
23+
# Create instance of the API
24+
return GroupDocsViewerCloud::FolderApi.from_keys($app_sid, $app_key)
25+
end
26+
27+
def self.Get_FileApi_Instance()
28+
# Create instance of the API
29+
return GroupDocsViewerCloud::FileApi.from_keys($app_sid, $app_key)
30+
end
31+
32+
def self.Upload_Test_File()
33+
34+
@TestFiles= Dir.entries(File.absolute_path("src/Resources/viewerdocs")).select {|f| !File.directory? f}
35+
36+
# Storage Api initialization
37+
storageApi = Get_StorageApi_Instance()
38+
fileApi = Get_FileApi_Instance()
39+
40+
puts("Files Count: "+((@TestFiles).length).to_s)
41+
42+
@TestFiles.each do |item|
43+
puts("File to Upload: "+File.basename(item))
44+
# skip existing file uploading
45+
fileExistRequest = GroupDocsViewerCloud::ObjectExistsRequest.new('viewerdocs/' + File.basename(item))
46+
fileExistsResponse = storageApi.object_exists(fileExistRequest)
47+
if fileExistsResponse.exists == false
48+
49+
# file content uploading
50+
fileContent = File.binread(File.dirname(item)+"/"+File.basename(item))
51+
putCreateRequest = GroupDocsViewerCloud::UploadFileRequest.new('viewerdocs/' + File.basename(item), fileContent)
52+
fileApi.upload_file(putCreateRequest)
53+
puts("Uploaded missing file: "+ File.basename(item))
54+
end
55+
end
56+
57+
puts("File Uploading completed..")
58+
end
59+
end
8.45 KB
Binary file not shown.
13.9 KB
Binary file not shown.
10 KB
Binary file not shown.

0 commit comments

Comments
 (0)