ppc 2.0.1 → 2.0.2

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: 9bc06d2e73e1d498cbf369c743fd5fdcb7015114
4
- data.tar.gz: 0cef07098f06fc77cd474a38629d759094463ef7
3
+ metadata.gz: 770db96f31a2d738d9f4918852017a4d9f2a6c30
4
+ data.tar.gz: 6f4da699a833ac12ba58d62dfe9afffacf2be467
5
5
  SHA512:
6
- metadata.gz: 793f672f0b5e77ce0ed4fda22c5bbb0b3155616f9e37d0b34b23431a6e7b33f2e72d9717de3c489283639d248998250c0c66d14a3911406de1e8c0e326990454
7
- data.tar.gz: 5990ce108ac0dc8b29d0a73e7bffb4be9f891dd13aba13e86d7655e2f70f8c7111b4986eb6a60bfaad27ca9b7313bf55b4fa1473972e8c63e10fb9a285325e16
6
+ metadata.gz: 0078aa233faf95529606a806343bdc53172e0feea53d090cac35553d2ea39a6083d36eacaa3407b64e829dee479564e01256a29b2a8bbb905f29738d3262ed16
7
+ data.tar.gz: 8bdb1364278a17a5b313ce3a69761adef394140591848b4003d0ef3ff19bc68d4a136d307dd54cdf3f6fab08b30bbc6d87bdd2a2ab9951a6391e2886f9fc764e
data/lib/ppc.rb CHANGED
@@ -3,7 +3,7 @@ require 'ppc/operation'
3
3
  require 'ppc/ext'
4
4
  module PPC
5
5
 
6
- VERSION = "2.0.1"
6
+ VERSION = "2.0.2"
7
7
 
8
8
  protected
9
9
  def print_debug(var,varname=nil)
@@ -35,7 +35,7 @@ module PPC
35
35
  result[:failure] = response['header']['failures']
36
36
  result[:result] ||= func[ response['body']['data'] ] rescue nil
37
37
  result[:rquota] = response['header']['rquota'] if response['header']['rquota']
38
- result[:no_quota] = (response['header']['failures']['code'] == '8501') rescue true
38
+ result[:no_quota] = (response['header']['failures']['code'] == '8501') rescue false
39
39
  result
40
40
  end
41
41
 
@@ -71,11 +71,11 @@ module PPC
71
71
  end
72
72
 
73
73
  def self.enable( auth, id )
74
- self.update(auth, {id: id[0], pause: "enable"})
74
+ self.update(auth, [{id: id[0], pause: "enable"}])
75
75
  end
76
76
 
77
77
  def self.pause( auth, id )
78
- self.update(auth, {id: id[0], pause: "pause"})
78
+ self.update(auth, [{id: id[0], pause: "pause"}])
79
79
  end
80
80
 
81
81
  end
@@ -58,10 +58,12 @@ module PPC
58
58
  def self.download_cpc_rank(auth, device = 0)
59
59
  result = get_cpc_rank(auth, device)
60
60
  rank_id = result[:result]
61
+ times = 0
61
62
  loop do
63
+ raise "The speed of get_status is too slow." if (times += 1) > 10
62
64
  status = get_cpc_rank_status(auth, rank_id)
63
65
  return get_cpc_rank_path(auth, rank_id) if status[:result] == '1'
64
- sleep 15
66
+ sleep 10
65
67
  end
66
68
  end
67
69
 
@@ -68,10 +68,12 @@ module PPC
68
68
  if response[:succ]
69
69
  id = response[:result]
70
70
  p "Got report id:" + id.to_s if debug
71
+ times = 0
71
72
  loop do
72
- sleep 2
73
+ raise "The speed of get_status is too slow." if (times += 1) > 10
73
74
  break if get_state( auth, id )[:result] == 'Finished'
74
75
  p "Report is not generated, waiting..." if debug
76
+ sleep 5
75
77
  end
76
78
 
77
79
  url = get_url( auth, id )[:result]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chienli Ma
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-08-23 00:00:00.000000000 Z
14
+ date: 2016-09-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty