ruby_http_client 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +16 -0
- data/.github/PULL_REQUEST_TEMPLATE +24 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +41 -0
- data/CONTRIBUTING.md +13 -13
- data/LICENSE.txt +1 -1
- data/README.md +30 -9
- data/TROUBLESHOOTING.md +17 -0
- data/lib/ruby_http_client.rb +1 -1
- data/ruby_http_client.gemspec +1 -1
- data/test/test_ruby_http_client.rb +4 -4
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f96204e110fa9585143ab6df25e1f452ac13a264
|
4
|
+
data.tar.gz: e61b148893688c666f487682a93693b08e32a276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd090f25ab9ef5fc013feeb1e78d955d749c78de5a78b062e3672b8d9fbdb5fecd0a2be6ce9740b99513d8155099ee1911fde3125ce398da9e9652cbbc51eeee
|
7
|
+
data.tar.gz: 17e37ac97e6b926f85e2ad97acdd72a6afb0f1ef533c114f0b74be513452da60ffa1fcaf5a571c443e0b757adec692e04438f9d79153b0f69cefe26857020293
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<!--
|
2
|
+
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.
|
3
|
+
|
4
|
+
|
5
|
+
Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
|
6
|
+
e.g.
|
7
|
+
Fixes #1
|
8
|
+
Closes #2
|
9
|
+
-->
|
10
|
+
# Fixes #
|
11
|
+
|
12
|
+
### Checklist
|
13
|
+
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
|
14
|
+
- [ ] I have read the [Contribution Guide] and my PR follows them.
|
15
|
+
- [ ] I updated my branch with the master branch.
|
16
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
17
|
+
- [ ] I have added necessary documentation about the functionality in the appropriate .md file
|
18
|
+
- [ ] I have added in line documentation to the code I modified
|
19
|
+
|
20
|
+
### Short description of what this PR does:
|
21
|
+
-
|
22
|
+
-
|
23
|
+
|
24
|
+
If you have questions, please send an email to [Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [3.3.0] - 2017-10-30
|
7
|
+
## Added
|
8
|
+
- #11 fix: Allow for multiple values for a parameter
|
9
|
+
- Thanks to [xiaoboa](https://github.com/xiaoboa) for the pull request!
|
10
|
+
|
6
11
|
## [3.2.0] - 2017-09-01
|
7
12
|
### Added
|
8
13
|
- #12 Add a helper returns the response body as a hash
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# SendGrid Community Code of Conduct
|
2
|
+
|
3
|
+
The SendGrid open source community is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences successes and continued growth. When you're working with members of the community, we encourage you to follow these guidelines, which help steer our interactions and strive to maintain a positive, successful and growing community.
|
4
|
+
|
5
|
+
### Be Open
|
6
|
+
Members of the community are open to collaboration, whether it's on pull requests, code reviews, approvals, issues or otherwise. We're receptive to constructive comments and criticism, as the experiences and skill sets of all members contribute to the whole of our efforts. We're accepting of all who wish to take part in our activities, fostering an environment where anyone can participate, and everyone can make a difference.
|
7
|
+
|
8
|
+
### Be Considerate
|
9
|
+
Members of the community are considerate of their peers, which include other contributors and users of SendGrid. We're thoughtful when addressing the efforts of others, keeping in mind that often the labor was completed with the intent of the good of the community. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.
|
10
|
+
|
11
|
+
### Be Respectful
|
12
|
+
Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments and their efforts. We're respectful of the volunteer efforts that permeate the SendGrid community. We're respectful of the processes outlined in the community, and we work within them. When we disagree, we are courteous in raising our issues. Overall, we're good to each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.
|
13
|
+
|
14
|
+
## Additional Guidance
|
15
|
+
|
16
|
+
### Disclose Potential Conflicts of Interest
|
17
|
+
Community discussions often involve interested parties. We expect participants to be aware when they are conflicted due to employment or other projects they are involved in and disclose those interests to other project members. When in doubt, over-disclose. Perceived conflicts of interest are important to address so that the community’s decisions are credible even when unpopular, difficult or favorable to the interests of one group over another.
|
18
|
+
|
19
|
+
### Interpretation
|
20
|
+
This Code is not exhaustive or complete. It is not a rulebook; it serves to distill our common understanding of a collaborative, shared environment and goals. We expect it to be followed in spirit as much as in the letter. When in doubt, try to abide by [SendGrid’s cultural values](https://sendgrid.com/blog/employee-engagement-the-4h-way) defined by our “4H’s”: Happy, Hungry, Humble and Honest.
|
21
|
+
|
22
|
+
### Enforcement
|
23
|
+
Most members of the SendGrid community always comply with this Code, not because of the existence of this Code, but because they have long experience participating in open source communities where the conduct described above is normal and expected. However, failure to observe this Code may be grounds for suspension, reporting the user for abuse or changing permissions for outside contributors.
|
24
|
+
|
25
|
+
## If you have concerns about someone’s conduct
|
26
|
+
**Initiate Direct Contact** - It is always appropriate to email a community member (if contact information is available), mention that you think their behavior was out of line, and (if necessary) point them to this Code.
|
27
|
+
|
28
|
+
**Discuss Publicly** - Discussing publicly is always acceptable. Note, though, that approaching the person directly may be better, as it tends to make them less defensive, and it respects the time of other community members, so you probably want to try direct contact first.
|
29
|
+
|
30
|
+
**Contact the Moderators** - You can reach the SendGrid moderators by emailing dx@sendgrid.com.
|
31
|
+
|
32
|
+
## Submission to SendGrid Repositories
|
33
|
+
Finally, just a reminder, changes to the SendGrid repositories will only be accepted upon completion of the [SendGrid Contributor Agreement](https://cla.sendgrid.com).
|
34
|
+
|
35
|
+
## Attribution
|
36
|
+
|
37
|
+
SendGrid thanks the following, on which it draws for content and inspiration:
|
38
|
+
|
39
|
+
* [Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/)
|
40
|
+
* [Open Source Initiative General Code of Conduct](https://opensource.org/codeofconduct)
|
41
|
+
* [Apache Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)
|
data/CONTRIBUTING.md
CHANGED
@@ -2,13 +2,13 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou
|
|
2
2
|
|
3
3
|
- [CLAs and CCLAs](#cla)
|
4
4
|
- [Roadmap & Milestones](#roadmap)
|
5
|
-
- [Feature Request](#
|
6
|
-
- [Submit a Bug Report](#
|
7
|
-
- [Improvements to the Codebase](#
|
8
|
-
- [Understanding the Code Base](#
|
5
|
+
- [Feature Request](#feature-request)
|
6
|
+
- [Submit a Bug Report](#submit-a-bug-report)
|
7
|
+
- [Improvements to the Codebase](#improvements-to-the-codebase)
|
8
|
+
- [Understanding the Code Base](#understanding-the-codebase)
|
9
9
|
- [Testing](#testing)
|
10
|
-
- [Style Guidelines & Naming Conventions](#
|
11
|
-
- [Creating a Pull Request](#
|
10
|
+
- [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions)
|
11
|
+
- [Creating a Pull Request](#creating-a-pull-request)
|
12
12
|
|
13
13
|
<a name="roadmap"></a>
|
14
14
|
We use [Milestones](https://github.com/sendgrid/ruby-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
|
@@ -26,7 +26,7 @@ When you create a Pull Request, after a few seconds, a comment will appear with
|
|
26
26
|
|
27
27
|
There are a few ways to contribute, which we'll enumerate below:
|
28
28
|
|
29
|
-
<a name="
|
29
|
+
<a name="feature-request"></a>
|
30
30
|
## Feature Request
|
31
31
|
|
32
32
|
If you'd like to make a feature request, please read this section.
|
@@ -36,7 +36,7 @@ The GitHub issue tracker is the preferred channel for library feature requests,
|
|
36
36
|
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
|
37
37
|
- Please be respectful and considerate of others when commenting on issues
|
38
38
|
|
39
|
-
<a name="
|
39
|
+
<a name="submit-a-bug-report"></a>
|
40
40
|
## Submit a Bug Report
|
41
41
|
|
42
42
|
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
|
@@ -53,7 +53,7 @@ Before you decide to create a new issue, please try the following:
|
|
53
53
|
|
54
54
|
In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/ruby-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
|
55
55
|
|
56
|
-
<a name="
|
56
|
+
<a name="improvements-to-the-codebase"></a>
|
57
57
|
## Improvements to the Codebase
|
58
58
|
|
59
59
|
We welcome direct contributions to the ruby-http-client code base. Thank you!
|
@@ -95,7 +95,7 @@ To run the example (after updating the emails):
|
|
95
95
|
ruby examples/example.rb
|
96
96
|
```
|
97
97
|
|
98
|
-
<a name="
|
98
|
+
<a name="understanding-the-codebase"></a>
|
99
99
|
## Understanding the Code Base
|
100
100
|
|
101
101
|
**/examples**
|
@@ -125,7 +125,7 @@ To run the tests:
|
|
125
125
|
rake
|
126
126
|
```
|
127
127
|
|
128
|
-
<a name="
|
128
|
+
<a name="style-guidelines-and-naming-conventions"></a>
|
129
129
|
## Style Guidelines & Naming Conventions
|
130
130
|
|
131
131
|
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
|
@@ -138,7 +138,7 @@ Please run your code through:
|
|
138
138
|
|
139
139
|
- [rubocop](https://github.com/bbatsov/rubocop).
|
140
140
|
|
141
|
-
## Creating a Pull Request<a name="
|
141
|
+
## Creating a Pull Request<a name="creating-a-pull-request"></a>
|
142
142
|
|
143
143
|
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
|
144
144
|
and configure the remotes:
|
@@ -147,7 +147,7 @@ Please run your code through:
|
|
147
147
|
# Clone your fork of the repo into the current directory
|
148
148
|
git clone https://github.com/sendgrid/ruby-http-client
|
149
149
|
# Navigate to the newly cloned directory
|
150
|
-
cd
|
150
|
+
cd ruby-http-client
|
151
151
|
# Assign the original repo to a remote called "upstream"
|
152
152
|
git remote add upstream https://github.com/sendgrid/ruby-http-client
|
153
153
|
```
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
|
2
|
+
|
3
|
+
[![BuildStatus](https://travis-ci.org/sendgrid/ruby-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/ruby-http-client)
|
4
|
+
[![Email Notifications Badge](https://dx.sendgrid.com/badge/ruby)](https://dx.sendgrid.com/newsletter/ruby)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
|
6
|
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
|
7
|
+
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
|
8
|
+
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/ruby-http-client.svg)](https://github.com/sendgrid/ruby-http-client/graphs/contributors)
|
2
9
|
|
3
10
|
**Quickly and easily access any RESTful or RESTful-like API.**
|
4
11
|
|
@@ -8,6 +15,16 @@ If you are looking for the SendGrid API client library, please see [this repo](h
|
|
8
15
|
|
9
16
|
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/ruby-http-client/blob/master/CHANGELOG.md).
|
10
17
|
|
18
|
+
# Table of Contents
|
19
|
+
- [Installation](#installation)
|
20
|
+
- [Quick Start](#quick-start)
|
21
|
+
- [Usage](#usage)
|
22
|
+
- [Roadmap](#roadmap)
|
23
|
+
- [How to Contribute](#contribute)
|
24
|
+
- [About](#about)
|
25
|
+
- [License](#license)
|
26
|
+
|
27
|
+
<a name="installation"></a>
|
11
28
|
# Installation
|
12
29
|
|
13
30
|
## Prerequisites
|
@@ -20,6 +37,7 @@ All updates to this library is documented in our [CHANGELOG](https://github.com/
|
|
20
37
|
gem install ruby_http_client
|
21
38
|
```
|
22
39
|
|
40
|
+
<a name="quick-start"></a>
|
23
41
|
# Quick Start
|
24
42
|
|
25
43
|
`GET /your/api/{param}/call`
|
@@ -51,31 +69,34 @@ puts response.body
|
|
51
69
|
puts response.headers
|
52
70
|
```
|
53
71
|
|
72
|
+
<a name="usage"></a>
|
54
73
|
# Usage
|
55
74
|
|
56
75
|
- [Example Code](https://github.com/sendgrid/ruby-http-client/tree/master/examples)
|
57
76
|
|
58
|
-
|
77
|
+
<a name="roadmap"></a>
|
78
|
+
# Roadmap
|
59
79
|
|
60
80
|
If you are interested in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/ruby-http-client/milestones). We would love to hear your feedback.
|
61
81
|
|
62
|
-
|
82
|
+
<a name="contribute"></a>
|
83
|
+
# How to Contribute
|
63
84
|
|
64
85
|
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md) guide for details.
|
65
86
|
|
66
87
|
Quick links:
|
67
88
|
|
68
|
-
- [Feature Request](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md#
|
69
|
-
- [Bug Reports](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md#
|
89
|
+
- [Feature Request](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md#feature-request)
|
90
|
+
- [Bug Reports](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md#submit-a-bug-report)
|
70
91
|
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md)
|
71
|
-
- [Improvements to the Codebase](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md#
|
72
|
-
|
92
|
+
- [Improvements to the Codebase](https://github.com/sendgrid/ruby-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase)
|
73
93
|
|
94
|
+
<a name="about"></a>
|
74
95
|
# About
|
75
96
|
|
76
97
|
ruby-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
|
77
98
|
|
78
99
|
ruby-http-client is maintained and funded by SendGrid, Inc. The names and logos for ruby-http-client are trademarks of SendGrid, Inc.
|
79
100
|
|
80
|
-
|
81
|
-
(
|
101
|
+
# License
|
102
|
+
[The MIT License (MIT)](LICENSE.txt)
|
data/TROUBLESHOOTING.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com).
|
2
|
+
|
3
|
+
If you can't find a solution below, please open an [issue](https://github.com/sendgrid/ruby-http-client/issues).
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
* [Viewing the Request Body](#request-body)
|
7
|
+
|
8
|
+
<a name="request-body"></a>
|
9
|
+
## Viewing the Request Body
|
10
|
+
|
11
|
+
When debugging or testing, it may be useful to exampine the raw request body to compare against the [documented format](https://sendgrid.com/docs/API_Reference/api_v3.html).
|
12
|
+
|
13
|
+
You can do this right before you call: `response = client.version('v3').api_keys.post(request_body: request_body)` like so:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
puts request_body
|
17
|
+
```
|
data/lib/ruby_http_client.rb
CHANGED
@@ -90,7 +90,7 @@ module SendGrid
|
|
90
90
|
# - The url string with the query parameters appended
|
91
91
|
#
|
92
92
|
def build_query_params(url, query_params)
|
93
|
-
params =
|
93
|
+
params = URI.encode_www_form(query_params)
|
94
94
|
url.concat("?#{params}")
|
95
95
|
end
|
96
96
|
|
data/ruby_http_client.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'ruby_http_client'
|
7
|
-
spec.version = '3.
|
7
|
+
spec.version = '3.3.0'
|
8
8
|
spec.authors = ['Elmer Thomas']
|
9
9
|
spec.email = 'dx@sendgrid.com'
|
10
10
|
spec.summary = 'A simple REST client'
|
@@ -61,9 +61,9 @@ class TestClient < Minitest::Test
|
|
61
61
|
|
62
62
|
def test_build_query_params
|
63
63
|
url = ''
|
64
|
-
query_params = { 'limit' => 100, 'offset' => 0 }
|
64
|
+
query_params = { 'limit' => 100, 'offset' => 0, 'categories' => ['category1', 'category2'] }
|
65
65
|
url = @client.build_query_params(url, query_params)
|
66
|
-
assert_equal('?limit=100&offset=0', url)
|
66
|
+
assert_equal('?limit=100&offset=0&categories=category1&categories=category2', url)
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_build_url
|
@@ -120,7 +120,7 @@ class TestClient < Minitest::Test
|
|
120
120
|
)
|
121
121
|
client.build_request('get', nil)
|
122
122
|
assert_equal('application/json', client.request['Content-Type'])
|
123
|
-
|
123
|
+
assert_nil(client.request.body)
|
124
124
|
end
|
125
125
|
|
126
126
|
def test_build_request_post_empty_body
|
@@ -134,7 +134,7 @@ class TestClient < Minitest::Test
|
|
134
134
|
)
|
135
135
|
client.build_request('post', nil)
|
136
136
|
assert_equal('', client.request['Content-Type'])
|
137
|
-
|
137
|
+
assert_nil(client.request.body)
|
138
138
|
end
|
139
139
|
|
140
140
|
def test_build_request_post_multipart
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_http_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elmer Thomas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,18 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- ".codeclimate.yml"
|
33
34
|
- ".github/ISSUE_TEMPLATE"
|
35
|
+
- ".github/PULL_REQUEST_TEMPLATE"
|
34
36
|
- ".gitignore"
|
35
37
|
- ".travis.yml"
|
36
38
|
- CHANGELOG.md
|
39
|
+
- CODE_OF_CONDUCT.md
|
37
40
|
- CONTRIBUTING.md
|
38
41
|
- LICENSE.txt
|
39
42
|
- README.md
|
40
43
|
- Rakefile
|
44
|
+
- TROUBLESHOOTING.md
|
41
45
|
- examples/example.rb
|
42
46
|
- lib/ruby_http_client.rb
|
43
47
|
- ruby_http_client.gemspec
|