Skip to content

Commit 34a2096

Browse files
authored
Merge pull request #16 from MaxCDN/jmervine-updates
Removing support for ruby 1.9.3
2 parents 5ffa8cc + 4a0d373 commit 34a2096

File tree

8 files changed

+79
-21
lines changed

8 files changed

+79
-21
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ vendor
1515
# jeweler generated
1616
pkg
1717
*.gem
18-
*.lock
1918
.DS_Store
2019
npm-debug.log
2120

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ sudo: false
44
before_install:
55
- gem update bundler
66
rvm:
7-
- 1
8-
- 2.3.3
9-
- 2.4.0
7+
- 2.3
8+
- 2.4

Gemfile.lock

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
PATH
2+
remote: .
3+
specs:
4+
maxcdn (0.4.0)
5+
addressable (~> 2.4)
6+
faraday (~> 0.9)
7+
net-http-persistent (~> 2.9)
8+
signet (~> 0.7)
9+
10+
GEM
11+
remote: https://rubygems.org/
12+
specs:
13+
addressable (2.5.2)
14+
public_suffix (>= 2.0.2, < 4.0)
15+
ansi (1.5.0)
16+
builder (3.2.3)
17+
coderay (1.1.2)
18+
crack (0.4.3)
19+
safe_yaml (~> 1.0.0)
20+
faraday (0.15.0)
21+
multipart-post (>= 1.2, < 3)
22+
hashdiff (0.3.7)
23+
jwt (2.1.0)
24+
method_source (0.9.0)
25+
minitest (5.11.3)
26+
minitest-reporters (1.2.0)
27+
ansi
28+
builder
29+
minitest (>= 5.0)
30+
ruby-progressbar
31+
multi_json (1.13.1)
32+
multipart-post (2.0.0)
33+
net-http-persistent (2.9.4)
34+
pry (0.11.3)
35+
coderay (~> 1.1.0)
36+
method_source (~> 0.9.0)
37+
public_suffix (3.0.2)
38+
rake (12.3.1)
39+
ruby-progressbar (1.9.0)
40+
safe_yaml (1.0.4)
41+
signet (0.8.1)
42+
addressable (~> 2.3)
43+
faraday (~> 0.9)
44+
jwt (>= 1.5, < 3.0)
45+
multi_json (~> 1.10)
46+
webmock (3.4.1)
47+
addressable (>= 2.3.6)
48+
crack (>= 0.3.2)
49+
hashdiff
50+
51+
PLATFORMS
52+
ruby
53+
54+
DEPENDENCIES
55+
maxcdn!
56+
minitest
57+
minitest-reporters
58+
pry
59+
rake
60+
webmock
61+
62+
BUNDLED WITH
63+
1.16.1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
gem install maxcdn
99
```
1010

11-
> Requires Ruby 1.9.2+ (see: [Travis](https://travis-ci.org/MaxCDN/ruby-maxcdn) for passing Ruby versions.)
11+
> Requires Ruby 2.3+ (see: [Travis](https://travis-ci.org/MaxCDN/ruby-maxcdn) for passing Ruby versions.)
1212
1313
#### With Bundler
1414

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ task :benchmark do
1919
require "./test/benchmark"
2020
end
2121

22+
task :default => :test

lib/maxcdn.rb

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,37 @@ def initialize(company_alias, key, secret, server="rws.maxcdn.com", secure_conne
1515
@company_alias = company_alias
1616
@server = server
1717
@request_signer = Signet::OAuth1::Client.new(
18-
:client_credential_key => key,
19-
:client_credential_secret => secret,
20-
:two_legged => true
18+
client_credential_key: key,
19+
client_credential_secret: secret,
20+
two_legged: true
2121
)
2222
end
2323

2424
def _connection_type
25-
return "http" unless @secure_connection
26-
"https"
25+
@secure_connection ? "https" : "http"
2726
end
2827

2928
def _get_url uri, params={}
3029
url = "#{_connection_type}://#{@server}/#{@company_alias}/#{uri.gsub(/^\//, "")}"
31-
if params and not params.empty?
32-
url += "?#{params.to_params}"
33-
end
34-
30+
url += "?#{params.to_params}" if params && !params.empty?
3531
url
3632
end
3733

3834
def _response_as_json method, uri, options={}, data={}
3935
puts "Making #{method.upcase} request to #{_get_url uri}" if debug
4036

41-
req_opts = {
42-
:method => method
43-
}
37+
req_opts = { method: method }
4438

4539
req_opts[:uri] = _get_url(uri, (options[:body] ? {} : data))
4640
req_opts[:body] = data.to_params if options[:body]
4741

4842
request = @request_signer.generate_authenticated_request(req_opts)
4943

5044
# crazyness for headers
51-
headers = {"Content-Type" => options[:body] ? "application/json" : "application/x-www-form-urlencoded"}
45+
headers = {
46+
"Content-Type" => options[:body] ? "application/json" : "application/x-www-form-urlencoded"
47+
}
48+
5249
headers.case_indifferent_merge(options.delete(:headers) || {})
5350
headers["User-Agent"] = "Ruby MaxCDN API Client"
5451

@@ -63,7 +60,7 @@ def _response_as_json method, uri, options={}, data={}
6360

6461
response = conn.send(method, path) do |req|
6562
req.headers = request.headers
66-
req.body = request.body
63+
req.body = request.body
6764
end
6865

6966
return response if options[:debug_request]

lib/maxcdn/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module MaxCDN
2-
VERSION = "0.3.2"
2+
VERSION = "0.4.0"
33
end

maxcdn.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Gem::Specification.new do |gem|
1212
gem.description = %Q{A Rest Client For MaxCDN Rest Web Services}
1313
gem.email = "joshua@mervine.net"
1414
gem.authors = ["Joshua P. Mervine"]
15-
gem.add_dependency 'json' if RUBY_VERSION.start_with? "1.8"
1615
gem.add_dependency 'signet', '~> 0.7'
1716
gem.add_dependency 'faraday', '~> 0.9'
1817
gem.add_dependency 'net-http-persistent', '~> 2.9'

0 commit comments

Comments
 (0)