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 +4 -4
- data/.codeclimate +19 -0
- data/.gitignore +0 -1
- data/.travis.yml +2 -0
- data/Gemfile +5 -0
- data/README.md +34 -9
- data/Rakefile +5 -1
- data/lib/sheetsu.rb +1 -0
- data/lib/sheetsu/client.rb +6 -1
- data/lib/sheetsu/destroy.rb +11 -0
- data/lib/sheetsu/util.rb +1 -1
- data/lib/sheetsu/version.rb +1 -1
- metadata +5 -5
- data/.simplecov +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60ebdb7b10c1ceaed32cb5119f354735227c7874
|
4
|
+
data.tar.gz: 6e535494e0a6cb0f9dbe64ea45c9e633f57070bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47980b4aad2938a0c695522d0462d5fc98757f1b62ce2c0b401c07a004b74cc5ee02e40ad3bd73b778ec9df044c93df5606e3a35166d2cd86ff5a94e878ccdad
|
7
|
+
data.tar.gz: b40d1bbc9371bfec25e8c0fbfc7c0c91251a8f9ecb71497540f02391dc682f01262af04038c9ad97a6b8c9dcb15ba9a7277ecf27ea827d607209ed7069b5899a
|
data/.codeclimate
ADDED
@@ -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
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
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
|
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
|
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.
|
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
data/lib/sheetsu.rb
CHANGED
data/lib/sheetsu/client.rb
CHANGED
@@ -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
|
data/lib/sheetsu/util.rb
CHANGED
data/lib/sheetsu/version.rb
CHANGED
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.
|
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:
|
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.
|
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