right_api_client 1.5.21 → 1.5.22

Sign up to get free protection for your applications and to get access to all the features.
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG.md
2
2
 
3
+ ## Next
4
+ - <Your change here>
5
+
6
+ ## 1.5.22
7
+ - \#76 Add ability to directly access attributes of a ResourceDetail
8
+ - \#74 Add coveralls support
9
+
3
10
  ## 1.5.21
4
11
  - \#71 Stop locking rest-client to 1.6.x and return to locking it to 1.x
5
12
 
data/Gemfile CHANGED
@@ -10,8 +10,7 @@ group :development do
10
10
  gem 'rake', '0.8.7'
11
11
  gem 'rspec', '2.9.0'
12
12
  gem 'flexmock', '0.8.7'
13
- gem 'simplecov', '0.4.2',
14
- :platforms => [:ruby_19, :ruby_20, :ruby_21]
13
+ gem 'coveralls', :require => false
15
14
  end
16
15
 
17
16
  # Gems used during test and development that should be OMITTED from the gemspec
data/Gemfile.lock CHANGED
@@ -4,6 +4,12 @@ GEM
4
4
  addressable (2.3.6)
5
5
  builder (3.2.2)
6
6
  columnize (0.3.6)
7
+ coveralls (0.7.1)
8
+ multi_json (~> 1.3)
9
+ rest-client
10
+ simplecov (>= 0.7)
11
+ term-ansicolor
12
+ thor
7
13
  debugger (1.6.6)
8
14
  columnize (>= 0.3.1)
9
15
  debugger-linecache (~> 1.2.0)
@@ -11,6 +17,7 @@ GEM
11
17
  debugger-linecache (1.2.0)
12
18
  debugger-ruby_core_source (1.3.2)
13
19
  diff-lcs (1.1.3)
20
+ docile (1.1.5)
14
21
  faraday (0.8.9)
15
22
  multipart-post (~> 1.2.0)
16
23
  flexmock (0.8.7)
@@ -70,14 +77,21 @@ GEM
70
77
  ruby-debug-base (~> 0.10.4.0)
71
78
  ruby-debug-base (0.10.4)
72
79
  linecache (>= 0.3)
73
- simplecov (0.4.2)
74
- simplecov-html (~> 0.4.4)
75
- simplecov-html (0.4.5)
80
+ simplecov (0.9.0)
81
+ docile (~> 1.1.0)
82
+ multi_json
83
+ simplecov-html (~> 0.8.0)
84
+ simplecov-html (0.8.0)
85
+ term-ansicolor (1.3.0)
86
+ tins (~> 1.0)
87
+ thor (0.19.1)
88
+ tins (1.3.2)
76
89
 
77
90
  PLATFORMS
78
91
  ruby
79
92
 
80
93
  DEPENDENCIES
94
+ coveralls
81
95
  debugger
82
96
  flexmock (= 0.8.7)
83
97
  jeweler (~> 2.0)
@@ -87,4 +101,3 @@ DEPENDENCIES
87
101
  rest-client (~> 1.6)
88
102
  rspec (= 2.9.0)
89
103
  ruby-debug
90
- simplecov (= 0.4.2)
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # RightScale API Client
2
2
  [![Build Status](https://travis-ci.org/rightscale/right_api_client.svg?branch=master)](https://travis-ci.org/rightscale/right_api_client)
3
+ [![Coverage Status](https://img.shields.io/coveralls/rightscale/right_api_client.svg)](https://coveralls.io/r/rightscale/right_api_client?branch=master)
3
4
 
4
5
  The right\_api\_client gem simplifies the use of RightScale's MultiCloud API. It provides
5
6
  a simple object model of the API resources, and handles all of the fine details involved
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.21
1
+ 1.5.22
@@ -17,6 +17,7 @@ module RightApi
17
17
  @resource_type = resource_type
18
18
  @raw = hash.dup
19
19
  @attributes, @associations, @actions = Set.new, Set.new, Set.new
20
+ @attributes_with_values = {}
20
21
 
21
22
  links = hash.delete('links') || []
22
23
  raw_actions = hash.delete('actions') || []
@@ -63,10 +64,11 @@ module RightApi
63
64
 
64
65
  # Add the rest as instance methods
65
66
  hash.each do |k, v|
67
+ k = k.to_sym
66
68
  # If a parent resource is requested with a view then it might return
67
69
  # extra data that can be used to build child resources here, without
68
70
  # doing another get request.
69
- if associations.include?(k.to_sym)
71
+ if associations.include?(k)
70
72
  # v might be an array or hash so use include rather than has_key
71
73
  if v.include?('links')
72
74
  child_self_link = v['links'].find { |target| target['rel'] == 'self' }
@@ -84,11 +86,18 @@ module RightApi
84
86
  end
85
87
  end
86
88
  end
89
+ else
90
+ # This is an attribute whose name coincides with the name of a link,
91
+ # but which isn't actually an embedded subrecource (it has no links
92
+ # or other media-type decorators). Add it to attributes.
93
+ attributes << k
94
+ @attributes_with_values[k] = v
87
95
  end
88
96
  else
89
97
  # Add it to the attributes set and create a method for it
90
- attributes << k.to_sym
91
- define_instance_method(k) { return v }
98
+ attributes << k
99
+ @attributes_with_values[k] = v
100
+ define_instance_method(k) { return @attributes_with_values[k] }
92
101
  end
93
102
  end
94
103
 
@@ -113,6 +122,18 @@ module RightApi
113
122
  self
114
123
  end
115
124
  end
125
+
126
+ # Access attributes of this resource in a Hash-like manner. This is useful
127
+ # in cases where an attribute name coincides with a link name, e.g. a resource
128
+ # that contains embedded subresources.
129
+ #
130
+ # This method can accept String or Symbol attribute names. The data type of the
131
+ # returned object is unspecified; it could be a String, Integer, Hash, Array or
132
+ # any other JSON data type. If a Hash is returned, then its keys will always be
133
+ # String.
134
+ def [](k)
135
+ @attributes_with_values[k.to_sym]
136
+ end
116
137
 
117
138
  # Any other method other than standard actions(show,update,destroy)
118
139
  # is simply appended to the href and called with a POST.
metadata CHANGED
@@ -1,146 +1,145 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: right_api_client
3
- version: !ruby/object:Gem::Version
4
- hash: 41
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.22
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 5
9
- - 21
10
- version: 1.5.21
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - RightScale, Inc.
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2014-08-21 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- type: :runtime
12
+ date: 2014-09-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: json
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 15
29
- segments:
30
- - 1
31
- - 0
32
- version: "1.0"
33
- prerelease: false
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
36
22
  type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - !ruby/object:Gem::Dependency
37
31
  name: mime-types
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
34
+ requirements:
41
35
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 15
44
- segments:
45
- - 1
46
- - 0
47
- version: "1.0"
48
- prerelease: false
49
- requirement: *id002
50
- - !ruby/object:Gem::Dependency
36
+ - !ruby/object:Gem::Version
37
+ version: '1.0'
51
38
  type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
46
+ - !ruby/object:Gem::Dependency
52
47
  name: rest-client
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
54
49
  none: false
55
- requirements:
50
+ requirements:
56
51
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 1
61
- - 6
62
- version: "1.6"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.6'
54
+ type: :runtime
63
55
  prerelease: false
64
- requirement: *id003
65
- - !ruby/object:Gem::Dependency
66
- type: :development
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ - !ruby/object:Gem::Dependency
67
63
  name: rake
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
69
65
  none: false
70
- requirements:
71
- - - "="
72
- - !ruby/object:Gem::Version
73
- hash: 49
74
- segments:
75
- - 0
76
- - 8
77
- - 7
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
78
69
  version: 0.8.7
79
- prerelease: false
80
- requirement: *id004
81
- - !ruby/object:Gem::Dependency
82
70
  type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.8.7
78
+ - !ruby/object:Gem::Dependency
83
79
  name: rspec
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
85
81
  none: false
86
- requirements:
87
- - - "="
88
- - !ruby/object:Gem::Version
89
- hash: 43
90
- segments:
91
- - 2
92
- - 9
93
- - 0
82
+ requirements:
83
+ - - '='
84
+ - !ruby/object:Gem::Version
94
85
  version: 2.9.0
95
- prerelease: false
96
- requirement: *id005
97
- - !ruby/object:Gem::Dependency
98
86
  type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.9.0
94
+ - !ruby/object:Gem::Dependency
99
95
  name: flexmock
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
101
97
  none: false
102
- requirements:
103
- - - "="
104
- - !ruby/object:Gem::Version
105
- hash: 49
106
- segments:
107
- - 0
108
- - 8
109
- - 7
98
+ requirements:
99
+ - - '='
100
+ - !ruby/object:Gem::Version
110
101
  version: 0.8.7
111
- prerelease: false
112
- requirement: *id006
113
- - !ruby/object:Gem::Dependency
114
102
  type: :development
115
- name: simplecov
116
- version_requirements: &id007 !ruby/object:Gem::Requirement
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
117
105
  none: false
118
- requirements:
119
- - - "="
120
- - !ruby/object:Gem::Version
121
- hash: 11
122
- segments:
123
- - 0
124
- - 4
125
- - 2
126
- version: 0.4.2
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.8.7
110
+ - !ruby/object:Gem::Dependency
111
+ name: coveralls
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
127
119
  prerelease: false
128
- requirement: *id007
129
- description: |
130
-
131
- The right_api_client gem simplifies the use of RightScale's MultiCloud API.
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: ! '
127
+
128
+ The right_api_client gem simplifies the use of RightScale''s MultiCloud API.
129
+
132
130
  It provides a simple object model of the API resources, and handles all of the
131
+
133
132
  fine details involved in making HTTP calls and translating their responses.
134
133
 
134
+ '
135
135
  email: rubygems@rightscale.com
136
136
  executables: []
137
-
138
137
  extensions: []
139
-
140
- extra_rdoc_files:
138
+ extra_rdoc_files:
141
139
  - LICENSE.txt
142
140
  - README.md
143
- files:
141
+ files:
142
+ - .coveralls.yml
144
143
  - .travis.yml
145
144
  - CHANGELOG.md
146
145
  - Gemfile
@@ -161,37 +160,31 @@ files:
161
160
  - login_to_client_irb.rb
162
161
  - right_api_client.rconf
163
162
  homepage: https://github.com/rightscale/right_api_client
164
- licenses:
163
+ licenses:
165
164
  - MIT
166
165
  post_install_message:
167
166
  rdoc_options: []
168
-
169
- require_paths:
167
+ require_paths:
170
168
  - lib
171
- required_ruby_version: !ruby/object:Gem::Requirement
169
+ required_ruby_version: !ruby/object:Gem::Requirement
172
170
  none: false
173
- requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- hash: 3
177
- segments:
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ segments:
178
176
  - 0
179
- version: "0"
180
- required_rubygems_version: !ruby/object:Gem::Requirement
177
+ hash: -3655721947136781612
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
179
  none: false
182
- requirements:
183
- - - ">="
184
- - !ruby/object:Gem::Version
185
- hash: 3
186
- segments:
187
- - 0
188
- version: "0"
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
189
184
  requirements: []
190
-
191
185
  rubyforge_project:
192
- rubygems_version: 1.8.15
186
+ rubygems_version: 1.8.23
193
187
  signing_key:
194
188
  specification_version: 3
195
189
  summary: RightScale MultiCloud API HTTP Client
196
190
  test_files: []
197
-