maxcdn 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +2 -3
- data/Gemfile.lock +63 -0
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/lib/maxcdn.rb +11 -14
- data/lib/maxcdn/version.rb +1 -1
- data/maxcdn.gemspec +0 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e3090e5f94cfaec5e162ee3ad825247b29d206f
|
4
|
+
data.tar.gz: cc55954c579d8b83f50d5da20426be9c43e5258a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a692a71a51e6f5670d00b4949f3c9d925f8cdf461605968c77c6c3d5c0bc27a7986534523fb60413e04038cd925d99c73ae62328cca64ce80e2ecb025ff68faa
|
7
|
+
data.tar.gz: 3de9fb3466589ea0425c6f361393beb371e755d0cd3a86df5b21b1b6f5e0a66c7828745502e0893e68e097449c5033d89f9e28a31e6a60b2e3c99fc1ce8fcd08
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
ADDED
@@ -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
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
gem install maxcdn
|
9
9
|
```
|
10
10
|
|
11
|
-
> Requires Ruby
|
11
|
+
> Requires Ruby 2.3+ (see: [Travis](https://travis-ci.org/MaxCDN/ruby-maxcdn) for passing Ruby versions.)
|
12
12
|
|
13
13
|
#### With Bundler
|
14
14
|
|
data/Rakefile
CHANGED
data/lib/maxcdn.rb
CHANGED
@@ -15,32 +15,26 @@ module MaxCDN
|
|
15
15
|
@company_alias = company_alias
|
16
16
|
@server = server
|
17
17
|
@request_signer = Signet::OAuth1::Client.new(
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
18
|
+
client_credential_key: key,
|
19
|
+
client_credential_secret: secret,
|
20
|
+
two_legged: true
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
24
24
|
def _connection_type
|
25
|
-
|
26
|
-
"https"
|
25
|
+
@secure_connection ? "https" : "http"
|
27
26
|
end
|
28
27
|
|
29
28
|
def _get_url uri, params={}
|
30
29
|
url = "#{_connection_type}://#{@server}/#{@company_alias}/#{uri.gsub(/^\//, "")}"
|
31
|
-
if params
|
32
|
-
url += "?#{params.to_params}"
|
33
|
-
end
|
34
|
-
|
30
|
+
url += "?#{params.to_params}" if params && !params.empty?
|
35
31
|
url
|
36
32
|
end
|
37
33
|
|
38
34
|
def _response_as_json method, uri, options={}, data={}
|
39
35
|
puts "Making #{method.upcase} request to #{_get_url uri}" if debug
|
40
36
|
|
41
|
-
req_opts = {
|
42
|
-
:method => method
|
43
|
-
}
|
37
|
+
req_opts = { method: method }
|
44
38
|
|
45
39
|
req_opts[:uri] = _get_url(uri, (options[:body] ? {} : data))
|
46
40
|
req_opts[:body] = data.to_params if options[:body]
|
@@ -48,7 +42,10 @@ module MaxCDN
|
|
48
42
|
request = @request_signer.generate_authenticated_request(req_opts)
|
49
43
|
|
50
44
|
# crazyness for headers
|
51
|
-
headers = {
|
45
|
+
headers = {
|
46
|
+
"Content-Type" => options[:body] ? "application/json" : "application/x-www-form-urlencoded"
|
47
|
+
}
|
48
|
+
|
52
49
|
headers.case_indifferent_merge(options.delete(:headers) || {})
|
53
50
|
headers["User-Agent"] = "Ruby MaxCDN API Client"
|
54
51
|
|
@@ -63,7 +60,7 @@ module MaxCDN
|
|
63
60
|
|
64
61
|
response = conn.send(method, path) do |req|
|
65
62
|
req.headers = request.headers
|
66
|
-
req.body
|
63
|
+
req.body = request.body
|
67
64
|
end
|
68
65
|
|
69
66
|
return response if options[:debug_request]
|
data/lib/maxcdn/version.rb
CHANGED
data/maxcdn.gemspec
CHANGED
@@ -12,7 +12,6 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.description = %Q{A Rest Client For MaxCDN Rest Web Services}
|
13
13
|
gem.email = "joshua@mervine.net"
|
14
14
|
gem.authors = ["Joshua P. Mervine"]
|
15
|
-
gem.add_dependency 'json' if RUBY_VERSION.start_with? "1.8"
|
16
15
|
gem.add_dependency 'signet', '~> 0.7'
|
17
16
|
gem.add_dependency 'faraday', '~> 0.9'
|
18
17
|
gem.add_dependency 'net-http-persistent', '~> 2.9'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maxcdn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua P. Mervine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: signet
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- ".travis.yml"
|
77
77
|
- BENCHMARKS.md
|
78
78
|
- Gemfile
|
79
|
+
- Gemfile.lock
|
79
80
|
- LICENSE
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
112
|
version: '0'
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.5.2.1
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: A Rest Client For MaxCDN Rest Web Services
|