api-client 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -26,6 +26,10 @@ Add this to your ApplicationController:
26
26
  #Specify your own behavior here
27
27
  end
28
28
 
29
+ You can define a more generic rescue that will work for any error:
30
+
31
+ rescue_from ApiClient::Exceptions::Generic, :with => :generic_error
32
+
29
33
  Then, on your action, just put into it:
30
34
 
31
35
  @user = ApiClient.get("http://api.example.com/user/3")
@@ -1,3 +1,4 @@
1
1
  module ApiClient::Exceptions
2
+ autoload :Generic, 'api_client/exceptions/generic'
2
3
  autoload :NotFound, 'api_client/exceptions/not_found'
3
4
  end
@@ -0,0 +1,5 @@
1
+ class ApiClient::Exceptions::Generic < StandardError
2
+ def initialize
3
+ super("An Error Occurred!")
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
- class ApiClient::Exceptions::NotFound < StandardError
1
+ class ApiClient::Exceptions::NotFound < ApiClient::Exceptions::Generic
2
2
  def initialize
3
3
  super("The required url could not be found!")
4
4
  end
@@ -1,3 +1,3 @@
1
1
  module ApiClient
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -76,6 +76,7 @@ files:
76
76
  - api_client.gemspec
77
77
  - lib/api_client.rb
78
78
  - lib/api_client/exceptions.rb
79
+ - lib/api_client/exceptions/generic.rb
79
80
  - lib/api_client/exceptions/not_found.rb
80
81
  - lib/api_client/version.rb
81
82
  - spec/api_client_spec.rb
@@ -94,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  segments:
96
97
  - 0
97
- hash: -173903342828819103
98
+ hash: 3823240331575082275
98
99
  required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  none: false
100
101
  requirements:
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  version: '0'
104
105
  segments:
105
106
  - 0
106
- hash: -173903342828819103
107
+ hash: 3823240331575082275
107
108
  requirements: []
108
109
  rubyforge_project:
109
110
  rubygems_version: 1.8.24