service_jynx 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32660d4e2cf251e609d2bc945d5872a56f921386
4
- data.tar.gz: 6f1f999edb6108361c6105dced1c2ced1e22c382
3
+ metadata.gz: 3c009a39d4d2e7c6cc7def699c51e36dbf5c3afd
4
+ data.tar.gz: 17f338eda74d45838774899c5091e96dfb07e579
5
5
  SHA512:
6
- metadata.gz: 0ac8fd3e814b6b26bfa1f5f176257d5541a3bedfecbf3c3e61e5d02743248f2a870cdac7b99d91c5e971999833a375bfbd063149d677e8ae9e5e5de622294b13
7
- data.tar.gz: c800ab4f465a5f3bc97fc6711dbdf215a7483b1994f22e37c219e1b83b1ebc65ba7df5db06a995a5f64cdd570e295a3120d541e81cd6f350568ce7a4a0c069e2
6
+ metadata.gz: 847b210f597317a88396ce42468b4c313c6b9207dedfe1f94888fa05e31aa2431f7496b528d2f52e319d14c06ddf482f09f4bd1749bd9f7c20943ca262e1201d
7
+ data.tar.gz: 0f98d7d2ed5d9a1068c66856d51779b8f8b4119753a8bd30418b56c0ab6d035bb84ec294a2fbfe26d458f24fb365032007087b725140705c4c338087f5d56703
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ gemfile:
6
+ - Gemfile
7
+ branches:
8
+ only:
9
+ - master
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'rake'
6
+
5
7
  group :test do
6
8
  gem 'rspec'
7
9
  gem 'pry'
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Service-Jynx
2
+ [![Build Status](https://secure.travis-ci.org/AvnerCohen/service-jynx.png)](http://travis-ci.org/AvnerCohen/service-jynx)
2
3
 
3
4
  Eurasian Wryneck - ***Jynx torquilla***
4
5
 
@@ -6,21 +7,27 @@ Eurasian Wryneck - ***Jynx torquilla***
6
7
 
7
8
  **Jinx** - ***A condition or period of bad luck that appears to have been caused by a specific person or thing.***
8
9
 
9
- A simple (yet powerfull) solution, to allow a Ruby application to manage automatic failover and block calls to an external service and return a stubbed data when service is reported as down.
10
+ A simple solution, to allow a Ruby application to manage automatic failover and block calls to an external service and return a stubbed data when service is reported as down.
10
11
 
11
- The code is MRI depended and is not thread safe, is is also designed specifically to run on a single VM and manage in memory hashes of data, though it can very well be executed with an external shared persistance counters such as, say, Redis.
12
+ The code is MRI depended and is not thread safe(!), is is also designed specifically to run on a single VM and manage in memory hashes of data, though it can very well be executed with an external shared persistance counters such as, say, Redis.
12
13
 
13
14
 
14
15
  ````ruby
15
16
 
16
- if ServiceJynx.alive?(:amazon_s3_service)
17
- begin
18
- HttpParty.get "s3://bucke:username@password/whatever.jpg"
19
- rescue ResponseError => e
20
- ServiceJynx.failure!(:amazon_s3_service)
21
- end
22
- else
23
- "S3 is currently unreachable"
17
+ def index
18
+ begin
19
+ response = {countery: "Israel"}
20
+ if ServiceJynx.alive?("inbox")
21
+ response = {countery: HTTParty.get("https://api.github.com/users/AvnerCohen", :timeout => 20)["location"]}
22
+ else
23
+ response.merge!({error: "service down ! #{__method__}"})
24
+ end
25
+ rescue Exception => e
26
+ ServiceJynx.failure!("inbox")
27
+ response.merge!({error: "exception occured, #{__method__}"})
28
+ ensure
29
+ render json: response.to_json and return
30
+ end
24
31
  end
25
32
 
26
33
  ````
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Run specs'
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.pattern = './spec/**/*_spec.rb'
7
+ end
8
+
9
+ task :default => :spec
10
+ task :test => :spec
@@ -1,3 +1,3 @@
1
1
  module ServiceJynx
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/service_jynx.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "service_jynx/version"
2
+ require "logger_jynx"
2
3
 
3
4
  module ServiceJynx
4
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_jynx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avner Cohen
@@ -21,9 +21,11 @@ files:
21
21
  - .gitignore
22
22
  - .ruby-gemset
23
23
  - .ruby-version
24
+ - .travis.yml
24
25
  - Gemfile
25
26
  - LICENSE.txt
26
27
  - README.md
28
+ - Rakefile
27
29
  - jynx.jpg
28
30
  - lib/logger_jynx.rb
29
31
  - lib/service_jynx.rb