linode 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9a231618cd2673977b0cd51db2a668cc8bc16f33
4
- data.tar.gz: 373181a8417e1d7d9cc433bb899cf472395da55c
2
+ SHA256:
3
+ metadata.gz: 35a7714afddcf990557b0657041978ab0decbed2d6c9508831720fa4b92fb9c1
4
+ data.tar.gz: e09c87c6c46dcb126c114d539aee4b197ebbdf706709b4ae014163a4a721cd76
5
5
  SHA512:
6
- metadata.gz: 31a2549bb3a7717450268fa62f376e284a3eb977de81b075ef998cb2366abb10ab68d39ad75f6abc838687cd7b467fcea3572a3499dfe74c787391150d5f56e8
7
- data.tar.gz: 8fe99fa8ed3b992811411db750a03b725568895c6a82372858e098ff81d0da51a788cfaf70adb9129880e0663c172c6f2957ecf1c53a3dac60d593bd9dd52096
6
+ metadata.gz: ae777d81c9fabcdc9a7a50a82fb5e43f019e24a5d0e81d0a07e227117cc163accdd6a559480e65dd8e2167e6539c2f9c3601524840087ea9fdff9afc14125ae1
7
+ data.tar.gz: 3d5b0647a90653577d4c4742ab6bfa7333da90bd8f6006f66b15fbec944ec4e1cbdaaa74374c94a6afd14e8cf36ad9f611053b940dc51bea53622f753304d00c
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.9.2 / 2019-04-15
2
+ ==================
3
+ * Added custom HTTP User-Agent ("linode/%s ruby/%s")
4
+
1
5
  0.9.1 / 2016-08-18
2
6
  ==================
3
7
  * Removed explicit dependency on JSON gem
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## NOTICE
4
4
 
5
- Please welcome [Marques Johansson](https://github.com/displague) and [Drew DeVault](https://github.com/sircmpwn),
5
+ Please welcome [Marques Johansson](https://github.com/displague) and [Robert DeRose](https://github.com/RobertDeRose),
6
6
  both of Linode, as new maintainers of the ruby Linode API library!
7
7
 
8
8
  ## INSTALLATION:
@@ -104,7 +104,11 @@ class Linode
104
104
 
105
105
  def post(data)
106
106
  logger.info "POST #{api_url.to_s} body:#{data.inspect}" if logger
107
- HTTParty.post(api_url, :body => data).parsed_response
107
+ HTTParty.post(api_url, :body => data, :headers => { 'User-Agent' => user_agent }).parsed_response
108
+ end
109
+
110
+ def user_agent
111
+ "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
108
112
  end
109
113
 
110
114
  def error?(response)
@@ -0,0 +1,3 @@
1
+ class Linode
2
+ VERSION = '0.9.2'
3
+ end
@@ -1,8 +1,12 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'linode/version'
2
6
 
3
7
  Gem::Specification.new do |s|
4
8
  s.name = "linode"
5
- s.version = File.open("VERSION", "r").read.strip
9
+ s.version = Linode::VERSION
6
10
  s.description = "This is a wrapper around Linode's automation facilities."
7
11
  s.summary = "a Ruby wrapper for the Linode API"
8
12
  s.authors = ["Rick Bradley"]
@@ -83,6 +83,9 @@ describe 'Linode' do
83
83
  :api_responseFormat => 'json',
84
84
  :username => @username,
85
85
  :password => @password
86
+ },
87
+ :headers => {
88
+ 'User-Agent' => "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
86
89
  }
87
90
  ).returns(@json)
88
91
  @linode.api_key
@@ -110,6 +113,9 @@ describe 'Linode' do
110
113
  :username => @username,
111
114
  :password => @password,
112
115
  :label => 'foobar'
116
+ },
117
+ :headers => {
118
+ 'User-Agent' => "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
113
119
  }
114
120
  ).returns(@json)
115
121
 
@@ -127,6 +133,9 @@ describe 'Linode' do
127
133
  :username => @username,
128
134
  :password => @password,
129
135
  :expires => 5
136
+ },
137
+ :headers => {
138
+ 'User-Agent' => "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
130
139
  }
131
140
  ).returns(@json)
132
141
 
@@ -144,6 +153,9 @@ describe 'Linode' do
144
153
  :username => @username,
145
154
  :password => @password,
146
155
  :expires => 0
156
+ },
157
+ :headers => {
158
+ 'User-Agent' => "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
147
159
  }
148
160
  ).returns(@json)
149
161
 
@@ -160,6 +172,9 @@ describe 'Linode' do
160
172
  :api_responseFormat => 'json',
161
173
  :username => @username,
162
174
  :password => @password
175
+ },
176
+ :headers => {
177
+ 'User-Agent' => "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
163
178
  }
164
179
  ).returns(@json)
165
180
 
@@ -245,6 +260,13 @@ describe 'Linode' do
245
260
  @linode.send_request('test.echo', { })
246
261
  end
247
262
 
263
+ it 'should include a custom User-Agent when making its request' do
264
+ HTTParty.expects(:post).with { |path, args|
265
+ args[:headers]['User-Agent'] == "linode/#{Linode::VERSION} ruby/#{RUBY_VERSION}"
266
+ }.returns(@json)
267
+ @linode.send_request('test.echo', { })
268
+ end
269
+
248
270
  it 'should set the designated request method as the HTTP API action' do
249
271
  HTTParty.expects(:post).with { |path, args|
250
272
  args[:body][:api_action] == 'test.echo'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Bradley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2019-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -80,7 +80,6 @@ files:
80
80
  - MIT-LICENSE
81
81
  - README.md
82
82
  - Rakefile
83
- - VERSION
84
83
  - autotest/discover.rb
85
84
  - lib/linode.rb
86
85
  - lib/linode/account.rb
@@ -99,6 +98,7 @@ files:
99
98
  - lib/linode/stackscript.rb
100
99
  - lib/linode/test.rb
101
100
  - lib/linode/user.rb
101
+ - lib/linode/version.rb
102
102
  - linode.gemspec
103
103
  - spec/linode/account_spec.rb
104
104
  - spec/linode/avail_spec.rb
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.5.1
141
+ rubygems_version: 2.7.9
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: a Ruby wrapper for the Linode API
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.9.1