sg 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +35 -0
- data/lib/sg/version.rb +1 -1
- data/lib/sg.rb +28 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c69276b3aa823085cd154fd690173f59a7e0cd
|
4
|
+
data.tar.gz: c0c632215de867766f0155e82e1a4d3d49a4e9c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 640cd7e37314d6e18ffa11400aed59756f86c489983ffc44e2dc7964decfb5c34064b19e92504f21d0b674f19316729ae4b485907a0e94503dfb2fb1659518fa
|
7
|
+
data.tar.gz: 0269800f26f161a94d61bc0c0a7b5da56a70270f85c9f504ab7dcfac8a80cf9afcf13d329e99e56c6779c9c4e9d4dd5cb5b1e8986688746a231a82ce871e73c6
|
data/README.md
CHANGED
@@ -23,6 +23,41 @@ See help.
|
|
23
23
|
|
24
24
|
$ bundle exec sg client help
|
25
25
|
|
26
|
+
### Example
|
27
|
+
|
28
|
+
1.
|
29
|
+
|
30
|
+
GET https://api.sendgrid.com/v3/api_keys HTTP/1.1
|
31
|
+
|
32
|
+
should be:
|
33
|
+
|
34
|
+
$ bundle exec sg client api_keys get
|
35
|
+
|
36
|
+
2.
|
37
|
+
|
38
|
+
GET https://api.sendgrid.com/v3/api_keys/YOUR_API_KEY_ID HTTP/1.1
|
39
|
+
|
40
|
+
should be:
|
41
|
+
|
42
|
+
$ bundle exec sg client api_keys YOUR_API_KEY_ID get
|
43
|
+
|
44
|
+
3.
|
45
|
+
|
46
|
+
GET https://api.sendgrid.com/v3/suppression/bounces?start_time=14324566&end_time=14324566 HTTP/1.1
|
47
|
+
|
48
|
+
should be:
|
49
|
+
|
50
|
+
$ bundle exec sg client suppression bounces get -q='{"start_time": 14324566, "end_time": 14324566}'
|
51
|
+
|
52
|
+
4.
|
53
|
+
|
54
|
+
POST https://api.sendgrid.com/v3/api_keys HTTP/1.1
|
55
|
+
{"name": "My API Key", "scopes": ["mail.send"]}
|
56
|
+
|
57
|
+
should be:
|
58
|
+
|
59
|
+
$ bundle exec sg client api_keys post -b='{"name": "My API Key", "scopes": ["mail.send"]}'
|
60
|
+
|
26
61
|
## Development
|
27
62
|
|
28
63
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec sg` to use the gem in this directory, ignoring other installed copies of this gem.
|
data/lib/sg/version.rb
CHANGED
data/lib/sg.rb
CHANGED
@@ -7,7 +7,34 @@ module Sg
|
|
7
7
|
# SendGrid Command Line Interface Class
|
8
8
|
#
|
9
9
|
class CLI < Thor
|
10
|
-
desc
|
10
|
+
desc(
|
11
|
+
'client *PATH_TO_THE_ENDPOINT VERB',
|
12
|
+
'Call SendGrid Web API v3 from command line interface'
|
13
|
+
)
|
14
|
+
long_desc <<-DESC
|
15
|
+
1. Simple GET call
|
16
|
+
\x5Use the client command with path after v3 level with space.
|
17
|
+
Then add the HTTP verb at the end of the command.
|
18
|
+
\x5GET https://api.sendgrid.com/v3/api_keys
|
19
|
+
\x5> $ bundle exec sg client api_keys get
|
20
|
+
|
21
|
+
2. With variable
|
22
|
+
\x5Use the client command with the variable values.
|
23
|
+
Then add the HTTP verb at the end of the command.
|
24
|
+
\x5GET https://api.sendgrid.com/v3/api_keys/YOUR_API_KEY_ID
|
25
|
+
\x5> $ bundle exec sg client api_keys YOUR_API_KEY_ID get
|
26
|
+
|
27
|
+
3. With query string
|
28
|
+
\x5Use -q option for the query string with the JSON string value.
|
29
|
+
\x5GET https://api.sendgrid.com/v3/suppression/bounces?start_time=14324566&end_time=14324566
|
30
|
+
\x5> $ bundle exec sg client suppression bounces get -q='{"start_time": 14324566, "end_time": 14324566}'
|
31
|
+
|
32
|
+
4. With request body
|
33
|
+
\x5Use -b option for the request body with the JSON string value.
|
34
|
+
\x5POST https://api.sendgrid.com/v3/api_keys
|
35
|
+
\x5{"name": "My API Key", "scopes": ["mail.send"]}
|
36
|
+
\x5> $ bundle exec sg client api_keys post -b='{"name": "My API Key", "scopes": ["mail.send"]}'
|
37
|
+
DESC
|
11
38
|
option(
|
12
39
|
:apikey,
|
13
40
|
aliases: '-k',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- awwa500@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.4.6
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Call SendGrid API v3 from the command line interface.
|