datacentred 0.1.1pre → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +11 -0
  3. data/.coveralls.yml +1 -0
  4. data/.gitignore +9 -0
  5. data/.rubocop.yml +2 -0
  6. data/.yardopts +1 -0
  7. data/CODE_OF_CONDUCT.md +46 -0
  8. data/Gemfile.lock +39 -2
  9. data/LICENSE +21 -0
  10. data/README.md +160 -2
  11. data/circle.yml +0 -2
  12. data/datacentred.gemspec +17 -14
  13. data/docs/Datacentred.html +537 -0
  14. data/docs/Datacentred/Errors.html +260 -0
  15. data/docs/Datacentred/Errors/Error.html +139 -0
  16. data/docs/Datacentred/Errors/NotFound.html +145 -0
  17. data/docs/Datacentred/Errors/Unauthorized.html +149 -0
  18. data/docs/Datacentred/Errors/UnprocessableEntity.html +145 -0
  19. data/docs/Datacentred/Model.html +128 -0
  20. data/docs/Datacentred/Model/Base.html +255 -0
  21. data/docs/Datacentred/Model/Project.html +1729 -0
  22. data/docs/Datacentred/Model/Role.html +1830 -0
  23. data/docs/Datacentred/Model/Usage.html +510 -0
  24. data/docs/Datacentred/Model/User.html +832 -0
  25. data/docs/Datacentred/Model/Version.html +451 -0
  26. data/docs/Datacentred/Project.html +142 -0
  27. data/docs/Datacentred/Request.html +128 -0
  28. data/docs/Datacentred/Request/Base.html +675 -0
  29. data/docs/Datacentred/Request/Projects.html +1286 -0
  30. data/docs/Datacentred/Request/Roles.html +1286 -0
  31. data/docs/Datacentred/Request/Usage.html +315 -0
  32. data/docs/Datacentred/Request/Users.html +841 -0
  33. data/docs/Datacentred/Request/Versions.html +258 -0
  34. data/docs/Datacentred/Response.html +410 -0
  35. data/docs/Datacentred/Role.html +142 -0
  36. data/docs/Datacentred/Usage.html +142 -0
  37. data/docs/Datacentred/User.html +142 -0
  38. data/docs/Datacentred/Version.html +142 -0
  39. data/docs/_index.html +349 -0
  40. data/docs/class_list.html +51 -0
  41. data/docs/css/common.css +1 -0
  42. data/docs/css/full_list.css +58 -0
  43. data/docs/css/style.css +492 -0
  44. data/docs/file.README.html +231 -0
  45. data/docs/file_list.html +56 -0
  46. data/docs/frames.html +17 -0
  47. data/docs/index.html +231 -0
  48. data/docs/js/app.js +248 -0
  49. data/docs/js/full_list.js +216 -0
  50. data/docs/js/jquery.js +4 -0
  51. data/docs/method_list.html +643 -0
  52. data/docs/top-level-namespace.html +110 -0
  53. data/lib/datacentred.rb +65 -12
  54. data/lib/datacentred/error.rb +37 -15
  55. data/lib/datacentred/model/base.rb +21 -0
  56. data/lib/datacentred/model/project.rb +90 -31
  57. data/lib/datacentred/model/role.rb +89 -31
  58. data/lib/datacentred/model/usage.rb +16 -9
  59. data/lib/datacentred/model/user.rb +54 -22
  60. data/lib/datacentred/model/version.rb +17 -8
  61. data/lib/datacentred/request/base.rb +68 -31
  62. data/lib/datacentred/request/projects.rb +92 -24
  63. data/lib/datacentred/request/roles.rb +92 -24
  64. data/lib/datacentred/request/usage.rb +10 -1
  65. data/lib/datacentred/request/users.rb +58 -15
  66. data/lib/datacentred/request/versions.rb +13 -1
  67. data/lib/datacentred/response.rb +6 -2
  68. data/test/integration/authorization_test.rb +30 -0
  69. data/test/integration/projects_test.rb +11 -11
  70. data/test/integration/roles_test.rb +17 -17
  71. data/test/integration/usage_test.rb +8 -8
  72. data/test/integration/users_test.rb +23 -19
  73. data/test/integration/versions_test.rb +1 -2
  74. data/test/test_helper.rb +8 -5
  75. data/test/vcr_cassettes/not_authorized.yml +57 -0
  76. data/test/vcr_cassettes/unexpected_error.yml +56 -0
  77. metadata +115 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 240755616a178340253c32e56e42c84021cd1338
4
- data.tar.gz: ca171ecfb6061c889b3ce2748f827c8a2200cc21
3
+ metadata.gz: 72b7ad08b37235031833f7156e93dd13f8cb1336
4
+ data.tar.gz: e29a3ae8efb52c7f77329f56872a3bfa9f658c0a
5
5
  SHA512:
6
- metadata.gz: 5a9f5ee89ce7a178fdcae5cc897b3e3dabf817f1f6955911c6a9ba8552500ff38daa96d80fc8d254d553ea83c32c3836fab9161300bf79e60b3e09e475d471de
7
- data.tar.gz: f6092203db98a980b9ab9f4100cb01dd85a47f76a05410456b94193fe98e095035d06435db4ae1ccf473f0b32d493a69a6359007b02a94aa092901c0f1797142
6
+ metadata.gz: 2f5a70d175c027659aa02960e493e33642e3e932011691b08fd7470b2784a4de381740ab7663774d7ba1743dbbb4e68ef9e2762b140881c6590cdb311b49ba1b
7
+ data.tar.gz: c24448540cbe8e309c0ba934a4af7b5d4745e120e27d4c1f458cdb2700e38d236e20c00b268e785d160809cb935c9c809153deb96d4b8a2a43a1541986f00eca
@@ -0,0 +1,11 @@
1
+ engines:
2
+ rubocop:
3
+ enabled: true
4
+ config:
5
+ file: .rubocop.yml
6
+ ratings:
7
+ paths:
8
+ - lib/**
9
+ - "**.rb"
10
+ exclude_paths:
11
+ - docs/**/*
@@ -0,0 +1 @@
1
+ repo_token: tqcAzGR7nTMN2VRjkitoGLDWpr1HeURXs
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ .bundle
3
+ .config
4
+ pkg
5
+ doc
6
+ coverage
7
+ .yardoc
8
+ _yardoc
9
+ .DS_Store
@@ -0,0 +1,2 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
@@ -0,0 +1 @@
1
+ --output-dir docs/
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at devops@datacentred.co.uk. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -1,35 +1,72 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datacentred (0.1.0)
4
+ datacentred (0.1.1pre)
5
5
  faraday (~> 0.9.1)
6
+ recursive-open-struct (~> 1.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
11
  addressable (2.5.2)
11
12
  public_suffix (>= 2.0.2, < 4.0)
13
+ coveralls (0.8.0)
14
+ multi_json (~> 1.10)
15
+ rest-client (>= 1.6.8, < 2)
16
+ simplecov (~> 0.9.1)
17
+ term-ansicolor (~> 1.3)
18
+ thor (~> 0.19.1)
12
19
  crack (0.4.3)
13
20
  safe_yaml (~> 1.0.0)
21
+ docile (1.1.5)
22
+ domain_name (0.5.20170404)
23
+ unf (>= 0.0.5, < 1.0.0)
14
24
  faraday (0.9.2)
15
25
  multipart-post (>= 1.2, < 3)
26
+ http-cookie (1.0.3)
27
+ domain_name (~> 0.5)
28
+ mime-types (2.99.3)
16
29
  minitest (5.3.5)
30
+ multi_json (1.12.1)
17
31
  multipart-post (2.0.0)
32
+ netrc (0.11.0)
18
33
  public_suffix (3.0.0)
34
+ rake (12.0.0)
35
+ recursive-open-struct (1.0.5)
36
+ rest-client (1.8.0)
37
+ http-cookie (>= 1.0.2, < 2.0)
38
+ mime-types (>= 1.16, < 3.0)
39
+ netrc (~> 0.7)
19
40
  safe_yaml (1.0.4)
41
+ simplecov (0.9.2)
42
+ docile (~> 1.1.0)
43
+ multi_json (~> 1.0)
44
+ simplecov-html (~> 0.9.0)
45
+ simplecov-html (0.9.0)
46
+ term-ansicolor (1.6.0)
47
+ tins (~> 1.0)
48
+ thor (0.19.4)
49
+ tins (1.15.0)
50
+ unf (0.1.4)
51
+ unf_ext
52
+ unf_ext (0.0.7.4)
20
53
  vcr (2.8.0)
21
54
  webmock (1.8.11)
22
55
  addressable (>= 2.2.7)
23
56
  crack (>= 0.1.7)
57
+ yard (0.9.9)
24
58
 
25
59
  PLATFORMS
26
60
  ruby
27
61
 
28
62
  DEPENDENCIES
63
+ coveralls
29
64
  datacentred!
30
65
  minitest (~> 5.3.1)
66
+ rake (~> 12.0.0)
31
67
  vcr (~> 2.8.0)
32
68
  webmock (~> 1.8.0)
69
+ yard (~> 0.9.0)
33
70
 
34
71
  BUNDLED WITH
35
- 1.15.1
72
+ 1.15.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 DataCentred Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,2 +1,160 @@
1
- # datacentred-api-ruby
2
- Gem wrapper for Datacentred API.
1
+ ![Datacentred](https://assets-cdn.datacentred.io/assets/DC_Mono_B-903aac5ca4f5c6887193d880dbd1196deb8a978027eef5cb32de78b66d085935.png)
2
+
3
+ Ruby client library for automating DataCentred account management.
4
+
5
+ [www.datacentred.co.uk](https://www.datacentred.co.uk)
6
+
7
+ [![CircleCI](https://circleci.com/gh/datacentred/datacentred-api-ruby.svg?style=svg&circle-token=c284db6421742dcfe8c50f52945c31d9b976effb)](https://circleci.com/gh/datacentred/datacentred-api-ruby)
8
+ [![Gem Version](https://badge.fury.io/rb/datacentred.png)](http://badge.fury.io/rb/keybase-core) [![Code Climate](https://codeclimate.com/github/datacentred/datacentred-api-ruby/badges/gpa.svg)](https://codeclimate.com/github/datacentred/datacentred-api-ruby) [![Coverage Status](https://coveralls.io/repos/github/datacentred/datacentred-api-ruby/badge.svg?branch=master)](https://coveralls.io/github/datacentred/datacentred-api-ruby?branch=master)
9
+
10
+ # Installation
11
+
12
+ ```
13
+ gem install datacentred
14
+ ```
15
+
16
+ or
17
+
18
+ (in Gemfile or .gemspec)
19
+ ```ruby
20
+ gem 'datacentred'
21
+ ```
22
+
23
+ then
24
+
25
+ ```ruby
26
+ require 'datacentred'
27
+ ```
28
+
29
+ # Usage
30
+
31
+ This API allows you to automate operations against your DataCentred account.
32
+
33
+ Operations include:
34
+
35
+ * Creating and managing users;
36
+ * Creating and managing roles for users;
37
+ * Managing OpenStack Project creation, quota adjustments, and user assignments;
38
+ * Viewing detailed usage/billing information for your account.
39
+
40
+ ## Authentication
41
+
42
+ The API uses two pieces of information to authenticate access.
43
+
44
+ A unique access key specific to your DataCentred account, and a secret key which is generated once.
45
+
46
+ To get started:
47
+
48
+ 1. Find your API access key and secret key at [my.datacentred.io](https://my.datacentred.io)
49
+
50
+ ![API Credentials](https://user-images.githubusercontent.com/98526/30334767-79f4617c-97d8-11e7-962c-ec3115d13896.png)
51
+
52
+ 2. Set your credentials by exporting your access key and secret key as environment variables:
53
+
54
+ ```
55
+ export DATACENTRED_ACCESS="my_access"
56
+ export DATACENTRED_SECRET="my_secret"
57
+ ```
58
+
59
+ Or setting your keys manually using the following methods:
60
+
61
+ ```ruby
62
+ Datacentred.access_key = 'my_access'
63
+ Datacentred.secret_key = 'my_secret'
64
+ ```
65
+
66
+ NOTE: If you use this approach, the gem will ignore any values assigned to the environment variables.
67
+
68
+ ## Usage Examples
69
+
70
+ The `User`, `Project`, and `Role` entities all support CRUD operations via the following methods:
71
+
72
+ * `.all` - returns an index of all entities of this type.
73
+ * `.create params` - creates a new entity where `params` is a hash of properties.
74
+ * `.update id, params` - updates the entity identified by `id` with the hash of properties defined by `params`.
75
+ * `.find id` - finds the entity via the unique identifier `id`.
76
+ * `.destroy id` - removes the entity via the unique identifier `id`.
77
+
78
+ Here are some worked examples:
79
+
80
+ ### List all available users
81
+
82
+ ```ruby
83
+ Datacentred::User.all
84
+ # => [#<Datacentred::Model::User id="2bd21ee25cde40fdb9454954e4fbb4b5", ...>, ...]
85
+ ```
86
+
87
+ ### Find a user by id
88
+
89
+ ```ruby
90
+ Datacentred::User.find "2bd21ee25cde40fdb9454954e4fbb4b5"
91
+ # => #<Datacentred::Model::User id="2bd21ee25cde40fdb9454954e4fbb4b5", ...>
92
+ ```
93
+
94
+ ### Update a project
95
+
96
+ ```ruby
97
+ Datacentred::Project.update "6d5277716c4b10d2177814af50b77175", name: "Foo"
98
+ # => #<Datacentred::Model::Project id="6d5277716c4b10d2177814af50b77175", name= "Foo", ...>
99
+ ```
100
+
101
+ ### Create a role
102
+
103
+ Acceptable permissions are: 'api.read', 'cloud.read', 'roles.modify', 'roles.read', 'storage.read', 'tickets.modify', 'usage.read'.
104
+
105
+ ```ruby
106
+ Datacentred::Role.create name: "foo", permissions: ["usage.read"]
107
+ # => #<Datacentred::Model::Role id="654f423e-646a-4742-849d-d8c9ab9b4f39", name="foo", admin=false, permissions=["usage.read"] ...>
108
+ ```
109
+
110
+ ### Add a user to a role
111
+
112
+ ```ruby
113
+ Datacentred::Role.add_user role_id: "654f423e-646a-4742-849d-d8c9ab9b4f39", user_id: "2bd21ee25cde40fdb9454954e4fbb4b5"
114
+ # => true
115
+ ```
116
+
117
+ ### Remove a user from a project
118
+
119
+ ```ruby
120
+ Datacentred::Project.remove_user project_id: "6d5277716c4b10d2177814af50b77175", user_id: "2bd21ee25cde40fdb9454954e4fbb4b5"
121
+ # => true
122
+ ```
123
+
124
+ ### Get usage data for a given year and month
125
+
126
+ Usage data is returned simply by supplying a year and a month. If the year/month are current then the data will be as recent as the time contained within the `last_updated_at` property.
127
+
128
+ ```ruby
129
+ @usage = Datacentred::Usage.find 2017, 6
130
+ # => #<Datacentred::Model::Usage last_updated_at=2017-07-12 09:46:54 UTC, projects=[{:id=>"37033518a4514f12adeb8346ac3f188c"
131
+ @usage.projects.first.name
132
+ # => "wyld_stallyns"
133
+ @usage.projects.first.usage.instances.first.current_flavor.name
134
+ => "dc1.1x1"
135
+ ```
136
+
137
+ ## Schemas
138
+
139
+ There are JSON schemas available for each entity in the gem:
140
+
141
+ * Projects: https://my.datacentred.io/api/schemas/project
142
+ * Roles: https://my.datacentred.io/api/schemas/role
143
+ * Usage: https://my.datacentred.io/api/schemas/usage
144
+ * User: https://my.datacentred.io/api/schemas/user
145
+
146
+ ## Errors
147
+
148
+ The gem may raise the following standard errors:
149
+
150
+ * `Unauthorized` - Your credentials are incorrect or your account isn't authorized for API access.
151
+ * `NotFound` - The entity you referred to can't be found with the ID you supplied.
152
+ * `UnprocessableEntity` - There was a validation issue with your request (only applies to create/delete/update operations)
153
+
154
+ ## Documentation
155
+
156
+ Full documentation is also available via https://datacentred.github.io/datacentred-api-ruby/
157
+
158
+ ## API Reference Manual
159
+
160
+ Please check out the [DataCentred API Documentation](https://my.datacentred.io/api/docs/v1) for a comprehensive description of the API itself.
data/circle.yml CHANGED
@@ -1,5 +1,3 @@
1
1
  machine:
2
- timezone:
3
- Europe/London
4
2
  ruby:
5
3
  version: 2.3.1
@@ -1,23 +1,26 @@
1
1
  Gem::Specification.new do |gem|
2
- gem.name = 'datacentred'
3
- gem.version = '0.1.1pre'
4
- gem.date = '2017-08-10'
5
- gem.summary = 'datacentred'
2
+ gem.name = 'datacentred'
3
+ gem.version = '1.1.1'
4
+ gem.date = '2017-09-14'
5
+ gem.summary = 'datacentred'
6
6
  gem.description = 'Gem wrapper for Datacentred API'
7
- gem.authors = [ 'Eugenia Grieff', 'Sean Handley' ]
8
- gem.email = 'megrieff@gmail.com'
9
- gem.files = `git ls-files`.split("\n")
10
- gem.homepage = 'https://github.com/datacentred/datacentred-api-ruby'
11
- gem.license = 'BSD-3-Clause'
7
+ gem.authors = [ 'Eugenia Grieff', 'Sean Handley' ]
8
+ gem.email = 'megrieff@gmail.com'
9
+ gem.files = `git ls-files`.split("\n")
10
+ gem.homepage = 'https://github.com/datacentred/datacentred-api-ruby'
11
+ gem.license = 'MIT'
12
12
 
13
13
  gem.required_ruby_version = '> 2.3'
14
14
 
15
15
  # Runtime Dependencies
16
- gem.add_runtime_dependency 'faraday', '~> 0.9.1'
16
+ gem.add_runtime_dependency 'faraday', '~> 0.9.1'
17
+ gem.add_runtime_dependency 'recursive-open-struct', '~> 1.0'
17
18
 
18
19
  # Development Dependencies
19
- gem.add_development_dependency 'vcr', '~> 2.8.0'
20
- gem.add_development_dependency 'webmock', '~> 1.8.0'
21
- gem.add_development_dependency 'minitest', '~> 5.3.1'
22
-
20
+ gem.add_development_dependency 'minitest', '~> 5.3.1'
21
+ gem.add_development_dependency 'rake', '~> 12.0.0'
22
+ gem.add_development_dependency 'vcr', '~> 2.8.0'
23
+ gem.add_development_dependency 'webmock', '~> 1.8.0'
24
+ gem.add_development_dependency 'yard', '~> 0.9.0'
25
+ gem.add_development_dependency 'coveralls', '~> 0.8.0'
23
26
  end
@@ -0,0 +1,537 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Datacentred
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Datacentred";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (D)</a> &raquo;
40
+
41
+
42
+ <span class="title">Datacentred</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Datacentred
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/datacentred.rb<span class="defines">,<br />
82
+ lib/datacentred/error.rb,<br /> lib/datacentred/response.rb,<br /> lib/datacentred/model/base.rb,<br /> lib/datacentred/model/role.rb,<br /> lib/datacentred/model/user.rb,<br /> lib/datacentred/model/usage.rb,<br /> lib/datacentred/request/base.rb,<br /> lib/datacentred/model/project.rb,<br /> lib/datacentred/model/version.rb,<br /> lib/datacentred/request/roles.rb,<br /> lib/datacentred/request/usage.rb,<br /> lib/datacentred/request/users.rb,<br /> lib/datacentred/request/projects.rb,<br /> lib/datacentred/request/versions.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>Main Datacentred client module</p>
92
+
93
+ <p>This library acts as a Ruby wrapper for the DataCentred API.</p>
94
+
95
+
96
+ </div>
97
+ </div>
98
+ <div class="tags">
99
+
100
+
101
+ </div><h2>Defined Under Namespace</h2>
102
+ <p class="children">
103
+
104
+
105
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Datacentred/Errors.html" title="Datacentred::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Datacentred/Model.html" title="Datacentred::Model (module)">Model</a></span>, <span class='object_link'><a href="Datacentred/Request.html" title="Datacentred::Request (module)">Request</a></span>
106
+
107
+
108
+
109
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Datacentred/Project.html" title="Datacentred::Project (class)">Project</a></span>, <span class='object_link'><a href="Datacentred/Response.html" title="Datacentred::Response (class)">Response</a></span>, <span class='object_link'><a href="Datacentred/Role.html" title="Datacentred::Role (class)">Role</a></span>, <span class='object_link'><a href="Datacentred/Usage.html" title="Datacentred::Usage (class)">Usage</a></span>, <span class='object_link'><a href="Datacentred/User.html" title="Datacentred::User (class)">User</a></span>, <span class='object_link'><a href="Datacentred/Version.html" title="Datacentred::Version (class)">Version</a></span>
110
+
111
+
112
+ </p>
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ <h2>
122
+ Class Method Summary
123
+ <small><a href="#" class="summary_toggle">collapse</a></small>
124
+ </h2>
125
+
126
+ <ul class="summary">
127
+
128
+ <li class="public ">
129
+ <span class="summary_signature">
130
+
131
+ <a href="#access_key-class_method" title="access_key (class method)">.<strong>access_key</strong> &#x21d2; String </a>
132
+
133
+
134
+
135
+ </span>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ <span class="summary_desc"><div class='inline'>
146
+ <p>Access key credential for the DataCentred API.</p>
147
+ </div></span>
148
+
149
+ </li>
150
+
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#access_key=-class_method" title="access_key= (class method)">.<strong>access_key=</strong>(new_access_key) &#x21d2; String </a>
156
+
157
+
158
+
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'>
170
+ <p>Set a new access key value.</p>
171
+ </div></span>
172
+
173
+ </li>
174
+
175
+
176
+ <li class="public ">
177
+ <span class="summary_signature">
178
+
179
+ <a href="#secret_key-class_method" title="secret_key (class method)">.<strong>secret_key</strong> &#x21d2; String </a>
180
+
181
+
182
+
183
+ </span>
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>Secret key credential for the DataCentred API.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#secret_key=-class_method" title="secret_key= (class method)">.<strong>secret_key=</strong>(new_secret_key) &#x21d2; String </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <span class="summary_desc"><div class='inline'>
218
+ <p>Set a new secret key value.</p>
219
+ </div></span>
220
+
221
+ </li>
222
+
223
+
224
+ </ul>
225
+
226
+
227
+
228
+
229
+ <div id="class_method_details" class="method_details_list">
230
+ <h2>Class Method Details</h2>
231
+
232
+
233
+ <div class="method_details first">
234
+ <h3 class="signature first" id="access_key-class_method">
235
+
236
+ .<strong>access_key</strong> &#x21d2; <tt>String</tt>
237
+
238
+
239
+
240
+
241
+
242
+ </h3><div class="docstring">
243
+ <div class="discussion">
244
+
245
+ <p>Access key credential for the DataCentred API.</p>
246
+
247
+ <p>This value is automatically loaded from the
248
+ <strong>DATACENTRED_ACCESS</strong> environment variable.</p>
249
+
250
+ <p>You can find your API credentials by logging into the dashboard at <a
251
+ href="https://my.datacentred.io">my.datacentred.io</a></p>
252
+
253
+
254
+ </div>
255
+ </div>
256
+ <div class="tags">
257
+
258
+ <p class="tag_title">Returns:</p>
259
+ <ul class="return">
260
+
261
+ <li>
262
+
263
+
264
+ <span class='type'>(<tt>String</tt>)</span>
265
+
266
+
267
+
268
+ &mdash;
269
+ <div class='inline'>
270
+ <p>API access key credential</p>
271
+ </div>
272
+
273
+ </li>
274
+
275
+ </ul>
276
+
277
+ </div><table class="source_code">
278
+ <tr>
279
+ <td>
280
+ <pre class="lines">
281
+
282
+
283
+ 32
284
+ 33
285
+ 34</pre>
286
+ </td>
287
+ <td>
288
+ <pre class="code"><span class="info file"># File 'lib/datacentred.rb', line 32</span>
289
+
290
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_access_key'>access_key</span>
291
+ <span class='cvar'>@@access_key</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>DATACENTRED_ACCESS</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
292
+ <span class='kw'>end</span></pre>
293
+ </td>
294
+ </tr>
295
+ </table>
296
+ </div>
297
+
298
+ <div class="method_details ">
299
+ <h3 class="signature " id="access_key=-class_method">
300
+
301
+ .<strong>access_key=</strong>(new_access_key) &#x21d2; <tt>String</tt>
302
+
303
+
304
+
305
+
306
+
307
+ </h3><div class="docstring">
308
+ <div class="discussion">
309
+
310
+ <p>Set a new access key value.</p>
311
+
312
+ <p>This will override any values loaded from environment variables.</p>
313
+
314
+
315
+ </div>
316
+ </div>
317
+ <div class="tags">
318
+ <p class="tag_title">Parameters:</p>
319
+ <ul class="param">
320
+
321
+ <li>
322
+
323
+ <span class='name'>new_access_key</span>
324
+
325
+
326
+ <span class='type'>(<tt>String</tt>)</span>
327
+
328
+
329
+
330
+ &mdash;
331
+ <div class='inline'>
332
+ <p>New access key value</p>
333
+ </div>
334
+
335
+ </li>
336
+
337
+ </ul>
338
+
339
+ <p class="tag_title">Returns:</p>
340
+ <ul class="return">
341
+
342
+ <li>
343
+
344
+
345
+ <span class='type'>(<tt>String</tt>)</span>
346
+
347
+
348
+
349
+ &mdash;
350
+ <div class='inline'>
351
+ <p>API access key credential</p>
352
+ </div>
353
+
354
+ </li>
355
+
356
+ </ul>
357
+
358
+ </div><table class="source_code">
359
+ <tr>
360
+ <td>
361
+ <pre class="lines">
362
+
363
+
364
+ 42
365
+ 43
366
+ 44</pre>
367
+ </td>
368
+ <td>
369
+ <pre class="code"><span class="info file"># File 'lib/datacentred.rb', line 42</span>
370
+
371
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_access_key='>access_key=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_access_key'>new_access_key</span><span class='rparen'>)</span>
372
+ <span class='cvar'>@@access_key</span> <span class='op'>=</span> <span class='id identifier rubyid_new_access_key'>new_access_key</span>
373
+ <span class='kw'>end</span></pre>
374
+ </td>
375
+ </tr>
376
+ </table>
377
+ </div>
378
+
379
+ <div class="method_details ">
380
+ <h3 class="signature " id="secret_key-class_method">
381
+
382
+ .<strong>secret_key</strong> &#x21d2; <tt>String</tt>
383
+
384
+
385
+
386
+
387
+
388
+ </h3><div class="docstring">
389
+ <div class="discussion">
390
+
391
+ <p>Secret key credential for the DataCentred API.</p>
392
+
393
+ <p>This value is automatically loaded from the
394
+ <strong>DATACENTRED_SECRET</strong> environment variable.</p>
395
+
396
+ <p>You can find your API credentials by logging into the dashboard at <a
397
+ href="https://my.datacentred.io">my.datacentred.io</a></p>
398
+
399
+
400
+ </div>
401
+ </div>
402
+ <div class="tags">
403
+
404
+ <p class="tag_title">Returns:</p>
405
+ <ul class="return">
406
+
407
+ <li>
408
+
409
+
410
+ <span class='type'>(<tt>String</tt>)</span>
411
+
412
+
413
+
414
+ &mdash;
415
+ <div class='inline'>
416
+ <p>API secret key credential</p>
417
+ </div>
418
+
419
+ </li>
420
+
421
+ </ul>
422
+
423
+ </div><table class="source_code">
424
+ <tr>
425
+ <td>
426
+ <pre class="lines">
427
+
428
+
429
+ 53
430
+ 54
431
+ 55</pre>
432
+ </td>
433
+ <td>
434
+ <pre class="code"><span class="info file"># File 'lib/datacentred.rb', line 53</span>
435
+
436
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secret_key'>secret_key</span>
437
+ <span class='cvar'>@@secret_key</span> <span class='op'>||=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>DATACENTRED_SECRET</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
438
+ <span class='kw'>end</span></pre>
439
+ </td>
440
+ </tr>
441
+ </table>
442
+ </div>
443
+
444
+ <div class="method_details ">
445
+ <h3 class="signature " id="secret_key=-class_method">
446
+
447
+ .<strong>secret_key=</strong>(new_secret_key) &#x21d2; <tt>String</tt>
448
+
449
+
450
+
451
+
452
+
453
+ </h3><div class="docstring">
454
+ <div class="discussion">
455
+
456
+ <p>Set a new secret key value.</p>
457
+
458
+ <p>This will override any values loaded from environment variables.</p>
459
+
460
+
461
+ </div>
462
+ </div>
463
+ <div class="tags">
464
+ <p class="tag_title">Parameters:</p>
465
+ <ul class="param">
466
+
467
+ <li>
468
+
469
+ <span class='name'>new_secret_key</span>
470
+
471
+
472
+ <span class='type'>(<tt>String</tt>)</span>
473
+
474
+
475
+
476
+ &mdash;
477
+ <div class='inline'>
478
+ <p>New secret key value</p>
479
+ </div>
480
+
481
+ </li>
482
+
483
+ </ul>
484
+
485
+ <p class="tag_title">Returns:</p>
486
+ <ul class="return">
487
+
488
+ <li>
489
+
490
+
491
+ <span class='type'>(<tt>String</tt>)</span>
492
+
493
+
494
+
495
+ &mdash;
496
+ <div class='inline'>
497
+ <p>API secret key credential</p>
498
+ </div>
499
+
500
+ </li>
501
+
502
+ </ul>
503
+
504
+ </div><table class="source_code">
505
+ <tr>
506
+ <td>
507
+ <pre class="lines">
508
+
509
+
510
+ 64
511
+ 65
512
+ 66</pre>
513
+ </td>
514
+ <td>
515
+ <pre class="code"><span class="info file"># File 'lib/datacentred.rb', line 64</span>
516
+
517
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secret_key='>secret_key=</span><span class='lparen'>(</span><span class='id identifier rubyid_new_secret_key'>new_secret_key</span><span class='rparen'>)</span>
518
+ <span class='cvar'>@@secret_key</span> <span class='op'>=</span> <span class='id identifier rubyid_new_secret_key'>new_secret_key</span>
519
+ <span class='kw'>end</span></pre>
520
+ </td>
521
+ </tr>
522
+ </table>
523
+ </div>
524
+
525
+ </div>
526
+
527
+ </div>
528
+
529
+ <div id="footer">
530
+ Generated on Fri Sep 15 16:27:42 2017 by
531
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
532
+ 0.9.9 (ruby-2.3.1).
533
+ </div>
534
+
535
+ </div>
536
+ </body>
537
+ </html>