scaleway_api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c2f6e0c846f73845abc1e2ca6d6f6cd188273f499cd324618f20e06b531de873
4
+ data.tar.gz: f6f2284456ca24ee9ac2e74835c84abef0f4c5d4629eeff9bb55b7f8c9992b72
5
+ SHA512:
6
+ metadata.gz: 15d868c8967d39ae350ed092e84c6da46a977eccf9110c89f1cc146d1486d6815ebef63cb4f139d03518b8433ee0846546ea6a8758fdfa4f2ac84b00f315f9e8
7
+ data.tar.gz: c6a7f71225d542adaf29d5b0ca538345fe5f280fda9af747841ae1d51b07f6ae5f46b8355586d0c492b2a488dbf7c7660f8d83dd1a140b8802a6ea86cf403cb5
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.standard.yml ADDED
@@ -0,0 +1,6 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
4
+ ignore:
5
+ - '**/*'
6
+ - Style/StringLiterals
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Lukas_Skywalker
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # ScalewayApi
2
+
3
+ Scaleway client for Ruby.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add scaleway_api
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install scaleway_api
14
+
15
+ ## Usage
16
+
17
+ ### Configuration
18
+
19
+ ```ruby
20
+ ScalewayApi.configure do |config|
21
+ config.region = 'fr-par-1'
22
+ config.api_key = 'abcdefabcdefabcdef'
23
+ end
24
+ ```
25
+
26
+ ### Access a resource
27
+
28
+ Resources are all handled the same way. The code below can be adapted
29
+ to all resources (images, servers, snapshots) and works identically.
30
+
31
+ ```ruby
32
+ # Returns a list of all images
33
+ ScalewayApi::Image.all
34
+
35
+ # Returns the first image
36
+ ScalewayApi::Image.all.first
37
+
38
+ # Returns the name of the first image
39
+ ScalewayApi::Image.all.first.name
40
+ ```
41
+
42
+ ## Development
43
+
44
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/code-fabrik/scaleway_api.
51
+
52
+ ## License
53
+
54
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScalewayApi
4
+ class Image < ActiveResource::Base # rubocop:disable Style/Documentation
5
+ self.site = "https://api.scaleway.com/instance/v1/zones/#{ScalewayApi.configuration.region}"
6
+ headers['X-Auth-Token'] = ScalewayApi.configuration.api_key
7
+ self.include_format_in_path = false
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScalewayApi
4
+ class Image < ActiveResource::Base # rubocop:disable Style/Documentation
5
+ self.site = "https://api.scaleway.com/instance/v1/zones/#{ScalewayApi.configuration.region}"
6
+ headers['X-Auth-Token'] = ScalewayApi.configuration.api_key
7
+ self.include_format_in_path = false
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScalewayApi
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'scaleway_api/version'
4
+
5
+ module ScalewayApi # rubocop:disable Style/Documentation
6
+ class Error < StandardError; end
7
+
8
+ class << self
9
+ attr_accessor :configuration
10
+ end
11
+
12
+ def self.configure
13
+ self.configuration ||= Configuration.new
14
+ yield(configuration)
15
+ end
16
+
17
+ class Configuration # rubocop:disable Style/Documentation
18
+ attr_accessor :region, :api_key
19
+
20
+ def initialize
21
+ @region = 'fr-par-1'
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ module ScalewayApi
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scaleway_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Lukas_Skywalker
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-12-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeresource
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
27
+ description: Ruby bindings for the Scaleway API.
28
+ email:
29
+ - LukasSkywalker@users.noreply.github.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rspec"
35
+ - ".standard.yml"
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - lib/scaleway_api.rb
40
+ - lib/scaleway_api/image.rb
41
+ - lib/scaleway_api/server.rb
42
+ - lib/scaleway_api/version.rb
43
+ - sig/scaleway_api.rbs
44
+ homepage: https://github.com/code-fabrik/scaleway_ruby
45
+ licenses:
46
+ - MIT
47
+ metadata:
48
+ allowed_push_host: https://rubygems.org
49
+ homepage_uri: https://github.com/code-fabrik/scaleway_ruby
50
+ source_code_uri: https://github.com/code-fabrik/scaleway_ruby.git
51
+ changelog_uri: https://github.com/code-fabrik/scaleway_ruby
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.6.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.4.10
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Ruby client for the Scaleway API
71
+ test_files: []