Skip to content

Commit 6639ece

Browse files
author
Matt Bernier
authored
Merge branch 'master' into add-test-files-exist
2 parents 753a2d9 + b4b9460 commit 6639ece

10 files changed

+83
-12
lines changed

.codeclimate.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
engines:
2+
plugins:
33
duplication:
44
enabled: false
55
config:
@@ -14,7 +14,3 @@ engines:
1414
rubocop:
1515
enabled: true
1616
channel: rubocop-0-48
17-
ratings:
18-
paths:
19-
- "**.rb"
20-
exclude_paths:

.env_sample

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export SENDGRID_API_KEY=''

.github/PULL_REQUEST_TEMPLATE

+24
Original file line numberDiff line numberDiff line change
@@ -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:[email protected]), or file a Github Issue in this repository.

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
33

44
This project adheres to [Semantic Versioning](http://semver.org/).
55

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+
611
## [3.2.0] - 2017-09-01
712
### Added
813
- #12 Add a helper returns the response body as a hash

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 SendGrid, Inc.
3+
Copyright (c) 2016-2017 SendGrid, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

PULL_REQUEST_TEMPLATE.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
(Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.)
3+
-->
4+
<!-- Add the issue number that is fixed by this PR (In the form Fixes #123) -->
5+
6+
Fixes #<!--Enter Issue number you have referenced(please refer only one issue at once)-->
7+
8+
#### Checklist
9+
<!-- Please Star this repository and follow this template for your PR to be considered-->
10+
- [ ] I have read the SendGrid Contributor License Agreement (CLA)
11+
- [ ] I have read the [Contribution Guide] and my PR follows them.
12+
- [ ] My branch is up-to-date with the master branch.
13+
- [ ] I have added tests that prove my fix is effective or that my feature works
14+
- [ ] I have added necessary documentation (if appropriate)
15+
<!-- If an existing function does not have a docstring, please add one -->
16+
- [ ] All the functions created/modified in this PR contain relevant docstrings.
17+
18+
#### Short description of what this resolves:
19+
20+
21+
#### Changes proposed in this pull request:
22+
<!--Fill These Bullet Points-->
23+
24+
25+
If you have questions, please send an email [Sendgrid](mailto:[email protected]), or file a Github Issue in this repository.

README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![BuildStatus](https://travis-ci.org/sendgrid/ruby-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/ruby-http-client)
44
[![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)
56
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
67
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
78
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/ruby-http-client.svg)](https://github.com/sendgrid/ruby-http-client/graphs/contributors)
@@ -30,6 +31,18 @@ All updates to this library is documented in our [CHANGELOG](https://github.com/
3031

3132
- Ruby version 2.2+
3233

34+
## Setup Environment Variables
35+
36+
### Environment Variable
37+
38+
Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:
39+
40+
```bash
41+
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
42+
echo "sendgrid.env" >> .gitignore
43+
source ./sendgrid.env
44+
```
45+
3346
## Install Package
3447

3548
```bash
@@ -98,4 +111,4 @@ ruby-http-client is guided and supported by the SendGrid [Developer Experience T
98111
ruby-http-client is maintained and funded by SendGrid, Inc. The names and logos for ruby-http-client are trademarks of SendGrid, Inc.
99112

100113
# License
101-
[The MIT License (MIT)](LICENSE.txt)
114+
[The MIT License (MIT)](LICENSE.txt)

lib/ruby_http_client.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def add_version(url = nil)
9090
# - The url string with the query parameters appended
9191
#
9292
def build_query_params(url, query_params)
93-
params = query_params.map { |key, value| "#{key}=#{value}" }.join('&')
93+
params = URI.encode_www_form(query_params)
9494
url.concat("?#{params}")
9595
end
9696

ruby_http_client.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44

55
Gem::Specification.new do |spec|
66
spec.name = 'ruby_http_client'
7-
spec.version = '3.2.0'
7+
spec.version = '3.3.0'
88
spec.authors = ['Elmer Thomas']
99
spec.email = '[email protected]'
1010
spec.summary = 'A simple REST client'

test/test_ruby_http_client.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def test_add_version
6161

6262
def test_build_query_params
6363
url = ''
64-
query_params = { 'limit' => 100, 'offset' => 0 }
64+
query_params = { 'limit' => 100, 'offset' => 0, 'categories' => ['category1', 'category2'] }
6565
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)
6767
end
6868

6969
def test_build_url
@@ -234,5 +234,12 @@ def test_usage_exists
234234

235235
def test_use_cases_exists
236236
assert(File.file?('./USE_CASES.md'))
237-
end
237+
end
238+
239+
def test_license_date_is_updated
240+
license_end_year = IO.read('LICENSE.txt').match(/Copyright \(c\) 2016-(\d{4}) SendGrid/)[1].to_i
241+
current_year = Time.new.year
242+
assert_equal(current_year, license_end_year)
243+
end
244+
238245
end

0 commit comments

Comments
 (0)