rakuten-de 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -2
- data/lib/rakuten/api_error.rb +3 -1
- data/lib/rakuten/request.rb +6 -2
- data/lib/rakuten/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
rakuten-de
|
2
2
|
==========
|
3
3
|
[![Build Status](https://secure.travis-ci.org/kayoom/rakuten-de.png)](http://travis-ci.org/kayoom/rakuten-de)
|
4
|
-
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/
|
4
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/kayoom/rakuten-de)
|
5
5
|
|
6
6
|
This is a simple gem to access the _rakuten.de_ REST-Api. You can find
|
7
7
|
the documentation for the Api itself
|
8
8
|
[here](http://webservice.rakuten.de/documentation/overview).
|
9
9
|
|
10
|
-
|
10
|
+
Requirements:
|
11
|
+
-------------
|
12
|
+
|
13
|
+
* Ruby 1.9.2 or 1.9.3, or Rubinius in 1.9 mode, or JRuby in 1.9 mode
|
14
|
+
* rest-client gem
|
15
|
+
* activesupport gem >= 3.1.0
|
16
|
+
|
17
|
+
Getting Started
|
11
18
|
-----------
|
12
19
|
|
13
20
|
Install _rakuten-de_ with `gem install rakuten-de` or add it to your
|
@@ -42,6 +49,16 @@ indicates an error. You can rescue generic API-Errors or only specified.
|
|
42
49
|
# ...
|
43
50
|
end
|
44
51
|
|
52
|
+
Changelog
|
53
|
+
---------
|
54
|
+
|
55
|
+
* 0.0.2:
|
56
|
+
* Using larger timeouts
|
57
|
+
* Subclasses of ApiError (e.g. ApiError[15]) now have a proper
|
58
|
+
class.name (-> ApiError::E15)
|
59
|
+
* 0.0.1:
|
60
|
+
* initial release
|
61
|
+
|
45
62
|
More to come ...
|
46
63
|
----------------
|
47
64
|
|
data/lib/rakuten/api_error.rb
CHANGED
@@ -18,7 +18,9 @@ module Rakuten
|
|
18
18
|
return self if code == 0
|
19
19
|
|
20
20
|
@errors_by_code ||= Hash.new do |hash, key|
|
21
|
-
|
21
|
+
error_class = Class.new(self).tap { |c| c.code = key }
|
22
|
+
const_set "E#{key}", error_class
|
23
|
+
hash[key] = error_class
|
22
24
|
end
|
23
25
|
|
24
26
|
@errors_by_code[code]
|
data/lib/rakuten/request.rb
CHANGED
@@ -20,11 +20,15 @@ module Rakuten
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def get
|
23
|
-
|
23
|
+
resource.get params: params
|
24
24
|
end
|
25
25
|
|
26
26
|
def post
|
27
|
-
|
27
|
+
resource.post params
|
28
|
+
end
|
29
|
+
|
30
|
+
def resource
|
31
|
+
@resource ||= RestClient::Resource.new(url, timeout: -1, open_timeout: 120)
|
28
32
|
end
|
29
33
|
|
30
34
|
def params
|
data/lib/rakuten/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakuten-de
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|