apidiesel 0.13 → 0.14

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: 9da8479808b1cfc506569b246e5dc7901d51d8be
4
- data.tar.gz: 853d657cf6fbb75d6b0518900aa1375813b5e035
3
+ metadata.gz: e0004f40573101e0eb5c1e4b5ade4b83db6a1cf1
4
+ data.tar.gz: 7da784a402c3518d5c08c0c22fc928478ba214b6
5
5
  SHA512:
6
- metadata.gz: bb0cbe4ab97aa00a61c4dba87f93a9238060bc3847a82226cf16ab3aeb5e3cd2dc8b1bdfab89b094e79fe0077553955b5a4e85b6e17d8274adedaca4740bf785
7
- data.tar.gz: af20d68bf9143dee06a5686f4c7092310e4f09b5a76ce2b10321310a6a97ae1cb79cd97034cf72b6466d795de0ddf1461d263a14bc0c42e0dc2e50bb5961034d
6
+ metadata.gz: 4daab8712e12862ae40666603b40b738044397df5868d4e578a9b127c8682062dfecc34709213d92e99db0b2e7e30ede9ea7f5e0776d7c4bd2f76ff3875c3226
7
+ data.tar.gz: 993684cd775ab09b38dfa218c2ae181da0a34cfe3d4ad5736d8879b5d0b1c9ebd851498910bf458a27f0c5390ffde9d25355f4e494b6e1eb7fb0b6fc6ffa04b3
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Apidiesel
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/apidiesel.svg)](https://badge.fury.io/rb/apidiesel) [![Dependency Status](https://gemnasium.com/janfoeh/apidiesel.svg)](https://gemnasium.com/janfoeh/apidiesel)
4
+
3
5
  Apidiesel is a DSL for building API clients. It is made to be highly readable,
4
6
  easily extensible and to assume as little as possible about your API.
5
7
 
@@ -24,31 +26,33 @@ Or install it yourself as:
24
26
  Apidiesel consists of three main parts: the base `Api`, one `Action` for each API
25
27
  endpoint and `Handler` plugins for processing incoming and outgoing data.
26
28
 
27
- module Actions
28
- class GetUsers < Apidiesel::Action
29
- url path: '/users'
30
-
31
- expects do
32
- string :firstname, optional: true
33
- string :lastname, optional: true
34
- boolean :active, default: true
35
- end
29
+ ```ruby
30
+ module Actions
31
+ class GetUsers < Apidiesel::Action
32
+ url path: '/users'
33
+
34
+ expects do
35
+ string :firstname, optional: true
36
+ string :lastname, optional: true
37
+ boolean :active, default: true
38
+ end
36
39
 
37
- responds_with do
38
- objects :users, wrapped_in: MyUserModel
39
- end
40
- end
40
+ responds_with do
41
+ objects :users, wrapped_in: MyUserModel
41
42
  end
43
+ end
44
+ end
42
45
 
43
- class Api < Apidiesel::Api
44
- url 'https://foo.example'
45
- http_method :post
46
+ class Api < Apidiesel::Api
47
+ url 'https://foo.example'
48
+ http_method :post
46
49
 
47
- register_actions
48
- end
50
+ register_actions
51
+ end
49
52
 
50
- api = Api.new
51
- api.get_users(firstname: 'Jane', lastname: 'Doe')
53
+ api = Api.new
54
+ api.get_users(firstname: 'Jane', lastname: 'Doe')
55
+ ```
52
56
 
53
57
  ## Development
54
58
 
@@ -3,7 +3,7 @@ module Apidiesel
3
3
  class InputError < Error; end
4
4
 
5
5
  class RequestError < Error
6
- attr_reader :request
6
+ attr_accessor :request
7
7
 
8
8
  def initialize(msg = nil, request = nil)
9
9
  @request = request
@@ -25,7 +25,8 @@ module Apidiesel
25
25
  begin
26
26
  @result = action.process_response(response_body)
27
27
  rescue ResponseError => e
28
- raise ResponseError.new(e.message, self)
28
+ e.request = self
29
+ raise e
29
30
  end
30
31
  end
31
32
 
@@ -1,3 +1,3 @@
1
1
  module Apidiesel
2
- VERSION = "0.13"
2
+ VERSION = "0.14"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apidiesel
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.13'
4
+ version: '0.14'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan-Christian Foeh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -207,4 +207,3 @@ signing_key:
207
207
  specification_version: 4
208
208
  summary: Build API clients through an expressive DSL
209
209
  test_files: []
210
- has_rdoc: