portatext 1.1.10 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a8af8c6f3a02be776f856cd3ddf6e81f1c63fae
4
- data.tar.gz: a4f0822a2e51019836146cabe66e1077466a5796
3
+ metadata.gz: fa032c8325252fc350d2ca66eed71aa25f58443f
4
+ data.tar.gz: a50a4acf2ebf4b1350483e18fd1517115aa33129
5
5
  SHA512:
6
- metadata.gz: c782cf52d14c85185a9a3c5820a059c0dda34f2b01c97610fe268dc24309f660d88081b47b0425326cb29764c32f9eb0f4daefc7ba1983ab3f889772d91ba752
7
- data.tar.gz: 4f21920bb06f9ee64db765620e013dbb4f63d587c7633096778b4075240000f1acde3d2d0dcd2fef0f60efe8fec6c9408fa0542c301bc959f4bda822f4936a4b
6
+ metadata.gz: ba1d33e0c63a794cabf5ade7db726724787b26cd53b78ee4b0f2bd6f30bc9f0eee9688102d5e5018320f2931ebf505a6f5dfa1244dc8042223bd51de6030bdd0
7
+ data.tar.gz: d8151d28ef5de37975c94400b70092d1258da4bbf9454db6dae81ee2778b9a48da5f987cd86de6183dd1cf0d93bfcc495b99e82da2c11f12a88aa406900dd907
@@ -81,7 +81,7 @@ module PortaText
81
81
  def assert_result(descriptor, result)
82
82
  error = error_for result.code
83
83
  return result if error.nil?
84
- fail error, [descriptor, result]
84
+ raise error, [descriptor, result]
85
85
  end
86
86
 
87
87
  def auth_method(auth_suggested)
@@ -123,7 +123,7 @@ module PortaText
123
123
  when :api_key
124
124
  headers['X-Api-Key'] = @api_key
125
125
  else
126
- fail "Invalid auth type: #{auth}"
126
+ raise "Invalid auth type: #{auth}"
127
127
  end
128
128
  headers
129
129
  end
@@ -29,7 +29,7 @@ module PortaText
29
29
  end
30
30
 
31
31
  def endpoint(_method)
32
- fail 'Campaign id cant be null' if @args[:id].nil?
32
+ raise 'Campaign id cant be null' if @args[:id].nil?
33
33
  id = @args[:id]
34
34
  @args.delete :id
35
35
  "campaigns/#{id}/lifecycle"
@@ -13,7 +13,7 @@ module PortaText
13
13
  end
14
14
 
15
15
  def endpoint(_method)
16
- fail 'DID number cant be null' if @args[:number].nil?
16
+ raise 'DID number cant be null' if @args[:number].nil?
17
17
  number = @args[:number]
18
18
  @args.delete :number
19
19
  "cnam/#{number}"
@@ -30,7 +30,7 @@ module PortaText
30
30
  end
31
31
 
32
32
  def endpoint(_method)
33
- fail 'DID number cant be null' if @args[:id].nil?
33
+ raise 'DID number cant be null' if @args[:id].nil?
34
34
  id = @args[:id]
35
35
  @args.delete :id
36
36
  "me/dids/#{id}"
@@ -0,0 +1,40 @@
1
+ module PortaText
2
+ module Command
3
+ module Api
4
+ # The number verify endpoint.
5
+ # https://github.com/PortaText/docs/wiki/REST-API#api_number_verify
6
+ #
7
+ # Author:: Marcelo Gornstein (mailto:marcelog@portatext.com)
8
+ # Copyright:: Copyright (c) 2015 PortaText
9
+ # License:: Apache-2.0
10
+ class NumberVerify < Base
11
+ def for_number(number)
12
+ set :number, number
13
+ end
14
+
15
+ def from(from)
16
+ set :from, from
17
+ end
18
+
19
+ def verify_with(code)
20
+ set :code, code
21
+ end
22
+
23
+ def use_template(id, variables = {})
24
+ set :template_id, id
25
+ set :variables, variables
26
+ end
27
+
28
+ def endpoint(_method)
29
+ raise 'DID number cant be null' if @args[:number].nil?
30
+ number = @args[:number]
31
+ @args.delete :number
32
+ return "number_verify/#{number}" if @args[:code].nil?
33
+ code = @args[:code]
34
+ @args.delete :code
35
+ "number_verify/#{number}?code=#{code}"
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
data/lib/portatext.rb CHANGED
@@ -35,6 +35,7 @@ require_relative 'portatext/command/api/sms_campaign'
35
35
  require_relative 'portatext/command/api/campaign_lifecycle'
36
36
  require_relative 'portatext/command/api/my_password'
37
37
  require_relative 'portatext/command/api/variables'
38
+ require_relative 'portatext/command/api/number_verify'
38
39
 
39
40
  # The PortaText namespace.
40
41
  #
data/portatext.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'portatext'
3
- s.version = '1.1.10'
3
+ s.version = '1.1.11'
4
4
  s.summary = 'Official PortaText API ruby client'
5
5
  s.description = 'This is the official PortaText API ruby client'
6
6
  s.authors = ['PortaText']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portatext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - PortaText
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-04 00:00:00.000000000 Z
11
+ date: 2016-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -152,6 +152,7 @@ files:
152
152
  - lib/portatext/command/api/jobs.rb
153
153
  - lib/portatext/command/api/me.rb
154
154
  - lib/portatext/command/api/my_password.rb
155
+ - lib/portatext/command/api/number_verify.rb
155
156
  - lib/portatext/command/api/recharge.rb
156
157
  - lib/portatext/command/api/settings.rb
157
158
  - lib/portatext/command/api/sms.rb