Sha256: af204d478437e6c483ddf1489715a6257c0fe0f7e87a4279f24e6cc3acb55109

Contents?: true

Size: 673 Bytes

Versions: 2

Compression:

Stored size: 673 Bytes

Contents

module Sheetsu
  class Client
    include HTTParty

    def initialize(id)
      @id = id
      self.class.base_uri "https://sheetsu.com/apis"
    end

    def get
      response = self.class.get("/#{@id}")

      ErrorHandler.response_code_to_exception response
      response
    end

    def get_column(name)
      response = self.class.get("/#{@id}/column/#{name}")

      ErrorHandler.response_code_to_exception response
      response
    end

    def create(row)
      response = self.class.post("/#{@id}", body: row.to_json, headers: { 'Content-Type' => 'application/json' })

      ErrorHandler.response_code_to_exception response
      response
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sheetsu-0.1.1 lib/sheetsu/client.rb
sheetsu-0.1.0 lib/sheetsu/client.rb