quinoa 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/changelog +7 -1
- data/lib/quinoa/service.rb +4 -3
- data/lib/quinoa/version.rb +1 -1
- data/spec/service_object_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f23933057a05ee09ae0bcc6f25c5e9066c8940da
|
4
|
+
data.tar.gz: e367d3d5866bbe7dc985e5a7c3440f0d8e502f91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f732054652c71e930a7800d908ec1f93dfb962e807fa239c193b15051a1a616df43fd03dc5cf9d4f9f545f19cdaaff651f991b2a80a6323ff7f65bde29e0751
|
7
|
+
data.tar.gz: 337b3c0b63984eaacd03bfc4b2814b05948f4bb13b82d3223ff96b5d7ca9af1d731715242279359a1d6d231354a03f686a2dc5fb410d0d25fd0cf21634ffc474
|
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
quinoa
|
2
2
|
=====
|
3
|
+
|
4
|
+
[](http://badge.fury.io/rb/quinoa)
|
5
|
+
[](https://travis-ci.org/camiloribeiro/quinoa)
|
6
|
+
[](https://codeclimate.com/github/camiloribeiro/quinoa)
|
7
|
+
[](https://gemnasium.com/camiloribeiro/quinoa)
|
8
|
+
[](https://coveralls.io/r/camiloribeiro/quinoa)
|
9
|
+
[](https://coderwall.com/camiloribeiro)
|
10
|
+
|
3
11
|

|
4
12
|
|
5
13
|
Quinoa is a service-object model framework built on top of rest-client (https://github.com/rest-client/rest-client).
|
data/changelog
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
0.0
|
1
|
+
0.0.4:
|
2
|
+
-
|
3
|
+
|
4
|
+
0.0.3: Authorization header in place
|
5
|
+
- Adding support to authorization header
|
6
|
+
|
7
|
+
0.0.2: Adding tests for all response codes
|
2
8
|
- addind tests to make sure that we do not automatically fails when a 40X
|
3
9
|
or 50X wild response code apears
|
4
10
|
|
data/lib/quinoa/service.rb
CHANGED
@@ -3,16 +3,17 @@ require "rest-client"
|
|
3
3
|
module Quinoa
|
4
4
|
class Service
|
5
5
|
|
6
|
-
attr_accessor :url, :content_type, :accept, :body, :response, :path
|
6
|
+
attr_accessor :url, :content_type, :accept, :body, :response, :path, :authorization
|
7
7
|
|
8
8
|
def initialize url
|
9
9
|
self.path = ""
|
10
|
+
self.authorization = ""
|
10
11
|
self.url = url
|
11
12
|
end
|
12
13
|
|
13
14
|
def post!
|
14
15
|
begin
|
15
|
-
self.response = RestClient.post self.url + self.path, self.body, :accept => self.accept, :content_type => self.content_type
|
16
|
+
self.response = RestClient.post self.url + self.path, self.body, :accept => self.accept, :content_type => self.content_type, :authorization => self.authorization
|
16
17
|
rescue => e
|
17
18
|
self.response = e.response
|
18
19
|
end
|
@@ -20,7 +21,7 @@ module Quinoa
|
|
20
21
|
|
21
22
|
def get!
|
22
23
|
begin
|
23
|
-
self.response = RestClient.get self.url + self.path, :accept => self.accept
|
24
|
+
self.response = RestClient.get self.url + self.path, :accept => self.accept, :authorization => self.authorization
|
24
25
|
rescue => e
|
25
26
|
self.response = e.response
|
26
27
|
end
|
data/lib/quinoa/version.rb
CHANGED
data/spec/service_object_spec.rb
CHANGED
@@ -12,6 +12,13 @@ describe Quinoa do
|
|
12
12
|
expect(@service.url).to eq "http://www.camiloribeiro.com"
|
13
13
|
end
|
14
14
|
|
15
|
+
it "Should have a authorizoation" do
|
16
|
+
expect(@service.content_type).to eq nil
|
17
|
+
|
18
|
+
@service.authorization = "token !#€%&/()="
|
19
|
+
expect(@service.authorization).to eq "token !#€%&/()="
|
20
|
+
end
|
21
|
+
|
15
22
|
it "Should have a Content-Type" do
|
16
23
|
expect(@service.content_type).to eq nil
|
17
24
|
|
@@ -48,6 +55,7 @@ describe Quinoa do
|
|
48
55
|
@service = Quinoa::Service.new "http://www.camiloribeiro.com"
|
49
56
|
@service.path = path
|
50
57
|
@service.content_type = "application/json"
|
58
|
+
@service.authorization = "token !#€%&/()="
|
51
59
|
@service.body = "simple body"
|
52
60
|
|
53
61
|
end
|
@@ -59,12 +67,14 @@ describe Quinoa do
|
|
59
67
|
expect(@service.response.headers[:accept]).to eq("application/xml")
|
60
68
|
expect(@service.response.headers[:content_type]).to eq("application/json")
|
61
69
|
expect(@service.response.body).to eq("simple response")
|
70
|
+
expect(@service.authorization).to eq "token !#€%&/()="
|
62
71
|
expect(@service.response.code).to eq(200)
|
63
72
|
|
64
73
|
# natural
|
65
74
|
expect(@service.response_accept).to eq("application/xml")
|
66
75
|
expect(@service.response_content_type).to eq("application/json")
|
67
76
|
expect(@service.response_body).to eq("simple response")
|
77
|
+
expect(@service.authorization).to eq "token !#€%&/()="
|
68
78
|
expect(@service.response_code).to eq(200)
|
69
79
|
end
|
70
80
|
|
@@ -75,12 +85,14 @@ describe Quinoa do
|
|
75
85
|
expect(@service.response.headers[:accept]).to eq("application/xml")
|
76
86
|
expect(@service.response.headers[:content_type]).to eq("application/json")
|
77
87
|
expect(@service.response.body).to eq("simple response")
|
88
|
+
expect(@service.authorization).to eq "token !#€%&/()="
|
78
89
|
expect(@service.response.code).to eq(200)
|
79
90
|
|
80
91
|
# natural
|
81
92
|
expect(@service.response_accept).to eq("application/xml")
|
82
93
|
expect(@service.response_content_type).to eq("application/json")
|
83
94
|
expect(@service.response_body).to eq("simple response")
|
95
|
+
expect(@service.authorization).to eq "token !#€%&/()="
|
84
96
|
expect(@service.response_code).to eq(200)
|
85
97
|
end
|
86
98
|
|