vpsa 0.0.2 → 0.0.3

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: a3b2f1b422fdf83a67ae33e4adb5500bf89cdab5
4
- data.tar.gz: e4acffe7bc8a452f75b642682cc8b97bb19a9f0f
3
+ metadata.gz: 023176512b7357012488f1394ed135925b7374cf
4
+ data.tar.gz: cd8720b6e766d132d2f9636782189cf985d50b84
5
5
  SHA512:
6
- metadata.gz: 8a58c951576baafa2b2d8823b955550c7a91da08743d9deda461d35d4b7490abb1a40bc9214a09fc6956eb91576727b1cd27b4c546380f9475ecb518f49db8b1
7
- data.tar.gz: 7346a6a8a84d9cba5a216e520aee99da0c3b35a50f7e4ddd4c980302574792c63ec0b5fb342cb16c790cf9e9feb3060effe7742caab6ece786fa4b5e9428c4df
6
+ metadata.gz: 2db4b57b61398ca98097de654734b0f612668802025c0c99100ace3ff60d8baea77901afcd3f7fe695cada1ec03d5b007eba27fd672bafbd7e1376148adcc805
7
+ data.tar.gz: b3146b36d3fce8bfa3a8f6280995efb598c0775341bdd2ce2c64976e56e6f6282267f7c53544c07e6ce8cf5529b135085e6db3ae0a89602b74da255f3f10d2d2
data/README.md CHANGED
@@ -34,6 +34,7 @@ With the client instance, you can access the following resources:
34
34
  * Entidades (client.entities) **Listing and finding**
35
35
  * Lançamentos Padrões (client.default_entries) **Listing and finding**
36
36
  * Provisões (client.provisions) **Only Creation**
37
+ * Dados Login (client.user_data)
37
38
 
38
39
  ## Using the resources
39
40
  ### Listing
@@ -65,6 +66,13 @@ It creates a new resource base on the information passed via Hash.
65
66
  Vpsa.new(YOUR_ACCESS_TOKEN).provisions.create({:"idLancamentoPadrao" => 3, :"idEntidade" => 1, :"idTerceiro" => 15, :"data" => "21-10-2012", :"valor" =>123.40, :"historico" => "histórico da provisão"})
66
67
  ```
67
68
 
69
+ ### Getting User Data
70
+ You can get the token owner information by calling the following method:
71
+
72
+ ```ruby
73
+ Vpsa.new(YOUR_ACCESS_TOKEN).user_data.get
74
+ ```
75
+
68
76
  ### Reading the response
69
77
  All methods return an Vpsa::Client::Response object. This objects contains the following attributes:
70
78
 
@@ -0,0 +1,11 @@
1
+ module Vpsa
2
+ module Api
3
+ class UserData < Client
4
+ base_uri "https://www.vpsa.com.br/apps/api/dados-login"
5
+
6
+ def get
7
+ return parse_response(self.class.get("/", :body => build_body, :headers => header))
8
+ end
9
+ end
10
+ end
11
+ end
data/lib/vpsa/client.rb CHANGED
@@ -8,7 +8,7 @@ module Vpsa
8
8
  default_options.update(verify: false)
9
9
  parser Proc.new {|b| JSON.parse(b) rescue b}
10
10
 
11
- require_all 'vpsa/api', 'third_parties', 'entities', 'default_entries', 'provisions'
11
+ require_all 'vpsa/api', 'third_parties', 'entities', 'default_entries', 'provisions', 'user_data'
12
12
 
13
13
  attr_accessor :access_token
14
14
 
@@ -33,6 +33,10 @@ module Vpsa
33
33
  Vpsa::Api::Provisions.new(@access_token)
34
34
  end
35
35
 
36
+ def user_data
37
+ Vpsa::Api::UserData.new(@access_token)
38
+ end
39
+
36
40
  protected
37
41
  def header
38
42
  {"Content-Type" => "application/json", "Accept" => "application/json"}
data/lib/vpsa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vpsa
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Vpsa::Api::UserData do
4
+ let(:header) {{"Content-Type" => "application/json", "Accept" => "application/json"}}
5
+
6
+ describe "finding" do
7
+ before(:each) do
8
+ stub_request(:get, "https://www.vpsa.com.br/apps/api/dados-login/").to_return(:status => 200)
9
+ end
10
+
11
+ it "should issue a get to the dados-login url" do
12
+ expect(Vpsa::Api::UserData).to receive(:get).with("/", :body => {:token => "abc"}.to_json, :headers => header).and_call_original
13
+
14
+ Vpsa.new("abc").user_data.get
15
+ end
16
+ end
17
+ end
@@ -16,4 +16,8 @@ RSpec.describe Vpsa::Client do
16
16
  it "should return a new Vpsa::Api::Provisions" do
17
17
  expect(Vpsa.new("abc").provisions.class).to eq(Vpsa::Api::Provisions)
18
18
  end
19
+
20
+ it "should return a new Vpsa::Api::UserData" do
21
+ expect(Vpsa.new("abc").user_data.class).to eq(Vpsa::Api::UserData)
22
+ end
19
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vpsa
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
  - Gustavo Berdugo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -57,6 +57,7 @@ files:
57
57
  - lib/vpsa/api/entities.rb
58
58
  - lib/vpsa/api/provisions.rb
59
59
  - lib/vpsa/api/third_parties.rb
60
+ - lib/vpsa/api/user_data.rb
60
61
  - lib/vpsa/client.rb
61
62
  - lib/vpsa/entity/base.rb
62
63
  - lib/vpsa/init_from_hash.rb
@@ -70,6 +71,7 @@ files:
70
71
  - spec/vpsa/api/entities_spec.rb
71
72
  - spec/vpsa/api/provisions_spec.rb
72
73
  - spec/vpsa/api/third_parties_spec.rb
74
+ - spec/vpsa/api/user_data_spec.rb
73
75
  - spec/vpsa/client_spec.rb
74
76
  - spec/vpsa_spec.rb
75
77
  - vpsa.gemspec
@@ -103,6 +105,7 @@ test_files:
103
105
  - spec/vpsa/api/entities_spec.rb
104
106
  - spec/vpsa/api/provisions_spec.rb
105
107
  - spec/vpsa/api/third_parties_spec.rb
108
+ - spec/vpsa/api/user_data_spec.rb
106
109
  - spec/vpsa/client_spec.rb
107
110
  - spec/vpsa_spec.rb
108
111
  has_rdoc: