twilio_ruby_wrapper 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: 924bffada1a1256c22c4945fac3d52c413bbc993
4
- data.tar.gz: cf435476fa8f3046de7ccc2b54c37822c026ae9e
3
+ metadata.gz: f6eb10bfa327be622857b079d462bbc8007327fb
4
+ data.tar.gz: 4614314bd49fc7d6a8634639b05029264e5c5a79
5
5
  SHA512:
6
- metadata.gz: eb25c23fec971709742d97fd5c429ae9acffcaad86c8fb4b04df43d902d720b9de34e34dabeffd6256d48092a09678c91de8e13e6e32492eaac2bb65b4f6f728
7
- data.tar.gz: 04c7c9ff241abc11fdf5919105a8fd6d9e7b6497aee467799c386d59accfd707e454b7151f27e1a2a878959b9def919b0a2086a992c2c6f2e27b127e567e81e4
6
+ metadata.gz: f458c145c1b327615422a52983e75077d6716ecc676fb42a793f9dadd0a24ff61899cacc0611e62231607658c139135ef1af43a6d6613824bac104e8bb9cb182
7
+ data.tar.gz: d5b596807738aa24d0bc1e35754bfb66cfca9e4938b154ae5e594ffa24b34f96ec56396401a6f98a9d2363d49348217edd559805eb51569b6ce2f53cbf3d6ff0
data/README.md CHANGED
@@ -34,7 +34,7 @@ queues = queue_condition.condition(:gt).where(date_updated: "2017-05-31 0:0:0")
34
34
  TwilioRubyWrapper::CallCondition.set_twilio_params(account_sid: Rails.application.secrets.twilio_account_sid, auth_token: Rails.application.secrets.twilio_auth_token)
35
35
  call_condition = TwilioRubyWrapper::CallCondition.new
36
36
  call = call_condition.find_by(from: "PHONE NUMBER")
37
- calls = call_condition.filter(:"start_time>" => "2017-05-32").condition(:eq).where(from: "PHONE NUMBER")
37
+ calls = call_condition.filter(start_time_after: "2017-05-31").condition(:eq).where(from: "PHONE NUMBER")
38
38
  ```
39
39
 
40
40
  ## Development
@@ -10,7 +10,7 @@ module TwilioRubyWrapper
10
10
  true
11
11
  end
12
12
 
13
- def initialize(condition: nil, filter: {}, page_number: 0, page_size: 50)
13
+ def initialize(condition: nil, filter: {}, page_number: 0, page_size: nil)
14
14
  @condition = condition
15
15
  @filter = filter
16
16
  @page_number = page_number
@@ -28,15 +28,10 @@ module TwilioRubyWrapper
28
28
  key = hash.keys.first
29
29
  value = build_value(hash[key], key)
30
30
 
31
- params = {page: @page_number, page_size: @page_size}
31
+ params = {page_size: @page_size}
32
32
  params.merge!(@filter) unless @filter.empty?
33
33
  twilio_calls = @twilio_call_list.list(params)
34
- calls = []
35
- until twilio_calls.empty? do
36
- sub_calls = twilio_calls.select{|twilio_call| @condition[value][build_value(twilio_call.send(key), key)] }.map{|twilio_call| Call.new(twilio_call) }
37
- calls.concat(sub_calls) unless sub_calls.empty?
38
- twilio_calls = twilio_calls.next_page
39
- end
34
+ calls = twilio_calls.select{|twilio_call| @condition[value][build_value(twilio_call.send(key), key)] }.map{|twilio_call| Call.new(twilio_call) }
40
35
 
41
36
  calls
42
37
  end
@@ -53,15 +48,10 @@ module TwilioRubyWrapper
53
48
  key = hash.keys.first
54
49
  value = build_value(hash[key], key)
55
50
 
56
- params = {page: @page_number, page_size: @page_size}
51
+ params = {page_size: @page_size}
57
52
  params.merge!(@filter) unless @filter.empty?
58
53
  twilio_calls = @twilio_call_list.list(params)
59
- call = nil
60
- until twilio_calls.empty? do
61
- call = twilio_calls.select {|twilio_call| @condition[value][build_value(twilio_call.send(key), key)] }.map{|twilio_call| Call.new(twilio_call) }.first
62
- break call.nil?
63
- twilio_calls = twilio_calls.next_page
64
- end
54
+ call = twilio_calls.select {|twilio_call| @condition[value][build_value(twilio_call.send(key), key)] }.map{|twilio_call| Call.new(twilio_call) }.first
65
55
 
66
56
  call
67
57
  end
@@ -117,7 +107,7 @@ module TwilioRubyWrapper
117
107
 
118
108
  def set_twilio_account
119
109
  @twilio_client = Twilio::REST::Client.new(@@account_sid, @@auth_token)
120
- @twilio_call_list = @twilio_client.account.calls
110
+ @twilio_call_list = @twilio_client.api.account.calls
121
111
  end
122
112
  end
123
113
  end
@@ -25,7 +25,7 @@ module TwilioRubyWrapper
25
25
 
26
26
  def calls
27
27
  @queue_instance.members.list().map do |member|
28
- Call.new(@twilio_client.account.calls.get(member.call_sid))
28
+ Call.new(@twilio_client.api.v2010.account.calls(member.call_sid).fetch)
29
29
  end
30
30
  end
31
31
  end
@@ -27,14 +27,9 @@ module TwilioRubyWrapper
27
27
  key = hash.keys.first
28
28
  value = build_value(hash[key], key)
29
29
 
30
- params = {page: @page_number, page_size: @page_size}
30
+ params = {page_size: @page_size}
31
31
  twilio_queues = @twilio_queue_list.list(params)
32
- queues = []
33
- until twilio_queues.empty? do
34
- sub_queues = twilio_queues.select{|twilio_queue| @condition[value][build_value(twilio_queue.send(key), key)] }.map{|twilio_queue| Queue.new(twilio_queue) }
35
- queues.concat(sub_queues) unless sub_queues.empty?
36
- twilio_queues = twilio_queues.next_page
37
- end
32
+ queues = twilio_queues.select{|twilio_queue| @condition[value][build_value(twilio_queue.send(key), key)] }.map{|twilio_queue| Queue.new(twilio_queue) }
38
33
 
39
34
  queues
40
35
  end
@@ -51,14 +46,9 @@ module TwilioRubyWrapper
51
46
  key = hash.keys.first
52
47
  value = build_value(hash[key], key)
53
48
 
54
- params = {page: @page_number, page_size: @page_size}
49
+ params = {page_size: @page_size}
55
50
  twilio_queues = @twilio_queue_list.list(params)
56
- queue = nil
57
- until twilio_queues.empty? do
58
- queue = twilio_queues.select{|twilio_queue| @condition[value][build_value(twilio_queue.send(key), key)] }.map{|twilio_queue| Queue.new(twilio_queue) }.first
59
- break queue.nil?
60
- twilio_queues = twilio_queues.next_page
61
- end
51
+ queue = twilio_queues.select{|twilio_queue| @condition[value][build_value(twilio_queue.send(key), key)] }.map{|twilio_queue| Queue.new(twilio_queue) }.first
62
52
 
63
53
  queue
64
54
  end
@@ -108,7 +98,7 @@ module TwilioRubyWrapper
108
98
 
109
99
  def set_twilio_account
110
100
  @twilio_client = Twilio::REST::Client.new(@@account_sid, @@auth_token)
111
- @twilio_queue_list = @twilio_client.account.queues
101
+ @twilio_queue_list = @twilio_client.api.account.queues
112
102
  end
113
103
  end
114
104
  end
@@ -1,3 +1,3 @@
1
1
  module TwilioRubyWrapper
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "twilio-ruby", '~> 4.13'
25
- spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_dependency "twilio-ruby", "~> 5.0"
25
+ spec.add_development_dependency "bundler", "~> 1.15"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "minitest", "~> 5.0"
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio_ruby_wrapper
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
  - FUNABARA Masao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-31 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twilio-ruby
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.13'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.13'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.14'
33
+ version: '1.15'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.14'
40
+ version: '1.15'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement