witei_web_api 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/witei_web_api.rb +4 -0
- data/lib/witei_web_api/base.rb +4 -11
- data/lib/witei_web_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fe972466d027173a26383203659c6abe127ff7ccbc1df554552139a29519219
|
4
|
+
data.tar.gz: ec17b712765629da405be767d06dcff35e62cb4cd7dade13e56fe29810c4bc6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bec3ede1f29cb6666484e38ab587aee7df85590194c1483983f9c851d64bef8c6f1afcdfe6cb4f2305cb278c2e0879304f59e50f8850bc2755a417eec5fff72
|
7
|
+
data.tar.gz: 8567e141b94b3fc01436ebd19e8b09ff2dc55c4b142ccd6259b5162f700ff7bad4ed31e64b93d8290d9916b8ea12bc7324bf931b1da4f7420036e8ce3a2656cb
|
data/Gemfile.lock
CHANGED
data/lib/witei_web_api.rb
CHANGED
data/lib/witei_web_api/base.rb
CHANGED
@@ -2,24 +2,17 @@ module WiteiWebApi
|
|
2
2
|
class Base
|
3
3
|
include ActiveModel::AttributeAssignment
|
4
4
|
|
5
|
-
class << self
|
6
|
-
attr_accessor :login, :password
|
7
|
-
end
|
8
|
-
|
9
|
-
@@login = ENV['login']
|
10
|
-
@@password = ENV['password']
|
11
|
-
|
12
5
|
private
|
13
6
|
|
14
7
|
def self.agent
|
15
8
|
@agent ||= begin
|
16
9
|
agent = WiteiWebApi::Agent.new
|
17
|
-
|
10
|
+
login!(agent)
|
18
11
|
agent
|
19
12
|
end
|
20
13
|
end
|
21
14
|
|
22
|
-
def self.
|
15
|
+
def self.login(agent, login, password)
|
23
16
|
page = agent.get 'https://witei.com/pro/accounts/login/?next=/pro/agencies/dashboard/'
|
24
17
|
|
25
18
|
form = page.form_with class: 'form-horizontal'
|
@@ -29,8 +22,8 @@ module WiteiWebApi
|
|
29
22
|
x.uri.path == '/pro/agencies/dashboard/'
|
30
23
|
end
|
31
24
|
|
32
|
-
def self.
|
33
|
-
unless
|
25
|
+
def self.login!(agent)
|
26
|
+
unless login(agent, WiteiWebApi.login, WiteiWebApi.password)
|
34
27
|
raise(LoginFailedException.new)
|
35
28
|
end
|
36
29
|
end
|