sheetsu 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db726ef445452fbdbe85cebc1ee15a5be88bdb9f
4
- data.tar.gz: 6086857bd23fd0dca6675593323cf979d6ebbff9
3
+ metadata.gz: 60ebdb7b10c1ceaed32cb5119f354735227c7874
4
+ data.tar.gz: 6e535494e0a6cb0f9dbe64ea45c9e633f57070bd
5
5
  SHA512:
6
- metadata.gz: aa671f1d8c3434f1702712cacda63f475b82ebcc5d8702287d52dd7ddbc7cb7471c4bcd4cfe67ad5e50192f21db81b306f6b9b7e5d9ea42383981f1e8a91a5be
7
- data.tar.gz: 6281fe94c204e9c08cf0a3337d6b084f705c5ca2c817a54b32e1642b77cc0e08b272141470011640a489adca2eab73d6187a8308c3ebd9583c481eba413a9500
6
+ metadata.gz: 47980b4aad2938a0c695522d0462d5fc98757f1b62ce2c0b401c07a004b74cc5ee02e40ad3bd73b778ec9df044c93df5606e3a35166d2cd86ff5a94e878ccdad
7
+ data.tar.gz: b40d1bbc9371bfec25e8c0fbfc7c0c91251a8f9ecb71497540f02391dc682f01262af04038c9ad97a6b8c9dcb15ba9a7277ecf27ea827d607209ed7069b5899a
@@ -0,0 +1,19 @@
1
+ ---
2
+ engines:
3
+ bundler-audit:
4
+ enabled: true
5
+ duplication:
6
+ enabled: true
7
+ config:
8
+ languages:
9
+ - ruby
10
+ fixme:
11
+ enabled: true
12
+ rubocop:
13
+ enabled: true
14
+ ratings:
15
+ paths:
16
+ - Gemfile.lock
17
+ - "**.rb"
18
+ exclude_paths:
19
+ - spec/**/*
data/.gitignore CHANGED
@@ -7,6 +7,5 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- /sheetsu-ruby-*.gem
11
10
  /sheetsu-*.gem
12
11
  .rvmrc
@@ -7,3 +7,5 @@ before_install: gem install bundler -v 1.11.0
7
7
  addons:
8
8
  code_climate:
9
9
  repo_token: b99895016b0aab6980784d071a2f50a3273bf1bbbf03c976a5c98280c326ae1b
10
+ after_success:
11
+ - bundle exec codeclimate-test-reporter
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in sheetsu.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem "simplecov"
8
+ gem "codeclimate-test-reporter", "~> 1.0.0"
9
+ end
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- [![Build passing](https://travis-ci.org/sheetsu/sheetsu-ruby.svg?branch=master)](https://travis-ci.org/sheetsu/sheetsu-ruby) [![Code Climate](https://codeclimate.com/github/sheetsu/sheetsu-ruby/badges/gpa.svg)](https://codeclimate.com/github/sheetsu/sheetsu-ruby) [![Test Coverage](https://codeclimate.com/github/sheetsu/sheetsu-ruby/badges/coverage.svg)](https://codeclimate.com/github/sheetsu/sheetsu-ruby/coverage)
2
- # sheetsu-ruby
1
+ # sheetsu-ruby [![Build passing](https://travis-ci.org/sheetsu/sheetsu-ruby.svg?branch=master)](https://travis-ci.org/sheetsu/sheetsu-ruby) [![Code Climate](https://codeclimate.com/github/sheetsu/sheetsu-ruby/badges/gpa.svg)](https://codeclimate.com/github/sheetsu/sheetsu-ruby) [![Test Coverage](https://codeclimate.com/github/sheetsu/sheetsu-ruby/badges/coverage.svg)](https://codeclimate.com/github/sheetsu/sheetsu-ruby/coverage)
3
2
  Ruby bindings for the Sheetsu API (https://sheetsu.com/docs).
4
3
 
5
4
  ## Installation
@@ -7,7 +6,7 @@ Ruby bindings for the Sheetsu API (https://sheetsu.com/docs).
7
6
  Add this line to your application's Gemfile:
8
7
 
9
8
  ```ruby
10
- gem 'sheetsu-ruby'
9
+ gem 'sheetsu'
11
10
  ```
12
11
 
13
12
  And then execute:
@@ -16,7 +15,7 @@ And then execute:
16
15
 
17
16
  Or install it yourself as:
18
17
 
19
- $ gem install sheetsu-ruby
18
+ $ gem install sheetsu
20
19
 
21
20
  ## Usage
22
21
 
@@ -28,7 +27,7 @@ You need to create a new Sheetsu::Client object, and populate it with your Sheet
28
27
  require 'sheetsu'
29
28
 
30
29
  # Create new client object
31
- client = Sheetsu::Client.new("https://sheetsu.com/apis/v1.0/020b2c0f")
30
+ client = Sheetsu::Client.new("https://sheetsu.com/apis/v1.0or/020b2c0f")
32
31
  ```
33
32
  or
34
33
  ```ruby
@@ -189,6 +188,36 @@ client.delete(
189
188
 
190
189
  If success returns `:ok` symbol. If error check [errors](#errors).
191
190
 
191
+ ### Destroy
192
+ [Link to docs](https://docs.sheetsu.com/#destroy)
193
+
194
+ To destroy row(s), pass a hash with search params.
195
+
196
+ ```ruby
197
+ # Destroy all rows where 'name' equals 'Peter'
198
+ client.destroy(
199
+ { name: "Peter" } # column_name: value
200
+ )
201
+ ```
202
+
203
+ ```ruby
204
+ # Destroy all rows where 'name' equals 'Peter' and column 'score' equals '42'
205
+ client.destroy(
206
+ { name: "Peter", score: "42" } # column_name: value
207
+ )
208
+ ```
209
+
210
+ You can pass sheet name as a 2nd argument. All operations are performed on the first sheet, by default.
211
+ ```ruby
212
+ # Delete all rows where 'foo' equals 'bar' in sheet 'Sheet3'
213
+ client.destroy(
214
+ { name: "Peter" }, # column_name: value
215
+ "Sheet3" # sheet name
216
+ )
217
+ ```
218
+
219
+ On success, returns an array of hashes with all destroyed rows. If error check [errors](#errors).
220
+
192
221
  ### Errors
193
222
  There are different styles of error handling. We choose to throw exceptions and signal failure loudly. You do not need to deal with any HTTP responses from the API calls directly. All exceptions are matching particular response code from Sheetsu API. You can [read more about it here](https://sheetsu.com/docs#statuses).
194
223
 
@@ -238,7 +267,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/sheets
238
267
  ### Docs
239
268
 
240
269
  [Sheetsu documentation sits on GitHub](https://github.com/sheetsu/docs). We would love your contributions! We want to make these docs accessible and easy to understand for everyone. Please send us Pull Requests or open issues on GitHub.
241
-
242
- # To do
243
- - CodeClimate
244
- - RuboCop
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
- task :default => :spec
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -5,6 +5,7 @@ require 'sheetsu/create'
5
5
  require 'sheetsu/read'
6
6
  require 'sheetsu/update'
7
7
  require 'sheetsu/delete'
8
+ require 'sheetsu/destroy'
8
9
  require 'sheetsu/util'
9
10
  require 'sheetsu/version'
10
11
 
@@ -11,7 +11,7 @@ module Sheetsu
11
11
  Sheetsu::Create.new(@api_url, @http_basic_auth).row(data, { sheet: sheet })
12
12
  elsif data.is_a?(Array)
13
13
  Sheetsu::Create.new(@api_url, @http_basic_auth).rows(data, { sheet: sheet })
14
- end
14
+ end
15
15
  end
16
16
 
17
17
  def read(options={})
@@ -34,5 +34,10 @@ module Sheetsu
34
34
  Sheetsu::Delete.new(@api_url, @http_basic_auth).rows(options)
35
35
  end
36
36
 
37
+ def destroy(params, sheet=nil)
38
+ options = { sheet: sheet }
39
+
40
+ Sheetsu::Destroy.new(@api_url, @http_basic_auth).rows(params, options)
41
+ end
37
42
  end
38
43
  end
@@ -0,0 +1,11 @@
1
+ module Sheetsu
2
+ class Destroy < Sheetsu::Request
3
+
4
+ def rows(params, options)
5
+ add_options_to_url(options)
6
+
7
+ response = call(:delete, params)
8
+ parse_response(response)
9
+ end
10
+ end
11
+ end
@@ -1,7 +1,7 @@
1
1
  module Sheetsu
2
2
  module Util
3
3
 
4
- SHEETSU_API_URL_BEGINNING = "https://sheetsu.com/apis/v1.0/"
4
+ SHEETSU_API_URL_BEGINNING = "https://sheetsu.com/apis/v1.0or/"
5
5
 
6
6
  def self.default_headers
7
7
  {
@@ -1,3 +1,3 @@
1
1
  module Sheetsu
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sheetsu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Oblak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-10 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,9 +118,9 @@ executables: []
118
118
  extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
+ - ".codeclimate"
121
122
  - ".gitignore"
122
123
  - ".rspec"
123
- - ".simplecov"
124
124
  - ".travis.yml"
125
125
  - CODE_OF_CONDUCT.md
126
126
  - Gemfile
@@ -132,6 +132,7 @@ files:
132
132
  - lib/sheetsu/client.rb
133
133
  - lib/sheetsu/create.rb
134
134
  - lib/sheetsu/delete.rb
135
+ - lib/sheetsu/destroy.rb
135
136
  - lib/sheetsu/errors.rb
136
137
  - lib/sheetsu/read.rb
137
138
  - lib/sheetsu/request.rb
@@ -161,9 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  version: '0'
162
163
  requirements: []
163
164
  rubyforge_project:
164
- rubygems_version: 2.4.8
165
+ rubygems_version: 2.6.13
165
166
  signing_key:
166
167
  specification_version: 4
167
168
  summary: Turn Google Spreadsheets into REST APIs
168
169
  test_files: []
169
- has_rdoc:
data/.simplecov DELETED
@@ -1,4 +0,0 @@
1
- SimpleCov.start do
2
- add_group "lib", "lib"
3
- add_filter "/spec"
4
- end