dsapi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +31 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +8 -0
- data/Guardfile +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/dsapi.gemspec +50 -0
- data/lib/dsapi.rb +7 -0
- data/lib/dsapi/client.rb +64 -0
- data/lib/dsapi/configuration.rb +14 -0
- data/lib/dsapi/operations/parse_json_response.rb +18 -0
- data/lib/dsapi/operations/setup_faraday.rb +34 -0
- data/lib/dsapi/operations_center.rb +21 -0
- data/lib/dsapi/transactions/delete_dataset.rb +14 -0
- data/lib/dsapi/transactions/get_dataset.rb +14 -0
- data/lib/dsapi/transactions/get_dataset_file.rb +14 -0
- data/lib/dsapi/transactions/get_datasets.rb +14 -0
- data/lib/dsapi/transactions/get_documentation.rb +33 -0
- data/lib/dsapi/transactions/ping.rb +37 -0
- data/lib/dsapi/transactions/put_dataset.rb +14 -0
- data/lib/dsapi/version.rb +5 -0
- metadata +271 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e74ba9e04bf9fc72369b0689ace3a00b33538d9ea381448ef181ef8b56373a2a
|
4
|
+
data.tar.gz: 39011ffb434a5106b88246986116cfb24c5d860553a1d2ea94d1617909e18062
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b9aa8e4d865ed2ba0cf033be470a4fb8a22c7f8b59ce9896dbb77aa0ceedf1096eed137aef9be28b1f1fb9f7699b344cd8cf76735f8e60807ef17fedc65bf15f
|
7
|
+
data.tar.gz: e98c5becfa0e448fb577e9c93ed9b66da559340ff8cf05a0d70f6dcc1bcc69767ac568318e10c87f00ab51847ca398ae7683b174987b23f6c2fd0475e3988f86
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.5
|
5
|
+
ExtraDetails: true
|
6
|
+
DisplayStyleGuide: true
|
7
|
+
DisplayCopNames: true
|
8
|
+
Exclude:
|
9
|
+
- dsapi.gemspec
|
10
|
+
- Guardfile
|
11
|
+
- vendor/bundle/**/*
|
12
|
+
|
13
|
+
Naming/AccessorMethodName:
|
14
|
+
Enabled: false
|
15
|
+
Style/Documentation:
|
16
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.5.3
|
5
|
+
- 2.5.2
|
6
|
+
- 2.5.1
|
7
|
+
- 2.5.0
|
8
|
+
- 2.4.5
|
9
|
+
- 2.4.4
|
10
|
+
- 2.4.3
|
11
|
+
- 2.4.2
|
12
|
+
- 2.4.1
|
13
|
+
- 2.4.0
|
14
|
+
- 2.3.8
|
15
|
+
- 2.3.7
|
16
|
+
- 2.3.6
|
17
|
+
- 2.3.5
|
18
|
+
- 2.3.4
|
19
|
+
- 2.3.3
|
20
|
+
- 2.3.2
|
21
|
+
- 2.3.1
|
22
|
+
- 2.3.0
|
23
|
+
sudo: false
|
24
|
+
cache: bundler
|
25
|
+
before_install:
|
26
|
+
- gem update --system
|
27
|
+
- gem install bundler -v 1.17.1
|
28
|
+
script:
|
29
|
+
- bundle exec bundle-audit check --update
|
30
|
+
- bundle exec rubocop
|
31
|
+
- bundle exec rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [0.0.1] - 2018-11-18
|
8
|
+
### Added
|
9
|
+
- basic gem scaffold
|
10
|
+
- test infrastructure
|
11
|
+
- implemented /ping endpoint
|
12
|
+
|
13
|
+
[0.0.1]: https://github.com/ncreuschling/dsapi/releases/tag/v0.0.1
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
guard :rubocop, all_on_start: true do
|
4
|
+
watch(%r{.+\.rb$})
|
5
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
6
|
+
end
|
7
|
+
|
8
|
+
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true, all_after_pass: true do
|
9
|
+
require 'guard/rspec/dsl'
|
10
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
11
|
+
|
12
|
+
# RSpec files
|
13
|
+
rspec = dsl.rspec
|
14
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
15
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
16
|
+
watch(rspec.spec_files)
|
17
|
+
|
18
|
+
# Ruby files
|
19
|
+
ruby = dsl.ruby
|
20
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
21
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Nicolai Reuschling
|
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,39 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/ncreuschling/dsapi.svg?branch=master)](https://travis-ci.org/ncreuschling/dsapi) [![Gem Version](https://badge.fury.io/rb/dsapi.svg)](https://badge.fury.io/rb/dsapi)
|
2
|
+
|
3
|
+
# Rubygem dsapi
|
4
|
+
|
5
|
+
This is a Ruby client to consume Joyent's SmartOS Dataset API. More info at https://datasets.joyent.com/docs/.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'dsapi'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install dsapi
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/ncreuschling/dsapi).
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'dsapi'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/dsapi.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'dsapi/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'dsapi'
|
9
|
+
spec.version = Dsapi::VERSION
|
10
|
+
spec.authors = ['Nicolai Reuschling']
|
11
|
+
spec.email = ['gemdev@reuschling.name']
|
12
|
+
|
13
|
+
spec.summary = "Client for Joyent's SmartOS Dataset API"
|
14
|
+
spec.description = "Ruby client to consume Joyent's SmartOS Dataset API. More info at https://datasets.joyent.com/docs/"
|
15
|
+
spec.homepage = 'https://github.com/ncreuschling/dsapi'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/ncreuschling/dsapi/blob/master/CHANGELOG.md'
|
22
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/ncreuschling/dsapi/issues'
|
23
|
+
else
|
24
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
25
|
+
'public gem pushes.'
|
26
|
+
end
|
27
|
+
|
28
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
spec.bindir = 'exe'
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ['lib']
|
34
|
+
|
35
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
36
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.6'
|
37
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
38
|
+
spec.add_development_dependency 'guard-rubocop', '~> 1.3'
|
39
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
40
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
41
|
+
spec.add_development_dependency 'rubocop', '~> 0.60'
|
42
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.13'
|
43
|
+
spec.add_development_dependency 'simplecov', '~> 0.10'
|
44
|
+
spec.add_development_dependency 'terminal-notifier-guard', '~> 1.7'
|
45
|
+
|
46
|
+
spec.add_dependency 'dry-configurable', '~> 0.7'
|
47
|
+
spec.add_dependency 'dry-core', '~> 0.4'
|
48
|
+
spec.add_dependency 'dry-transaction', '~> 0.13'
|
49
|
+
spec.add_dependency 'faraday', '~> 0.15'
|
50
|
+
end
|
data/lib/dsapi.rb
ADDED
data/lib/dsapi/client.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/core/deprecations'
|
4
|
+
|
5
|
+
require 'dsapi/transactions/get_datasets'
|
6
|
+
require 'dsapi/transactions/get_dataset'
|
7
|
+
require 'dsapi/transactions/get_dataset_file'
|
8
|
+
require 'dsapi/transactions/put_dataset'
|
9
|
+
require 'dsapi/transactions/delete_dataset'
|
10
|
+
require 'dsapi/transactions/get_documentation'
|
11
|
+
require 'dsapi/transactions/ping'
|
12
|
+
|
13
|
+
module Dsapi
|
14
|
+
class Client
|
15
|
+
extend Dry::Core::Deprecations[:deprecation]
|
16
|
+
|
17
|
+
def get_datasets
|
18
|
+
Dsapi::Transactions::GetDatasets.new.call
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_dataset(uuid:)
|
22
|
+
Dsapi::Transactions::GetDataset.new.call(uuid: uuid)
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_dataset_file(id:, path:)
|
26
|
+
Dsapi::Transactions::GetDatasetFile.new.call(id: id, path: path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_asset(_path:)
|
30
|
+
raise NotImplementedError
|
31
|
+
end
|
32
|
+
deprecate :get_asset, :get_dataset_file
|
33
|
+
|
34
|
+
def put_dataset(uuid:)
|
35
|
+
Dsapi::Transactions::PutDataset.new.call(uuid: uuid)
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete_dataset(uuid:)
|
39
|
+
Dsapi::Transactions::DeleteDataset.new.call(uuid: uuid)
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_documentation
|
43
|
+
Dsapi::Transactions::GetDocumentation.new.call do |m|
|
44
|
+
m.success do |documentation|
|
45
|
+
documentation
|
46
|
+
end
|
47
|
+
m.failure do
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def ping
|
54
|
+
Dsapi::Transactions::Ping.new.call do |m|
|
55
|
+
m.success do |pong|
|
56
|
+
pong
|
57
|
+
end
|
58
|
+
m.failure do
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/configurable'
|
4
|
+
|
5
|
+
module Dsapi
|
6
|
+
class Configuration
|
7
|
+
extend Dry::Configurable
|
8
|
+
|
9
|
+
setting :base_uri, 'https://datasets.joyent.com/'
|
10
|
+
|
11
|
+
setting :faraday_ssl_options
|
12
|
+
setting :faraday_proxy_options
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'dry/transaction/operation'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Operations
|
8
|
+
class ParseJsonResponse
|
9
|
+
include Dry::Transaction::Operation
|
10
|
+
|
11
|
+
def call(response_body)
|
12
|
+
hash = JSON.parse response_body
|
13
|
+
|
14
|
+
Success(hash)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'dry/transaction/operation'
|
5
|
+
require 'dsapi/configuration'
|
6
|
+
|
7
|
+
module Dsapi
|
8
|
+
module Operations
|
9
|
+
class SetupFaraday
|
10
|
+
include Dry::Transaction::Operation
|
11
|
+
|
12
|
+
def call(_input)
|
13
|
+
connection = Faraday.new faraday_options
|
14
|
+
|
15
|
+
Success(connection)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def faraday_options
|
21
|
+
{
|
22
|
+
url: Dsapi::Configuration.config.base_uri,
|
23
|
+
params: nil,
|
24
|
+
headers: {
|
25
|
+
Accept: 'application/json'
|
26
|
+
},
|
27
|
+
request: nil,
|
28
|
+
ssl: Dsapi::Configuration.config.faraday_ssl_options,
|
29
|
+
proxy: Dsapi::Configuration.config.faraday_proxy_options
|
30
|
+
}.freeze
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/container/mixin'
|
4
|
+
require 'dsapi/operations/parse_json_response'
|
5
|
+
require 'dsapi/operations/setup_faraday'
|
6
|
+
|
7
|
+
module Dsapi
|
8
|
+
class OperationsCenter
|
9
|
+
extend Dry::Container::Mixin
|
10
|
+
|
11
|
+
namespace 'operations' do
|
12
|
+
register 'setup_faraday' do
|
13
|
+
Dsapi::Operations::SetupFaraday.new
|
14
|
+
end
|
15
|
+
|
16
|
+
register 'parse_json_response' do
|
17
|
+
Dsapi::Operations::ParseJsonResponse.new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class DeleteDataset
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class GetDataset
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class GetDatasetFile
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class GetDatasets
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class GetDocumentation
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
step :request
|
13
|
+
step :parse, with: 'operations.parse_json_response'
|
14
|
+
step :evaluate
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def request(faraday_connection)
|
19
|
+
response = faraday_connection.get '/'
|
20
|
+
|
21
|
+
if response.success?
|
22
|
+
Success(response.body)
|
23
|
+
else
|
24
|
+
Failure(response.body)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def evaluate(input)
|
29
|
+
Success(input)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class Ping
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
step :request
|
13
|
+
step :parse, with: 'operations.parse_json_response'
|
14
|
+
step :evaluate
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def request(faraday_connection)
|
19
|
+
response = faraday_connection.get '/ping'
|
20
|
+
|
21
|
+
if response.success?
|
22
|
+
Success(response.body)
|
23
|
+
else
|
24
|
+
Failure(response.body)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def evaluate(input)
|
29
|
+
if input['ping'] == 'pong'
|
30
|
+
Success('pong')
|
31
|
+
else
|
32
|
+
Failure(input['ping'])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/transaction'
|
4
|
+
require 'dsapi/operations_center'
|
5
|
+
|
6
|
+
module Dsapi
|
7
|
+
module Transactions
|
8
|
+
class PutDataset
|
9
|
+
include Dry::Transaction(container: Dsapi::OperationsCenter)
|
10
|
+
|
11
|
+
step :setup, with: 'operations.setup_faraday'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,271 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dsapi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicolai Reuschling
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler-audit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '12.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '12.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.60'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.60'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.13'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.13'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.10'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: terminal-notifier-guard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.7'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.7'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: dry-configurable
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.7'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.7'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: dry-core
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.4'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.4'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: dry-transaction
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.13'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.13'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: faraday
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0.15'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0.15'
|
209
|
+
description: Ruby client to consume Joyent's SmartOS Dataset API. More info at https://datasets.joyent.com/docs/
|
210
|
+
email:
|
211
|
+
- gemdev@reuschling.name
|
212
|
+
executables: []
|
213
|
+
extensions: []
|
214
|
+
extra_rdoc_files: []
|
215
|
+
files:
|
216
|
+
- ".gitignore"
|
217
|
+
- ".rspec"
|
218
|
+
- ".rubocop.yml"
|
219
|
+
- ".travis.yml"
|
220
|
+
- CHANGELOG.md
|
221
|
+
- Gemfile
|
222
|
+
- Guardfile
|
223
|
+
- LICENSE.txt
|
224
|
+
- README.md
|
225
|
+
- Rakefile
|
226
|
+
- bin/console
|
227
|
+
- bin/setup
|
228
|
+
- dsapi.gemspec
|
229
|
+
- lib/dsapi.rb
|
230
|
+
- lib/dsapi/client.rb
|
231
|
+
- lib/dsapi/configuration.rb
|
232
|
+
- lib/dsapi/operations/parse_json_response.rb
|
233
|
+
- lib/dsapi/operations/setup_faraday.rb
|
234
|
+
- lib/dsapi/operations_center.rb
|
235
|
+
- lib/dsapi/transactions/delete_dataset.rb
|
236
|
+
- lib/dsapi/transactions/get_dataset.rb
|
237
|
+
- lib/dsapi/transactions/get_dataset_file.rb
|
238
|
+
- lib/dsapi/transactions/get_datasets.rb
|
239
|
+
- lib/dsapi/transactions/get_documentation.rb
|
240
|
+
- lib/dsapi/transactions/ping.rb
|
241
|
+
- lib/dsapi/transactions/put_dataset.rb
|
242
|
+
- lib/dsapi/version.rb
|
243
|
+
homepage: https://github.com/ncreuschling/dsapi
|
244
|
+
licenses:
|
245
|
+
- MIT
|
246
|
+
metadata:
|
247
|
+
homepage_uri: https://github.com/ncreuschling/dsapi
|
248
|
+
source_code_uri: https://github.com/ncreuschling/dsapi
|
249
|
+
changelog_uri: https://github.com/ncreuschling/dsapi/blob/master/CHANGELOG.md
|
250
|
+
bug_tracker_uri: https://github.com/ncreuschling/dsapi/issues
|
251
|
+
post_install_message:
|
252
|
+
rdoc_options: []
|
253
|
+
require_paths:
|
254
|
+
- lib
|
255
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
256
|
+
requirements:
|
257
|
+
- - ">="
|
258
|
+
- !ruby/object:Gem::Version
|
259
|
+
version: '0'
|
260
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
265
|
+
requirements: []
|
266
|
+
rubyforge_project:
|
267
|
+
rubygems_version: 2.7.8
|
268
|
+
signing_key:
|
269
|
+
specification_version: 4
|
270
|
+
summary: Client for Joyent's SmartOS Dataset API
|
271
|
+
test_files: []
|