Skip to content

Commit 6353a06

Browse files
committed
minor_refactor
1 parent dcd2668 commit 6353a06

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

sheets/src/eg_sheets_api.e

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ feature -- Spreedsheets Operations
105105
end
106106
end
107107

108-
append_with_id_raw (a_spreadsheet_id: attached like spreadsheet_id; a_raw_data: STRING): detachable like last_response.body
108+
append_with_id_raw (a_spreadsheet_id: attached like spreadsheet_id; a_range, a_raw_data: STRING): detachable like last_response.body
109109
note
110110
EIS:"name=append.spreedsheets", "src=https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append", "protocol=uri"
111111
require
@@ -126,7 +126,7 @@ feature -- Spreedsheets Operations
126126

127127
-- TODO add url encode to the query parameters.
128128
create url_encoder
129-
l_path_params_s.append (url_encoder.encoded_string ("Sheet1!A1:B5")) -- range ex. A1:B2 or namedRanges TRY: Sheet1!A:A | last not null index could be: =index(J:J,max(row(J:J)*(J:J<>"")))
129+
l_path_params_s.append (url_encoder.encoded_string (a_range)) -- range ex. A1:B2 or namedRanges TRY: Sheet1!A:A | last not null index could be: =index(J:J,max(row(J:J)*(J:J<>"")))
130130

131131
l_path_params_s.append (":append")
132132
-- qry params
@@ -141,6 +141,7 @@ feature -- Spreedsheets Operations
141141

142142

143143
l_post_data := a_raw_data
144+
logger.write_debug ("append_with_id_raw -> post data are:" + l_post_data + "-----")
144145

145146
-- Google API append require body parameter instead of upload data.
146147
api_post_call (sheets_url ("spreadsheets/" + l_path_params_s, Void), l_qry_params, l_post_data, Void)

sheets/test/test_sheets_api.e

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ feature -- Tests
109109
test_append_sheet (a_sheet_id: attached like {EG_SHEETS_API}.spreadsheet_id; a_data: STRING)
110110
local
111111
l_esapi: EG_SHEETS_API
112+
l_range: STRING
112113
do
113114
create l_esapi.make (last_token.token)
114-
if attached l_esapi.append_with_id_raw (a_sheet_id, a_data) as l_spreedsheet_get_result then
115+
l_range := "Sheet1" + "!A1:A"
116+
117+
if attached l_esapi.append_with_id_raw (a_sheet_id, l_range, a_data) as l_spreedsheet_get_result then
115118
if l_esapi.has_error then
116119
-- debug ("test_create_sheet")
117120
print ("test_append_sheet-> Error %N" )

0 commit comments

Comments
 (0)