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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b78d49b17ad0be12af621c07a26553f638575c5c843fe9abdc2ea9596eef8b5c
4
- data.tar.gz: e3d2ec651591c8628bc97a3600e869f6163bf92f7a870556ff116f89f1bb7cd0
3
+ metadata.gz: 0fe972466d027173a26383203659c6abe127ff7ccbc1df554552139a29519219
4
+ data.tar.gz: ec17b712765629da405be767d06dcff35e62cb4cd7dade13e56fe29810c4bc6c
5
5
  SHA512:
6
- metadata.gz: 6396a8164034ed980ce5eabc61dfd999d2fa1d03aa71c77cf86146b8b8bcd7d5fa18afecd1da6db3170489bf284538221f30a41c4d19b547be621af0453305df
7
- data.tar.gz: 1bc876605bf42a155d082f1c356fd4c6f1e5f2e39b6361606924a0f62980a81e320daf9953397f8cfecb8e2c6bf72eafc0d5a6959daccd8d66d43865a6620fe9
6
+ metadata.gz: 9bec3ede1f29cb6666484e38ab587aee7df85590194c1483983f9c851d64bef8c6f1afcdfe6cb4f2305cb278c2e0879304f59e50f8850bc2755a417eec5fff72
7
+ data.tar.gz: 8567e141b94b3fc01436ebd19e8b09ff2dc55c4b142ccd6259b5162f700ff7bad4ed31e64b93d8290d9916b8ea12bc7324bf931b1da4f7420036e8ce3a2656cb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- witei_web_api (0.1)
4
+ witei_web_api (0.1.1)
5
5
  activemodel (~> 5.0)
6
6
  mechanize (~> 2.7)
7
7
 
data/lib/witei_web_api.rb CHANGED
@@ -13,4 +13,8 @@ module WiteiWebApi
13
13
  require 'witei_web_api/house'
14
14
  require 'witei_web_api/contact'
15
15
  require 'witei_web_api/office_user'
16
+
17
+ class << self
18
+ attr_accessor :login, :password
19
+ end
16
20
  end
@@ -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
- do_login!(agent)
10
+ login!(agent)
18
11
  agent
19
12
  end
20
13
  end
21
14
 
22
- def self.do_login(agent, login, password)
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.do_login!(agent)
33
- unless do_login(agent, @@login, @@password)
25
+ def self.login!(agent)
26
+ unless login(agent, WiteiWebApi.login, WiteiWebApi.password)
34
27
  raise(LoginFailedException.new)
35
28
  end
36
29
  end
@@ -1,3 +1,3 @@
1
1
  module WiteiWebApi
2
- VERSION = '0.1'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: witei_web_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Polushkin