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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b938e12968e4999711be95c44a665f6163139170
4
- data.tar.gz: 387e243bd1aee8a36d04a3a89b1e9da15cf79338
3
+ metadata.gz: f23933057a05ee09ae0bcc6f25c5e9066c8940da
4
+ data.tar.gz: e367d3d5866bbe7dc985e5a7c3440f0d8e502f91
5
5
  SHA512:
6
- metadata.gz: c09655ca36ceeab843d0cffe5703366c783dce50fea9c9a5742d52aebed69b25d22de754ebd6a229af86f35dfb32fdbff7c324453dd1a832f6b3b96ed01f4c11
7
- data.tar.gz: 72933486efb627933b7d339f9223959194c0142114a45d98407793954a96122fda1af782ca945f584fdb4655f1d7337dfbd31558d3a6c50f7e06aba6651b9868
6
+ metadata.gz: 5f732054652c71e930a7800d908ec1f93dfb962e807fa239c193b15051a1a616df43fd03dc5cf9d4f9f545f19cdaaff651f991b2a80a6323ff7f65bde29e0751
7
+ data.tar.gz: 337b3c0b63984eaacd03bfc4b2814b05948f4bb13b82d3223ff96b5d7ca9af1d731715242279359a1d6d231354a03f686a2dc5fb410d0d25fd0cf21634ffc474
data/README.md CHANGED
@@ -1,5 +1,13 @@
1
1
  quinoa
2
2
  =====
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/quinoa.png)](http://badge.fury.io/rb/quinoa)
5
+ [![Build Status](https://travis-ci.org/camiloribeiro/quinoa.png?branch=master)](https://travis-ci.org/camiloribeiro/quinoa)
6
+ [![Code Climate](https://codeclimate.com/github/camiloribeiro/quinoa.png)](https://codeclimate.com/github/camiloribeiro/quinoa)
7
+ [![Dependency Status](https://gemnasium.com/camiloribeiro/quinoa.png)](https://gemnasium.com/camiloribeiro/quinoa)
8
+ [![Coverage Status](https://coveralls.io/repos/camiloribeiro/quinoa/badge.png)](https://coveralls.io/r/camiloribeiro/quinoa)
9
+ [![endorse](https://api.coderwall.com/camiloribeiro/endorsecount.png)](https://coderwall.com/camiloribeiro)
10
+
3
11
  ![alt tag](http://i.huffpost.com/gen/1821327/images/n-QUINOA-large570.jpg)
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,2: Adding tests for all response codes
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Quinoa
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quinoa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camilo Ribeiro