Class: Gslide::Models::SpreadsheetDraft
- Includes:
- Concerns::Requests
- Defined in:
- lib/gslide/models/spreadsheet.rb
Instance Method Summary collapse
- #create(options = {}) ⇒ Object
-
#initialize(auth: nil) ⇒ SpreadsheetDraft
constructor
A new instance of SpreadsheetDraft.
Methods included from Concerns::Requests
Constructor Details
#initialize(auth: nil) ⇒ SpreadsheetDraft
Returns a new instance of SpreadsheetDraft.
48 49 50 |
# File 'lib/gslide/models/spreadsheet.rb', line 48 def initialize(auth: nil) @auth = auth end |
Instance Method Details
#create(options = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/gslide/models/spreadsheet.rb', line 52 def create( = {}) request_body = .convert_keys { |k| k.to_s.lower_camel_case }.to_json uri = URI(GOOGLE_SHEETS) response_body = post_request(uri, auth_token: @auth.token, body: request_body) spreadsheet_id = response_body["spreadsheetId"] Spreadsheet.new(spreadsheet_id, auth: @auth) end |