right_api_client 1.5.26 → 1.5.27

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
2
  SHA1:
3
- metadata.gz: 3eeab13e482a55de8488498410a7d7f2c4c37d7e
4
- data.tar.gz: 11bc227243c77b8fd1441b7d14d58cf93f34e5d4
3
+ metadata.gz: 94b49a3bb3d9527ab20246b6fb3207c45adf2c1c
4
+ data.tar.gz: 371e6f5e1cd65d28be220d7b5cb227a3ae83abaf
5
5
  SHA512:
6
- metadata.gz: 939995fa3c0e80733933154736695249d56d713b4017a929fe14a8f5701e4f487ed9f95aa6a44d050d9eea66c5019433c5035a4ff6a678bef8a3f549ce77a160
7
- data.tar.gz: 68358b59c102309ff9c2a9af59b0e5a73cea3a3f10435acac5343586971291ef1d8b037b50b1f7a82978fdb77c8d086e2fdfdb9b5a4ef3dd8743f03366aece09
6
+ metadata.gz: 875e0cf8a86df6b4f867357a062240c31043220d3c67352abc786862485e17163264e6eb06a95b0291fc6a92a5152a0e9bfde01a9d23e97b7098883f10ad08f1
7
+ data.tar.gz: cb772ee333b0366ef18dc010e9c1d464f09c653b53f9be48c67529dd76b935c8936ceabf2ef8c017ec984b78f9f201a8fb6506b01933c765ab6df1c3cfaac1cc
data/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  ## Next
4
4
  - Your info here
5
5
 
6
+ ## 1.5.27
7
+ - \#96 Set default timeout to 6 minutes since the RightScale API has a timeout of 5 minutes for calls
8
+ - \#94 Updating the README and config/login.yml.example with oauth info
9
+ - \#93 Work around getting ASCII-8BIT for audit entry detail.
10
+ - \#91 Fix for issue #83 instance facing client should support tags
11
+ - \#90 Allow GET /api/right_scripts/:id/source to work since it comes back as text/plain
12
+ - \#88 Update maintainer info, and add description to bypass the timeout warning
13
+
6
14
  ## 1.5.26
7
15
  - \#87 Use the actual response code to determine if re-login is appropriate
8
16
 
data/Gemfile CHANGED
@@ -11,6 +11,7 @@ group :development do
11
11
  gem 'rspec', '2.9.0'
12
12
  gem 'flexmock', '0.8.7'
13
13
  gem 'coveralls', :require => false
14
+ gem 'pry'
14
15
  end
15
16
 
16
17
  # Gems used during test and development that should be OMITTED from the gemspec
data/Gemfile.lock CHANGED
@@ -3,6 +3,7 @@ GEM
3
3
  specs:
4
4
  addressable (2.3.6)
5
5
  builder (3.2.2)
6
+ coderay (1.1.0)
6
7
  columnize (0.3.6)
7
8
  coveralls (0.7.1)
8
9
  multi_json (~> 1.3)
@@ -45,6 +46,7 @@ GEM
45
46
  multi_json (>= 1.5)
46
47
  linecache (0.46)
47
48
  rbx-require-relative (> 0.0.4)
49
+ method_source (0.8.2)
48
50
  mime-types (1.25.1)
49
51
  multi_json (1.10.1)
50
52
  multi_xml (0.5.5)
@@ -56,6 +58,10 @@ GEM
56
58
  multi_json (~> 1.3)
57
59
  multi_xml (~> 0.5)
58
60
  rack (~> 1.2)
61
+ pry (0.10.1)
62
+ coderay (~> 1.1.0)
63
+ method_source (~> 0.8.1)
64
+ slop (~> 3.4)
59
65
  rack (1.5.2)
60
66
  rake (0.8.7)
61
67
  rbx-require-relative (0.0.9)
@@ -82,6 +88,7 @@ GEM
82
88
  multi_json
83
89
  simplecov-html (~> 0.8.0)
84
90
  simplecov-html (0.8.0)
91
+ slop (3.6.0)
85
92
  term-ansicolor (1.3.0)
86
93
  tins (~> 1.0)
87
94
  thor (0.19.1)
@@ -97,6 +104,7 @@ DEPENDENCIES
97
104
  jeweler (~> 2.0)
98
105
  json (~> 1.0)
99
106
  mime-types (~> 1.0)
107
+ pry
100
108
  rake (= 0.8.7)
101
109
  rest-client (~> 1.6)
102
110
  rspec (= 2.9.0)
data/README.md CHANGED
@@ -10,7 +10,7 @@ It is assumed that users are already familiar with the RightScale API:
10
10
  - API Documentation: http://support.rightscale.com/12-Guides/RightScale_API_1.5
11
11
  - API Reference Docs: http://reference.rightscale.com/api1.5/index.html
12
12
 
13
- Maintained by the RightScale Salmon team
13
+ Maintained by the RightScale QA ServerTemplate and Ivory Automation Team
14
14
 
15
15
  ## Installation
16
16
  Ruby 1.8.7 or higher is required.
@@ -34,8 +34,8 @@ navigate to the Settings > Account Settings page. The account is is at the end o
34
34
 
35
35
  The client makes working with and getting to know the API much easier. It spiders the API dynamically to
36
36
  discover its resources on the fly. At every step, the user has the ability to query api_methods(), which
37
- indicates the potential methods that can be called. The ```config/login.yml.example``` file provides
38
- details of different login parameters.
37
+ indicates the potential methods that can be called. **The ```config/login.yml.example``` file provides
38
+ details of different login parameters, for example, oauth authentication.**
39
39
 
40
40
  ### Making API calls
41
41
  Essentially, just follow the RightScale API documentation (available from http://support.rightscale.com)
@@ -60,6 +60,9 @@ Examples:
60
60
 
61
61
  # A non-CRUD action: POST /api/servers/:server_id/launch
62
62
  @client.servers(:id => 4).show.launch
63
+
64
+ # Get an resource by it's href
65
+ @client.resource('/api/clouds/1/volumes/bfd53dbc005f').show
63
66
 
64
67
  As seen above, whenever you need to chain methods, you must call .show before specifying the next method.
65
68
 
@@ -296,3 +299,17 @@ bundle exec rspec spec/functional
296
299
  ## Wrong ruby version
297
300
 
298
301
  Ruby 1.8.7 or higher is required.
302
+
303
+ ## Warning message: To disable read timeouts, please set timeout to nil instead of -1
304
+
305
+ To avoid this message you can set ```:timeout``` when creating your RightAp::Client object. You will need
306
+ to use a different value depending on which version of rest-client is being used.
307
+
308
+ ### rest-client 1.6.x supports ruby 1.8.x
309
+ * ```:timeout => nil```, 60 second timeout (default of Net::HTTP)
310
+ * ```:timeout => -1```, infinite timeout.
311
+
312
+ ### rest-client 1.7.x supports ruby >= 1.9.x
313
+ * **```:timeout => nil```, infinite timeout - no warning message.**
314
+ * ```:timeout => -1```, infinite timeout - plus the error message above being displayed.
315
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.26
1
+ 1.5.27
@@ -55,7 +55,7 @@ module RightApi
55
55
  include Helper
56
56
 
57
57
  DEFAULT_OPEN_TIMEOUT = nil
58
- DEFAULT_TIMEOUT = -1
58
+ DEFAULT_TIMEOUT = 6 * 60
59
59
  DEFAULT_MAX_ATTEMPTS = 5
60
60
 
61
61
  DEFAULT_SSL_VERSION = 'TLSv1'
@@ -163,6 +163,7 @@ module RightApi
163
163
  # Following are special cases that need to over-ride the obj_path
164
164
  obj_path = '/api/backups' if meth == :backups
165
165
  obj_path = instance_href + '/live/tasks' if meth == :live_tasks
166
+ obj_path = '/api/tags' if meth == :tags
166
167
  if has_id(*args)
167
168
  obj_path = add_id_and_params_to_path(obj_path, *args)
168
169
  RightApi::Resource.process(self, get_singular(meth), obj_path)
@@ -347,10 +348,18 @@ module RightApi
347
348
  # will be used later to add relevant methods to relevant resources
348
349
  type = if result.content_type.index('rightscale')
349
350
  get_resource_type(result.content_type)
351
+ elsif result.content_type.index('text/plain')
352
+ 'text'
350
353
  else
351
354
  ''
352
355
  end
353
356
 
357
+ # work around getting ASCII-8BIT from some resources like audit entry detail
358
+ charset = get_charset(response.headers)
359
+ if charset && response.body.encoding != charset
360
+ response.body.force_encoding(charset)
361
+ end
362
+
354
363
  [type, response.body]
355
364
  when 301, 302
356
365
  update_api_url(response)
@@ -546,6 +555,14 @@ module RightApi
546
555
  content_type.scan(/\.rightscale\.(.*)\+json/)[0][0]
547
556
  end
548
557
 
558
+ # @param [Hash{Symbol => String}] headers the HTTP headers
559
+ def get_charset(headers)
560
+ charset = headers[:content_type].split(';').map(&:strip).detect { |item| item =~ /^charset=/i }
561
+ if charset
562
+ Encoding.find(charset.gsub(/^charset=/i, ''))
563
+ end
564
+ end
565
+
549
566
  # Makes sure the @cookies have a timestamp.
550
567
  #
551
568
  def timestamp_cookies
@@ -17,7 +17,7 @@ module RightApi::Helper
17
17
  }
18
18
 
19
19
  # List of resources that are available as instance-facing calls
20
- INSTANCE_FACING_RESOURCES = [:backups, :live_tasks, :volumes, :volume_attachments, :volume_snapshots, :volume_types]
20
+ INSTANCE_FACING_RESOURCES = [:backups, :live_tasks, :volumes, :volume_attachments, :volume_snapshots, :volume_types, :tags]
21
21
 
22
22
  # Helper used to add methods to classes dynamically
23
23
  def define_instance_method(meth, &blk)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.26
4
+ version: 1.5.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - RightScale, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: |2
112
126
 
113
127
  The right_api_client gem simplifies the use of RightScale's MultiCloud API.