passaporteweb-client 0.3.0 → 0.4.0

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: e512bf6c46aaa47a2611aa97e2ec6da1d9693c82
4
- data.tar.gz: 77f311e1cb432a847205d35da67dd2f0d6e093db
3
+ metadata.gz: 9ea538a5f53178a9feab51922efa8c5237985879
4
+ data.tar.gz: 7e43dc7d3b5874f268b41cd2c5625b413c51ec13
5
5
  SHA512:
6
- metadata.gz: 927f522260f75399053c80f494412234cb7bfd674109cd62de4cb1bf26c8f75b15ef43a5b47eff8a4b3bd5c39948d74eb7d8c623310f45281c760083114a3ecd
7
- data.tar.gz: 4b9c77c2fcc5015c59443d4e07fede93970674a916751df8c5fae7a4ffb8cabc7c3442adbda46744f785f47a7547d35dc9e414dd3d85d69064fbaddd7e82e63f
6
+ metadata.gz: 371819cdd1a0ddd3aeaef822fd1903f6fcaacb395241e2f7a2862e47d7790b9a94e425fb8e0bb4e566bbf1cee5d6469d6056bdfbeddf12add166b5556799dafe
7
+ data.tar.gz: d3cf89cf137dcda88d620e39fef46f025ccb32bfcb16794c6a1fcea348140876c6172367cebd3ad05e4a724b0fede7320c4d53a5b2028f11ae6da28f7cac90ea
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.6
4
- - 2.2.2
3
+ - 2.3.4
4
+ - 2.2.7
@@ -1,77 +1,78 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passaporteweb-client (0.3.0)
4
+ passaporteweb-client (0.4.0)
5
5
  multi_json (~> 1.11)
6
6
  rest-client (~> 1.8.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.4.0)
12
- awesome_print (1.6.1)
13
- byebug (8.2.1)
14
- coderay (1.1.0)
15
- coveralls (0.8.10)
16
- json (~> 1.8)
17
- rest-client (>= 1.6.8, < 2)
18
- simplecov (~> 0.11.0)
11
+ addressable (2.5.1)
12
+ public_suffix (~> 2.0, >= 2.0.2)
13
+ awesome_print (1.8.0)
14
+ byebug (9.0.6)
15
+ coderay (1.1.1)
16
+ coveralls (0.8.21)
17
+ json (>= 1.8, < 3)
18
+ simplecov (~> 0.14.1)
19
19
  term-ansicolor (~> 1.3)
20
- thor (~> 0.19.1)
21
- tins (~> 1.6.0)
20
+ thor (~> 0.19.4)
21
+ tins (~> 1.6)
22
22
  crack (0.4.3)
23
23
  safe_yaml (~> 1.0.0)
24
- diff-lcs (1.2.5)
24
+ diff-lcs (1.3)
25
25
  docile (1.1.5)
26
- domain_name (0.5.25)
26
+ domain_name (0.5.20170404)
27
27
  unf (>= 0.0.5, < 1.0.0)
28
- http-cookie (1.0.2)
28
+ http-cookie (1.0.3)
29
29
  domain_name (~> 0.5)
30
- json (1.8.3)
30
+ json (2.1.0)
31
31
  method_source (0.8.2)
32
- mime-types (2.99)
33
- multi_json (1.11.2)
32
+ mime-types (2.99.3)
33
+ multi_json (1.12.1)
34
34
  netrc (0.11.0)
35
- pry (0.10.3)
35
+ pry (0.10.4)
36
36
  coderay (~> 1.1.0)
37
37
  method_source (~> 0.8.1)
38
38
  slop (~> 3.4)
39
- pry-byebug (3.3.0)
40
- byebug (~> 8.0)
39
+ pry-byebug (3.4.2)
40
+ byebug (~> 9.0)
41
41
  pry (~> 0.10)
42
- rake (10.4.2)
43
- rdoc (4.2.0)
42
+ public_suffix (2.0.5)
43
+ rake (12.0.0)
44
+ rdoc (5.1.0)
44
45
  rest-client (1.8.0)
45
46
  http-cookie (>= 1.0.2, < 2.0)
46
47
  mime-types (>= 1.16, < 3.0)
47
48
  netrc (~> 0.7)
48
- rspec (3.3.0)
49
- rspec-core (~> 3.3.0)
50
- rspec-expectations (~> 3.3.0)
51
- rspec-mocks (~> 3.3.0)
52
- rspec-core (3.3.2)
53
- rspec-support (~> 3.3.0)
54
- rspec-expectations (3.3.1)
49
+ rspec (3.6.0)
50
+ rspec-core (~> 3.6.0)
51
+ rspec-expectations (~> 3.6.0)
52
+ rspec-mocks (~> 3.6.0)
53
+ rspec-core (3.6.0)
54
+ rspec-support (~> 3.6.0)
55
+ rspec-expectations (3.6.0)
55
56
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.3.0)
57
- rspec-mocks (3.3.2)
57
+ rspec-support (~> 3.6.0)
58
+ rspec-mocks (3.6.0)
58
59
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.3.0)
60
- rspec-support (3.3.0)
60
+ rspec-support (~> 3.6.0)
61
+ rspec-support (3.6.0)
61
62
  safe_yaml (1.0.4)
62
- simplecov (0.11.1)
63
+ simplecov (0.14.1)
63
64
  docile (~> 1.1.0)
64
- json (~> 1.8)
65
+ json (>= 1.8, < 3)
65
66
  simplecov-html (~> 0.10.0)
66
- simplecov-html (0.10.0)
67
+ simplecov-html (0.10.1)
67
68
  slop (3.6.0)
68
- term-ansicolor (1.3.2)
69
+ term-ansicolor (1.6.0)
69
70
  tins (~> 1.0)
70
- thor (0.19.1)
71
- tins (1.6.0)
71
+ thor (0.19.4)
72
+ tins (1.15.0)
72
73
  unf (0.1.4)
73
74
  unf_ext
74
- unf_ext (0.0.7.1)
75
+ unf_ext (0.0.7.4)
75
76
  vcr (2.9.3)
76
77
  webmock (1.9.3)
77
78
  addressable (>= 2.2.7)
@@ -81,18 +82,18 @@ PLATFORMS
81
82
  ruby
82
83
 
83
84
  DEPENDENCIES
84
- awesome_print (~> 1.6)
85
+ awesome_print (~> 1.8)
85
86
  bundler (~> 1.9)
86
87
  coveralls (~> 0.8)
87
- json (= 1.8.3)
88
+ json (~> 2.1)
88
89
  passaporteweb-client!
89
- pry-byebug (~> 3.1)
90
- rake (~> 10.4)
91
- rdoc (~> 4.2)
92
- rspec (~> 3.3.0)
93
- simplecov (~> 0.10)
90
+ pry-byebug (~> 3.4)
91
+ rake (~> 12.0)
92
+ rdoc (~> 5.1)
93
+ rspec (~> 3.6)
94
+ simplecov (~> 0.14)
94
95
  vcr (~> 2.4)
95
96
  webmock (~> 1.9.3)
96
97
 
97
98
  BUNDLED WITH
98
- 1.10.6
99
+ 1.15.1
@@ -68,7 +68,7 @@ This gem supports Ruby 2.1 and Ruby 2.2.
68
68
  * {Perfil}[https://app.passaporteweb.com.br/static/docs/perfil.html]
69
69
  * {GET /accounts/api/identities/:uuid/profile/}[http://myfreecomm.github.io/passaporte-web/pweb/api/usuarios.html#get-accounts-api-identities-uuid-profile] ==> PassaporteWeb::Identity#profile
70
70
  * {GET /profile/api/info/:uuid/}[https://app.passaporteweb.com.br/static/docs/perfil.html#get-profile-api-info-uuid] ==> (deprecated, not going to be implemented)
71
- * {GET /profile/api/info/?email=:email}[https://app.passaporteweb.com.br/static/docs/perfil.html#get-profile-api-info-email-email] ==> (deprecated, not going to be implemented)
71
+ * {GET /profile/api/info/?email=:email}[https://app.passaporteweb.com.br/static/docs/perfil.html#get-profile-api-info-email-email] ==> PassaporteWeb::Identity.profile_by_email (deprecated)
72
72
  * {PUT /profile/api/info/:uuid/}[https://app.passaporteweb.com.br/static/docs/perfil.html#put-profile-api-info-uuid] ==> (deprecated, not going to be implemented)
73
73
 
74
74
  === Configuration
@@ -72,6 +72,20 @@ module PassaporteWeb
72
72
  load_identity(attributes_hash)
73
73
  end
74
74
 
75
+ # Finds an Profile by it's email (primary or secondary) using the ***DEPRECATED*** profile endpoint. Returns
76
+ # the Identity instance, with the primary email used by the Identity.
77
+ # Raises a <tt>RestClient::ResourceNotFound</tt> exception if no
78
+ # Identity exists with the supplied email.
79
+ #
80
+ # API method: <tt>GET /profile/api/info/?email=:email</tt>
81
+ #
82
+ # API documentation: http://myfreecomm.github.io/passaporte-web/pweb/api/perfil.html#get-profile-api-info-email-email
83
+ def self.profile_by_email(email)
84
+ response = Http.get("/profile/api/info/", email: email)
85
+ attributes_hash = MultiJson.decode(response.body)
86
+ load_identity(attributes_hash)
87
+ end
88
+
75
89
  # Checks if an Identity exists on PassaporteWeb and if the password is correct. Returns an instance of
76
90
  # Identity for the supplied email if the password is correct (although with only basic attributes set).
77
91
  # Returns <tt>false</tt> if the password is wrong or if no Identity exists on PassaporteWeb with
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module PassaporteWeb
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
@@ -27,14 +27,14 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "multi_json", "~> 1.11"
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 1.9"
30
- spec.add_development_dependency "rake", "~> 10.4"
31
- spec.add_development_dependency 'rdoc', '~> 4.2'
32
- spec.add_development_dependency "rspec", "~> 3.3.0"
30
+ spec.add_development_dependency "rake", "~> 12.0"
31
+ spec.add_development_dependency "rdoc", "~> 5.1"
32
+ spec.add_development_dependency "rspec", "~> 3.6"
33
33
  spec.add_development_dependency "vcr", "~> 2.4"
34
34
  spec.add_development_dependency "webmock", "~> 1.9.3"
35
- spec.add_development_dependency "pry-byebug", "~> 3.1"
36
- spec.add_development_dependency "awesome_print", "~> 1.6"
37
- spec.add_development_dependency "simplecov", "~> 0.10"
35
+ spec.add_development_dependency "pry-byebug", "~> 3.4"
36
+ spec.add_development_dependency "awesome_print", "~> 1.8"
37
+ spec.add_development_dependency "simplecov", "~> 0.14"
38
38
  spec.add_development_dependency "coveralls", "~> 0.8"
39
- spec.add_development_dependency "json", "1.8.3"
39
+ spec.add_development_dependency "json", "~> 2.1"
40
40
  end
@@ -219,6 +219,31 @@ describe PassaporteWeb::Identity do
219
219
  end
220
220
  end
221
221
 
222
+ # DEPRECATED
223
+ describe ".profile_by_email", vcr: true do
224
+ let(:update_info_url) do
225
+ "https://sandbox.app.passaporteweb.com.br/accounts/api/identities/5e32f927-c4ab-404e-a91c-b2abc05afb56/"
226
+ end
227
+
228
+ it "should find the requested profile by email" do
229
+ identity = described_class.profile_by_email("teste@teste.com")
230
+ expect(identity).to be_instance_of(described_class)
231
+ expect(identity.uuid).to eq("5e32f927-c4ab-404e-a91c-b2abc05afb56")
232
+ expect(identity).to be_persisted
233
+ expect(identity.email).to eq('teste@teste.com')
234
+ expect(identity.update_info_url).to eq(update_info_url)
235
+ expect(identity.accounts.size).to eq(8)
236
+ expect(identity.accounts.map { |a| a["expiration"] }.uniq).to eq([nil])
237
+ expect(identity.services.size).to eq(1)
238
+ expect(identity.services.keys).to eq(["identity_client"])
239
+ end
240
+ it "should raise an error if no profiles exist with that email" do
241
+ expect do
242
+ described_class.find("invalid@email.com")
243
+ end.to raise_error(RestClient::ResourceNotFound, "404 Resource Not Found")
244
+ end
245
+ end
246
+
222
247
  describe ".authenticate", vcr: true do
223
248
  it "should return an instance of Identity if the password is correct for the given email" do
224
249
  identity = described_class.authenticate('teste@teste.com', '123456')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passaporteweb-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Tassinari de Oliveira
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-08 00:00:00.000000000 Z
13
+ date: 2017-07-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -60,42 +60,42 @@ dependencies:
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '10.4'
63
+ version: '12.0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '10.4'
70
+ version: '12.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rdoc
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '4.2'
77
+ version: '5.1'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '4.2'
84
+ version: '5.1'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rspec
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: 3.3.0
91
+ version: '3.6'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: 3.3.0
98
+ version: '3.6'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: vcr
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -130,42 +130,42 @@ dependencies:
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '3.1'
133
+ version: '3.4'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - "~>"
139
139
  - !ruby/object:Gem::Version
140
- version: '3.1'
140
+ version: '3.4'
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: awesome_print
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - "~>"
146
146
  - !ruby/object:Gem::Version
147
- version: '1.6'
147
+ version: '1.8'
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: '1.6'
154
+ version: '1.8'
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: simplecov
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - "~>"
160
160
  - !ruby/object:Gem::Version
161
- version: '0.10'
161
+ version: '0.14'
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - "~>"
167
167
  - !ruby/object:Gem::Version
168
- version: '0.10'
168
+ version: '0.14'
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: coveralls
171
171
  requirement: !ruby/object:Gem::Requirement
@@ -184,16 +184,16 @@ dependencies:
184
184
  name: json
185
185
  requirement: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - '='
187
+ - - "~>"
188
188
  - !ruby/object:Gem::Version
189
- version: 1.8.3
189
+ version: '2.1'
190
190
  type: :development
191
191
  prerelease: false
192
192
  version_requirements: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - '='
194
+ - - "~>"
195
195
  - !ruby/object:Gem::Version
196
- version: 1.8.3
196
+ version: '2.1'
197
197
  description: A Ruby client for the PassaporteWeb REST API
198
198
  email:
199
199
  - rodrigo@pittlandia.net
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  version: '0'
259
259
  requirements: []
260
260
  rubyforge_project:
261
- rubygems_version: 2.4.5.1
261
+ rubygems_version: 2.5.2
262
262
  signing_key:
263
263
  specification_version: 4
264
264
  summary: 'A Ruby client for the PassaporteWeb REST API: https://app.passaporteweb.com.br/static/docs/'