healtcheck_proxy_client 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: 32c146e5e3c1f6d2151d53887d942e71cf2a1322a53f96bb263aba8caa84f249
4
+ data.tar.gz: 79f1f6f8bd2472aa93d4275487ee8aa7fa0d6f4bf6fd5d94d340ffabec304ab5
5
+ SHA512:
6
+ metadata.gz: b898991e7285b10699831a4e69109856204e6408335c1fca6a64a0245c487624dfa5ba279ab5c06551e3a7702f53a9558002605d467a115cd43d80d18ed1937b
7
+ data.tar.gz: '08686ce6fb92124f0aa6908e6390c355a2b167f4bf01d5bd77bbaac24393b460a1ae13c7ffb76b23429258e0f6c11954e5df4d561bd3a89606eca92c3a5c0f9a'
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.2
5
+ before_install: gem install bundler -v 1.16.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in healtcheck_proxy_client.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ healtcheck_proxy_client (0.1.0)
5
+ faraday (~> 0.15)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ faraday (0.15.4)
12
+ multipart-post (>= 1.2, < 3)
13
+ multipart-post (2.0.0)
14
+ rake (10.5.0)
15
+ rspec (3.8.0)
16
+ rspec-core (~> 3.8.0)
17
+ rspec-expectations (~> 3.8.0)
18
+ rspec-mocks (~> 3.8.0)
19
+ rspec-core (3.8.0)
20
+ rspec-support (~> 3.8.0)
21
+ rspec-expectations (3.8.2)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.8.0)
24
+ rspec-mocks (3.8.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.8.0)
27
+ rspec-support (3.8.0)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 1.16)
34
+ healtcheck_proxy_client!
35
+ rake (~> 10.0)
36
+ rspec (~> 3.0)
37
+
38
+ BUNDLED WITH
39
+ 1.16.0
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # HealtcheckProxyClient
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/healtcheck_proxy_client`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'healtcheck_proxy_client'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install healtcheck_proxy_client
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
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 at https://github.com/hendricius/healtcheck_proxy_client.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "healtcheck_proxy_client"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "healtcheck_proxy_client/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "healtcheck_proxy_client"
8
+ spec.version = HealtcheckProxyClient::VERSION
9
+ spec.authors = ["Hendrik Kleinwaechter"]
10
+ spec.email = ["hendrik.kleinwaechter@gmail.com"]
11
+
12
+ spec.summary = %q{This is a small ruby client for the healthbot proxy API}
13
+ spec.description = %q{This is a small ruby client for the healthbot proxy. Configure your API key and endpoint to get started.}
14
+ spec.homepage = "https://github.com/trivago/healthbot-proxy"
15
+ spec.licenses = ['MIT']
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency "faraday", '~> 0.15'
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.16"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ end
@@ -0,0 +1,30 @@
1
+ require "faraday"
2
+
3
+ require "healtcheck_proxy_client/version"
4
+ require "healtcheck_proxy_client/client"
5
+ require "healtcheck_proxy_client/http_error"
6
+
7
+ module HealtcheckProxyClient
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
+ def self.ping(healthcheck)
18
+ Client.ping(configuration: configuration, healthcheck: healthcheck)
19
+ end
20
+
21
+ class Configuration
22
+ attr_accessor :endpoint,
23
+ :api_key
24
+
25
+ def initialize
26
+ @endpoint = 'https://trivago-healthcheck-proxy.herokuapp.com'
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'forwardable'
2
+
3
+ module HealtcheckProxyClient
4
+ class Client
5
+ extend Forwardable
6
+
7
+ def initialize(configuration:, healthcheck:)
8
+ @configuration = configuration
9
+ @healthcheck = healthcheck
10
+ end
11
+
12
+ def self.ping(configuration:, healthcheck:)
13
+ new(configuration: configuration, healthcheck: healthcheck).ping
14
+ end
15
+
16
+ def ping
17
+ Faraday.get(url)
18
+ rescue Faraday::Error => e
19
+ raise HttpError.new(e.message, http_error: e)
20
+ end
21
+
22
+ private
23
+
24
+ def_delegators :@configuration, :api_key, :endpoint
25
+
26
+ def url
27
+ "#{endpoint}/#{@healthcheck}?token=#{api_key}"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module HealtcheckProxyClient
2
+ class HttpError < StandardError
3
+ def initialize(msg, http_error: nil)
4
+ @http_error = http_error
5
+ super(msg)
6
+ end
7
+ attr_reader :http_error
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module HealtcheckProxyClient
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: healtcheck_proxy_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Hendrik Kleinwaechter
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.15'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: This is a small ruby client for the healthbot proxy. Configure your API
70
+ key and endpoint to get started.
71
+ email:
72
+ - hendrik.kleinwaechter@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - healtcheck_proxy_client.gemspec
87
+ - lib/healtcheck_proxy_client.rb
88
+ - lib/healtcheck_proxy_client/client.rb
89
+ - lib/healtcheck_proxy_client/http_error.rb
90
+ - lib/healtcheck_proxy_client/version.rb
91
+ homepage: https://github.com/trivago/healthbot-proxy
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.7.3
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: This is a small ruby client for the healthbot proxy API
115
+ test_files: []