saddle 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +5 -5
- data/README.md +39 -18
- data/lib/saddle/version.rb +1 -1
- data/saddle.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzU0YzZkNmQ2YmI0MTE3MGU4NDEwODFkZjhiMjNiMzAzNjNlZWVhZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTBmMWNkZGJmYjFhMGY2Njc4ZGUxYzZlZDljZDFmNDZkOTExY2QyOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjBmMWJhZDE2NjQ2ZTEzNTE5OGU1YTlkYjY4NjVkNTUyZDIyNmQ2NDkxODRk
|
10
|
+
NzVjYjAxOGM0YmMwMjAwYjdjZDViNTZlZTY0ZWI0NDJkZTgzMTZmOGQ0MjI2
|
11
|
+
NTAxY2RkZThiNDFjMjRlNThlZjRmOGQ0NjM1NTg5Y2ZiNmRmNGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDgxMWQ5MGFmYzFkNTEwYWZmMmEzYTdlZjA4MTViODZiNjkyNzIyOTk2MTEy
|
14
|
+
ZjYwMTg5ODJlZTEyYjY0MTdmZjcxNWExM2M1YzQ4M2JiYTM0ZWVhNDg1ZGJj
|
15
|
+
ZGZmOGFmZTk1Y2VkY2U3OGQ4ZjFjNDcxMjkxMWZjNGFhOTBlODI=
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,13 +4,13 @@ GEM
|
|
4
4
|
activesupport (3.2.13)
|
5
5
|
i18n (= 0.6.1)
|
6
6
|
multi_json (~> 1.0)
|
7
|
-
diff-lcs (1.2.
|
8
|
-
faraday (0.8.
|
7
|
+
diff-lcs (1.2.4)
|
8
|
+
faraday (0.8.7)
|
9
9
|
multipart-post (~> 1.1)
|
10
10
|
faraday_middleware (0.9.0)
|
11
11
|
faraday (>= 0.7.4, < 0.9)
|
12
12
|
i18n (0.6.1)
|
13
|
-
multi_json (1.7.
|
13
|
+
multi_json (1.7.3)
|
14
14
|
multipart-post (1.2.0)
|
15
15
|
rspec (2.13.0)
|
16
16
|
rspec-core (~> 2.13.0)
|
@@ -20,14 +20,14 @@ GEM
|
|
20
20
|
rspec-expectations (2.13.0)
|
21
21
|
diff-lcs (>= 1.1.3, < 2.0)
|
22
22
|
rspec-instafail (0.2.4)
|
23
|
-
rspec-mocks (2.13.
|
23
|
+
rspec-mocks (2.13.1)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
ruby
|
27
27
|
|
28
28
|
DEPENDENCIES
|
29
29
|
activesupport (>= 3.0)
|
30
|
-
faraday (~> 0.8.
|
30
|
+
faraday (~> 0.8.7)
|
31
31
|
faraday_middleware (~> 0.9.0)
|
32
32
|
rspec (~> 2.13.0)
|
33
33
|
rspec-instafail (~> 0.2)
|
data/README.md
CHANGED
@@ -2,38 +2,59 @@
|
|
2
2
|
|
3
3
|
Hey nerd! Wrangle your SOA!
|
4
4
|
|
5
|
+
Saddle makes writing service clients as easy as giving high fives. :hand:
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
It's a full-featured generic consumer layer for you to build API client implementations on top of.
|
7
|
+
It's a full-featured, generic consumer layer for you to build API client implementations with.
|
9
8
|
|
10
9
|
|
11
10
|
## about
|
12
11
|
|
13
12
|
Ok, I love high fives, but what does Saddle do for me?
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
Do you like sending your POSTs url-encoded? That's okay, I still love you anyways and Saddle has your back. Does your rampant OCD refuse to let you post in anything less structured than JSON? High five nerd, Saddle bleeds OCD. Just set your :post_style flag and fuhgedaboutit!
|
14
|
+
Saddle is a framework that makes it exceptionally easy to write HTTP API clients. It abstracts away a lot of the repetitive work and lets you focus on your business logic. It also provides a simple middleware interface that makes it easy to extend functionality.
|
18
15
|
|
19
|
-
|
16
|
+
Saddle enables you to create beautifully stable and functionaly API clients, in the fewest lines of code possible.
|
20
17
|
|
21
18
|
|
22
19
|
## features
|
23
|
-
|
24
|
-
|
25
|
-
*
|
26
|
-
*
|
20
|
+
|
21
|
+
### client
|
22
|
+
* Specifying default connection settings for your client makes usage simple
|
23
|
+
* Automatic call tree construction, based upon module/class namespace
|
24
|
+
* Easily integrate with logging systems (currently supports statsd & Airbrake)
|
25
|
+
* Support simple testing of your client
|
26
|
+
|
27
|
+
### requests
|
28
|
+
* Post urlencoded or JSON (handles multipart file posts as well)
|
29
|
+
* Auto-parse JSON responses
|
30
|
+
* Strictly enforce request timeouts (client-wide or endpoint specific timeouts)
|
31
|
+
|
32
|
+
### error handling
|
33
|
+
* Automatic retries with exponential backoff
|
34
|
+
* Turns 4xx and 5xx responses into exceptions
|
35
|
+
* If desired, silently return default values upon exception
|
27
36
|
|
28
37
|
|
29
38
|
## guide
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
|
40
|
+
### concrete example
|
41
|
+
[saddle-example](https://github.com/mLewisLogic/saddle-example)
|
42
|
+
|
43
|
+
### client construction
|
44
|
+
0. For the sake of cleanliness, pick a namespace that everything related to your client should live in. For this example, we'll use _SaddleExample_.
|
45
|
+
1. Inherit your client class (_SaddleExample::Client_)from _Saddle::Client_
|
46
|
+
2. Create an _endpoints_ directory at the same level as your client class file
|
47
|
+
3. Create endpoint classes in the _endpoints_ directory that inherit from _Saddle::TraversalEndpoint_ and are under the _SaddleExample::Endpoints_ namespace module
|
48
|
+
1. Give these endpoints methods that call _get_ or _post_ to perform the actual request
|
49
|
+
2. Their module/class namespace determines how they are accessed in the client's call tree. For example, the get_all() in _SaddleExample::Endpoints::Fish::Guppy_ would be accessed by:
|
50
|
+
|
51
|
+
client.fish.guppy.get_all()
|
52
|
+
|
53
|
+
4. Initialize an instance of your client. ex:
|
54
|
+
|
55
|
+
saddle_example_client = SaddleExample::Client.create
|
56
|
+
|
34
57
|
|
35
58
|
|
36
59
|
## todo
|
37
|
-
* xml posting
|
38
|
-
* xml parsing
|
39
|
-
* clean up custom middleware loading interface
|
60
|
+
* xml posting/parsing
|
data/lib/saddle/version.rb
CHANGED
data/saddle.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.email = 'mike@cleverkoala.com'
|
13
13
|
s.description = %q{Makes writing API clients as easy as giving high fives}
|
14
14
|
s.summary = %q{
|
15
|
-
A generic
|
15
|
+
A full-featured, generic consumer layer for you to build API client implementations with.
|
16
16
|
}
|
17
17
|
s.homepage = 'https://github.com/mLewisLogic/saddle'
|
18
18
|
s.license = 'MIT'
|
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
24
24
|
|
25
25
|
s.add_dependency 'activesupport', '>= 3.0'
|
26
|
-
s.add_dependency 'faraday', '~> 0.8.
|
26
|
+
s.add_dependency 'faraday', '~> 0.8.7'
|
27
27
|
s.add_dependency 'faraday_middleware', '~> 0.9.0'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Lewis
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.8.
|
34
|
+
version: 0.8.7
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.8.
|
41
|
+
version: 0.8.7
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: faraday_middleware
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,8 +108,8 @@ rubyforge_project:
|
|
108
108
|
rubygems_version: 2.0.3
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
|
-
summary: A generic
|
112
|
-
|
111
|
+
summary: A full-featured, generic consumer layer for you to build API client implementations
|
112
|
+
with.
|
113
113
|
test_files:
|
114
114
|
- spec/requester/get_spec.rb
|
115
115
|
- spec/requester/post_spec.rb
|