goodbye_chatwork 0.0.7 → 0.0.8

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: be2e04656be0d0115369963e44d494eb46e77cad
4
- data.tar.gz: 80b5283a0d1a846adc01fbefb77a45bd7bf54489
3
+ metadata.gz: 1a52baa1607adeebca099db7643c7f7236e60678
4
+ data.tar.gz: 208a23f68e5fb7c10353ea0361961d530dbc0c31
5
5
  SHA512:
6
- metadata.gz: 07c060c93f704bbd4dc7178b2a3ac9fc1cb18d6980175e8aaae3460497c51064bd092892a0b9490f43115a16a635c5cc178d40cf101b94838df69ead74d81b7e
7
- data.tar.gz: f95f230baba7c3fe9424860267c00bf04d0ff1bc9cd51b6c6876bc530d6d30f4770e4784a6dfacef00208c378b292e611d5cd8da02058c710a1fc60b539cdde8
6
+ metadata.gz: 06dbddef9aaeed8fcf6117e3e0c89686f49bfaec9d961513dd2ed7c1a38f83ab23c800dc9c4aeadb91be3b0177e70565152eb99e55b6bb883002487873db4491
7
+ data.tar.gz: a40d445e771cccb01407853456c6f02728260bcf6c08888aa8961c23f14db74c18e4d547eaf7893199c9d918de10aa2d561d70915f467637e7cb281ab05da2e6
@@ -40,41 +40,23 @@ module GoodbyeChatwork
40
40
  @myid = r.body.match(/var MYID *= *'(.+)'/).to_a[1]
41
41
  raise 'no token' unless @token
42
42
  self.init_load
43
- self.get_account_info
44
43
  self
45
44
  end
46
45
 
47
46
  def init_load
48
47
  self.info "load initial data..."
49
- r = @client.get "/gateway.php?cmd=init_load&myid=#{@myid}&_v=1.80a&_av=4&_t=#{@token}&ln=ja&rid=0&type=&new=1"
48
+ r = @client.get "/gateway.php?cmd=init_load&myid=#{@myid}&_v=1.80a&_av=5&_t=#{@token}&ln=ja&rid=0&type=&new=1"
50
49
  self.wait
51
50
  d = JSON.parse(r.body)['result']
52
51
  @contacts = d['contact_dat']
53
52
  @rooms = d['room_dat']
54
53
  end
55
54
 
56
- def get_account_info
57
- aids = @contacts.values.map { |i| i['aid'] }
58
- mids = @rooms.values.map { |i| i['m'].keys }.flatten.uniq.map(&:to_i)
59
- diff_ids = (mids - aids).sort
60
- pdata = 'pdata=' + JSON.generate({ aid: diff_ids, get_private_data: 0 })
61
- self.info 'load account info'
62
- r = @client.post "/gateway.php?cmd=get_account_info&myid=#{@myid}&_v=1.80a&_av=4&_t=#{@token}&ln=ja", pdata
63
- self.wait
64
- begin
65
- d = JSON.parse(r.body)['result']['account_dat']
66
- @contacts.merge!(d)
67
- rescue Exception => e
68
- self.info e.to_s
69
- end
70
- self.wait
71
- end
72
-
73
55
  def old_chat room_id, first_chat_id = 0
74
56
  self.info "get old chat #{first_chat_id}- ..."
75
57
  begin
76
58
  res = @client.get do |req|
77
- req.url "#{@client.url_prefix.to_s}gateway.php?cmd=load_old_chat&myid=#{@myid}&_v=1.80a&_av=4&_t=#{@token}&ln=ja&room_id=#{room_id}&last_chat_id=0&first_chat_id=#{first_chat_id}&jump_to_chat_id=0&unread_num=0&file=1&desc=1"
59
+ req.url "#{@client.url_prefix.to_s}gateway.php?cmd=load_old_chat&myid=#{@myid}&_v=1.80a&_av=5&_t=#{@token}&ln=ja&room_id=#{room_id}&last_chat_id=0&first_chat_id=#{first_chat_id}&jump_to_chat_id=0&unread_num=0&file=1&desc=1"
78
60
  req.options.timeout = 5 # open/read timeout in seconds
79
61
  req.options.open_timeout = 1000 # connection open timeout in seconds
80
62
  end
@@ -1,3 +1,3 @@
1
1
  module GoodbyeChatwork
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodbye_chatwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - swdyh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-23 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler