aspose_cells_cloud 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/aspose_cells_cloud.rb +3 -0
- data/lib/aspose_cells_cloud/api/cells_api.rb +1274 -4
- data/lib/aspose_cells_cloud/api_client.rb +6 -2
- data/lib/aspose_cells_cloud/models/auto_filter_response.rb +53 -0
- data/lib/aspose_cells_cloud/models/calculation_options.rb +61 -0
- data/lib/aspose_cells_cloud/models/color_filter_request.rb +53 -0
- data/lib/aspose_cells_cloud/version.rb +1 -1
- data/test/cells_tests.rb +207 -5
- metadata +5 -2
@@ -86,6 +86,7 @@ module AsposeCellsCloud
|
|
86
86
|
end
|
87
87
|
|
88
88
|
url = sign(url, opts[:query_params])
|
89
|
+
puts url
|
89
90
|
Typhoeus::Request.new(url, req_opts)
|
90
91
|
|
91
92
|
end
|
@@ -106,7 +107,9 @@ module AsposeCellsCloud
|
|
106
107
|
}
|
107
108
|
url = url[0..-2]
|
108
109
|
end
|
109
|
-
|
110
|
+
|
111
|
+
puts "Before Sign"
|
112
|
+
|
110
113
|
url = URI.escape(url)
|
111
114
|
parsed_url = URI.parse(url)
|
112
115
|
|
@@ -117,7 +120,8 @@ module AsposeCellsCloud
|
|
117
120
|
else
|
118
121
|
url_to_sign += "?appSID=#{AsposeApp.app_sid}"
|
119
122
|
end
|
120
|
-
|
123
|
+
|
124
|
+
puts url_to_sign
|
121
125
|
# create a signature using the private key and the URL
|
122
126
|
raw_signature = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), AsposeApp.app_key, url_to_sign)
|
123
127
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module AsposeCellsCloud
|
2
|
+
#
|
3
|
+
class AutoFilterResponse < BaseObject
|
4
|
+
attr_accessor :auto_filter, :code, :status
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'auto_filter' => :'AutoFilter',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'code' => :'Code',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'status' => :'Status'
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# attribute type
|
22
|
+
def self.swagger_types
|
23
|
+
{
|
24
|
+
:'auto_filter' => :'AutoFilter',
|
25
|
+
:'code' => :'String',
|
26
|
+
:'status' => :'String'
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(attributes = {})
|
32
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
33
|
+
|
34
|
+
# convert string to symbol for hash key
|
35
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
36
|
+
|
37
|
+
|
38
|
+
if attributes[:'AutoFilter']
|
39
|
+
self.auto_filter = attributes[:'AutoFilter']
|
40
|
+
end
|
41
|
+
|
42
|
+
if attributes[:'Code']
|
43
|
+
self.code = attributes[:'Code']
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:'Status']
|
47
|
+
self.status = attributes[:'Status']
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module AsposeCellsCloud
|
2
|
+
#
|
3
|
+
class CalculationOptions < BaseObject
|
4
|
+
attr_accessor :calc_stack_size, :ignore_error, :precision_strategy, :recursive
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'calc_stack_size' => :'CalcStackSize',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'ignore_error' => :'IgnoreError',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'precision_strategy' => :'PrecisionStrategy',
|
17
|
+
|
18
|
+
#
|
19
|
+
:'recursive' => :'Recursive'
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# attribute type
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
:'calc_stack_size' => :'Integer',
|
28
|
+
:'ignore_error' => :'BOOLEAN',
|
29
|
+
:'precision_strategy' => :'String',
|
30
|
+
:'recursive' => :'BOOLEAN'
|
31
|
+
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
40
|
+
|
41
|
+
|
42
|
+
if attributes[:'CalcStackSize']
|
43
|
+
self.calc_stack_size = attributes[:'CalcStackSize']
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:'IgnoreError']
|
47
|
+
self.ignore_error = attributes[:'IgnoreError']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes[:'PrecisionStrategy']
|
51
|
+
self.precision_strategy = attributes[:'PrecisionStrategy']
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:'Recursive']
|
55
|
+
self.recursive = attributes[:'Recursive']
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module AsposeCellsCloud
|
2
|
+
#
|
3
|
+
class ColorFilterRequest < BaseObject
|
4
|
+
attr_accessor :pattern, :foreground_color, :background_color
|
5
|
+
# attribute mapping from ruby-style variable name to JSON key
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
|
9
|
+
#
|
10
|
+
:'pattern' => :'Pattern',
|
11
|
+
|
12
|
+
#
|
13
|
+
:'foreground_color' => :'ForegroundColor',
|
14
|
+
|
15
|
+
#
|
16
|
+
:'background_color' => :'BackgroundColor'
|
17
|
+
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# attribute type
|
22
|
+
def self.swagger_types
|
23
|
+
{
|
24
|
+
:'pattern' => :'String',
|
25
|
+
:'foreground_color' => :'CellsColor',
|
26
|
+
:'background_color' => :'CellsColor'
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(attributes = {})
|
32
|
+
return if !attributes.is_a?(Hash) || attributes.empty?
|
33
|
+
|
34
|
+
# convert string to symbol for hash key
|
35
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
36
|
+
|
37
|
+
|
38
|
+
if attributes[:'Pattern']
|
39
|
+
self.pattern = attributes[:'Pattern']
|
40
|
+
end
|
41
|
+
|
42
|
+
if attributes[:'ForegroundColor']
|
43
|
+
self.foreground_color = attributes[:'ForegroundColor']
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:'BackgroundColor']
|
47
|
+
self.background_color = attributes[:'BackgroundColor']
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
data/test/cells_tests.rb
CHANGED
@@ -10,7 +10,7 @@ class CellsTests < Minitest::Test
|
|
10
10
|
|
11
11
|
def setup
|
12
12
|
#Get App key and App SID from https://cloud.aspose.com
|
13
|
-
AsposeApp.app_key_and_sid("
|
13
|
+
AsposeApp.app_key_and_sid("", "")
|
14
14
|
@cells_api = CellsApi.new
|
15
15
|
end
|
16
16
|
|
@@ -99,9 +99,11 @@ class CellsTests < Minitest::Test
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def test_post_workbook_calculate_formula
|
102
|
-
file_name = "
|
102
|
+
file_name = "Book1.xlsx"
|
103
103
|
upload_file(file_name)
|
104
|
+
ignore_error = true
|
104
105
|
|
106
|
+
post_workbook_calculate_formula(file_name, options, ignore_error, opts = {})
|
105
107
|
response = @cells_api.post_workbook_calculate_formula(file_name)
|
106
108
|
assert(response, message="Failed to calculate all formulas in workbook")
|
107
109
|
end
|
@@ -734,12 +736,12 @@ class CellsTests < Minitest::Test
|
|
734
736
|
end
|
735
737
|
|
736
738
|
def test_delete_worksheet_columns
|
737
|
-
file_name = "
|
739
|
+
file_name = "test_cells.xlsx"
|
738
740
|
upload_file(file_name)
|
739
741
|
|
740
742
|
sheet_name = "Sheet1"
|
741
|
-
column_index =
|
742
|
-
columns =
|
743
|
+
column_index = 0
|
744
|
+
columns = 0
|
743
745
|
update_reference = true
|
744
746
|
response = @cells_api.delete_worksheet_columns(file_name, sheet_name, column_index, columns, update_reference)
|
745
747
|
assert(response, message="Failed to delete worksheet columns")
|
@@ -1916,6 +1918,206 @@ class CellsTests < Minitest::Test
|
|
1916
1918
|
assert(response, message="Failed to delete all comments in a worksheet")
|
1917
1919
|
end
|
1918
1920
|
|
1921
|
+
def test_get_worksheet_auto_filter
|
1922
|
+
file_name = "Book1.xlsx"
|
1923
|
+
upload_file(file_name)
|
1924
|
+
|
1925
|
+
sheet_name = "Sheet1"
|
1926
|
+
response = @cells_api.get_worksheet_auto_filter(file_name, sheet_name)
|
1927
|
+
puts response
|
1928
|
+
assert(response, message="Failed to get Auto filter description")
|
1929
|
+
end
|
1930
|
+
|
1931
|
+
def test_put_worksheet_date_filter
|
1932
|
+
file_name = "Book1.xlsx"
|
1933
|
+
upload_file(file_name)
|
1934
|
+
|
1935
|
+
sheet_name = "Sheet1"
|
1936
|
+
range="A1:B1"
|
1937
|
+
field_index=0
|
1938
|
+
date_time_grouping_type="Year"
|
1939
|
+
|
1940
|
+
response = @cells_api.put_worksheet_date_filter(file_name, sheet_name, range, field_index, date_time_grouping_type,
|
1941
|
+
{year: 1920, match_blanks:false, refresh:true})
|
1942
|
+
assert(response, message="Failed to add date filter in worksheet")
|
1943
|
+
end
|
1944
|
+
|
1945
|
+
def test_delete_worksheet_date_filter
|
1946
|
+
file_name = "Book1.xlsx"
|
1947
|
+
upload_file(file_name)
|
1948
|
+
|
1949
|
+
sheet_name = "Sheet1"
|
1950
|
+
field_index=0
|
1951
|
+
date_time_grouping_type="Year"
|
1952
|
+
|
1953
|
+
response = @cells_api.delete_worksheet_date_filter(file_name, sheet_name, field_index, date_time_grouping_type, {year: 1920})
|
1954
|
+
assert(response, message="Failed to remove a date filter")
|
1955
|
+
end
|
1956
|
+
|
1957
|
+
def test_put_worksheet_filter
|
1958
|
+
file_name = "Book1.xlsx"
|
1959
|
+
upload_file(file_name)
|
1960
|
+
|
1961
|
+
sheet_name = "Sheet1"
|
1962
|
+
range="A1:B1"
|
1963
|
+
field_index=0
|
1964
|
+
criteria="Year"
|
1965
|
+
|
1966
|
+
response = @cells_api.put_worksheet_filter(file_name, sheet_name, range, field_index, criteria)
|
1967
|
+
assert(response, message="Failed to add a filter for a filter column")
|
1968
|
+
end
|
1969
|
+
|
1970
|
+
def test_delete_worksheet_filter
|
1971
|
+
file_name = "Book1.xlsx"
|
1972
|
+
upload_file(file_name)
|
1973
|
+
|
1974
|
+
sheet_name = "Sheet1"
|
1975
|
+
field_index=0
|
1976
|
+
|
1977
|
+
response = @cells_api.delete_worksheet_filter(file_name, sheet_name, field_index, {criteria: "Year"})
|
1978
|
+
assert(response, message="Failed to delete a filter for a filter column")
|
1979
|
+
end
|
1980
|
+
|
1981
|
+
def test_put_worksheet_icon_filter
|
1982
|
+
file_name = "Book1.xlsx"
|
1983
|
+
upload_file(file_name)
|
1984
|
+
|
1985
|
+
sheet_name = "Sheet1"
|
1986
|
+
range="A1:B1"
|
1987
|
+
field_index=0
|
1988
|
+
icon_set_type="ArrowsGray3"
|
1989
|
+
icon_id = 1
|
1990
|
+
|
1991
|
+
response = @cells_api.put_worksheet_icon_filter(file_name, sheet_name, range, field_index, icon_set_type, icon_id, {match_blanks: false})
|
1992
|
+
assert(response, message="Failed to add an icon filter")
|
1993
|
+
end
|
1994
|
+
|
1995
|
+
def test_put_worksheet_custom_filter
|
1996
|
+
file_name = "Book1.xlsx"
|
1997
|
+
upload_file(file_name)
|
1998
|
+
|
1999
|
+
sheet_name = "Sheet1"
|
2000
|
+
range="A1:B1"
|
2001
|
+
field_index=0
|
2002
|
+
operator_type1="LessOrEqual"
|
2003
|
+
criteria1 = 1
|
2004
|
+
|
2005
|
+
response = @cells_api.put_worksheet_custom_filter(file_name, sheet_name, range, field_index, operator_type1, criteria1, {match_blanks: false})
|
2006
|
+
assert(response, message="Failed to filters a list with a custom criteria")
|
2007
|
+
end
|
2008
|
+
|
2009
|
+
def test_put_worksheet_dynamic_filter
|
2010
|
+
file_name = "Book1.xlsx"
|
2011
|
+
upload_file(file_name)
|
2012
|
+
|
2013
|
+
sheet_name = "Sheet1"
|
2014
|
+
range="A1:B1"
|
2015
|
+
field_index=0
|
2016
|
+
dynamic_filter_type="BelowAverage"
|
2017
|
+
|
2018
|
+
response = @cells_api.put_worksheet_dynamic_filter(file_name, sheet_name, range, field_index, dynamic_filter_type, {match_blanks: true})
|
2019
|
+
assert(response, message="Failed to add dynamic filter")
|
2020
|
+
end
|
2021
|
+
|
2022
|
+
def test_put_worksheet_filter_top10
|
2023
|
+
file_name = "Book1.xlsx"
|
2024
|
+
upload_file(file_name)
|
2025
|
+
|
2026
|
+
sheet_name = "Sheet1"
|
2027
|
+
range="A1:B1"
|
2028
|
+
field_index=0
|
2029
|
+
is_top=true
|
2030
|
+
item_count = 1
|
2031
|
+
|
2032
|
+
response = @cells_api.put_worksheet_filter_top10(file_name, sheet_name, range, field_index, is_top, item_count, opts = {match_blanks: true, is_percent: true})
|
2033
|
+
assert(response, message="Failed to filter the top 10 item in the list")
|
2034
|
+
end
|
2035
|
+
|
2036
|
+
def test_put_worksheet_color_filter
|
2037
|
+
file_name = "Book1.xlsx"
|
2038
|
+
upload_file(file_name)
|
2039
|
+
|
2040
|
+
sheet_name = "Sheet1"
|
2041
|
+
range="A1:B1"
|
2042
|
+
field_index=0
|
2043
|
+
|
2044
|
+
color_filter_request = ColorFilterRequest.new
|
2045
|
+
color_filter_request.pattern = "Solid"
|
2046
|
+
|
2047
|
+
foreground_color = CellsColor.new
|
2048
|
+
color = Color.new
|
2049
|
+
color.a = "255"
|
2050
|
+
color.r = "0"
|
2051
|
+
color.g = "255"
|
2052
|
+
color.b = "255"
|
2053
|
+
foreground_color.color = color
|
2054
|
+
foreground_theme_color = ThemeColor.new
|
2055
|
+
foreground_theme_color.color_type = "Text2"
|
2056
|
+
foreground_theme_color.tint = 1
|
2057
|
+
foreground_color.theme_color = foreground_theme_color
|
2058
|
+
foreground_color.type = "Automatic"
|
2059
|
+
color_filter_request.foreground_color = foreground_color
|
2060
|
+
|
2061
|
+
background_color = CellsColor.new
|
2062
|
+
color = Color.new
|
2063
|
+
color.a = "255"
|
2064
|
+
color.r = "255"
|
2065
|
+
color.g = "0"
|
2066
|
+
color.b = "0"
|
2067
|
+
background_color.color = color
|
2068
|
+
background_theme_color = ThemeColor.new
|
2069
|
+
background_theme_color.color_type = "Text2"
|
2070
|
+
background_theme_color.tint = 1
|
2071
|
+
background_color.theme_color = background_theme_color
|
2072
|
+
background_color.type = "Automatic"
|
2073
|
+
color_filter_request.background_color = background_color
|
2074
|
+
|
2075
|
+
response = @cells_api.put_worksheet_color_filter(file_name, sheet_name, range, field_index, color_filter_request, {match_blanks: true})
|
2076
|
+
assert(response, message="Failed to add color filter")
|
2077
|
+
end
|
2078
|
+
|
2079
|
+
def test_post_worksheet_match_blanks
|
2080
|
+
file_name = "Book1.xlsx"
|
2081
|
+
upload_file(file_name)
|
2082
|
+
|
2083
|
+
sheet_name = "Sheet1"
|
2084
|
+
field_index=0
|
2085
|
+
|
2086
|
+
response = @cells_api.post_worksheet_match_blanks(file_name, sheet_name, field_index)
|
2087
|
+
assert(response, message="Failed to match all blank cell in the list")
|
2088
|
+
end
|
2089
|
+
|
2090
|
+
def test_post_worksheet_match_non_blanks
|
2091
|
+
file_name = "Book1.xlsx"
|
2092
|
+
upload_file(file_name)
|
1919
2093
|
|
2094
|
+
sheet_name = "Sheet1"
|
2095
|
+
field_index=0
|
2096
|
+
|
2097
|
+
response = @cells_api.post_worksheet_match_non_blanks(file_name, sheet_name, field_index)
|
2098
|
+
assert(response, message="Failed to match all not blank cell in the list")
|
2099
|
+
end
|
1920
2100
|
|
2101
|
+
def test_post_worksheet_auto_filter_refresh
|
2102
|
+
file_name = "Book1.xlsx"
|
2103
|
+
upload_file(file_name)
|
2104
|
+
|
2105
|
+
sheet_name = "Sheet1"
|
2106
|
+
|
2107
|
+
response = @cells_api.post_worksheet_auto_filter_refresh(file_name, sheet_name)
|
2108
|
+
assert(response, message="Failed to refresh auto filter")
|
2109
|
+
end
|
2110
|
+
|
2111
|
+
def test_post_workbook_calculate_formula
|
2112
|
+
file_name = "Book1.xlsx"
|
2113
|
+
upload_file(file_name)
|
2114
|
+
|
2115
|
+
ignore_error = true
|
2116
|
+
|
2117
|
+
calculation_options = CalculationOptions.new
|
2118
|
+
calculation_options.calc_stack_size = 1
|
2119
|
+
|
2120
|
+
response = @cells_api.post_workbook_calculate_formula(file_name, calculation_options, ignore_error)
|
2121
|
+
assert(response, message="Failed to calculate all formulas in workbook")
|
2122
|
+
end
|
1921
2123
|
end
|