portatext 1.1.11 → 1.2.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: fa032c8325252fc350d2ca66eed71aa25f58443f
4
- data.tar.gz: a50a4acf2ebf4b1350483e18fd1517115aa33129
3
+ metadata.gz: f757968cdfd9305d7e5e048402aaf954582b60cd
4
+ data.tar.gz: 0b88c4094fa1a4bffdc46348c78ab4d798021002
5
5
  SHA512:
6
- metadata.gz: ba1d33e0c63a794cabf5ade7db726724787b26cd53b78ee4b0f2bd6f30bc9f0eee9688102d5e5018320f2931ebf505a6f5dfa1244dc8042223bd51de6030bdd0
7
- data.tar.gz: d8151d28ef5de37975c94400b70092d1258da4bbf9454db6dae81ee2778b9a48da5f987cd86de6183dd1cf0d93bfcc495b99e82da2c11f12a88aa406900dd907
6
+ metadata.gz: 27239e1b739d42de7cb548c696bca24f830e6648447f80dd2ef6b39356c85f69e078cd5e90606516d867ae01b9bcd6a73ee5fce559374ccd72b8b51f36e0dd90
7
+ data.tar.gz: b7c350b9cb5abb6ac81168f903d1b44c3d07db4952aa2fe8f11fb547026c97f79ee14858ba44c5b335db9ef100b619cba41e58e20b0d611cf244d51bc082d6cf
@@ -34,7 +34,7 @@ require_relative 'portatext/command/api/campaigns'
34
34
  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
- require_relative 'portatext/command/api/variables'
37
+ require_relative 'portatext/command/api/contacts'
38
38
  require_relative 'portatext/command/api/number_verify'
39
39
 
40
40
  # The PortaText namespace.
@@ -1,17 +1,25 @@
1
1
  module PortaText
2
2
  module Command
3
3
  module Api
4
- # The variables endpoint.
5
- # https://github.com/PortaText/docs/wiki/REST-API#api_variables
4
+ # The contacts endpoint.
5
+ # https://github.com/PortaText/docs/wiki/REST-API#api_all_contacts
6
6
  #
7
7
  # Author:: Marcelo Gornstein (mailto:marcelog@portatext.com)
8
8
  # Copyright:: Copyright (c) 2015 PortaText
9
9
  # License:: Apache-2.0
10
- class Variables < Base
11
- def for_contact(number)
10
+ class Contacts < Base
11
+ def id(number)
12
12
  set :number, number
13
13
  end
14
14
 
15
+ def with_contact_lists
16
+ set :with_contact_lists, true
17
+ end
18
+
19
+ def page(page)
20
+ set :page, page
21
+ end
22
+
15
23
  def name(name)
16
24
  set :name, name
17
25
  end
@@ -38,8 +46,20 @@ module PortaText
38
46
  end
39
47
  # rubocop:enable Style/AccessorMethodName
40
48
 
49
+ # rubocop:disable Metrics/MethodLength
50
+ # rubocop:disable Metrics/AbcSize
41
51
  def endpoint(_method)
42
- return 'contacts/variables' if @args[:number].nil?
52
+ qs = {}
53
+ unless @args[:page].nil?
54
+ qs['page'] = @args[:page]
55
+ @args.delete :page
56
+ end
57
+ unless @args[:with_contact_lists].nil?
58
+ qs['with_contact_lists'] = 'true'
59
+ @args.delete :with_contact_lists
60
+ end
61
+ qs = URI.encode_www_form qs
62
+ return "contacts?#{qs}" if @args[:number].nil?
43
63
  number = @args[:number]
44
64
  @args.delete :number
45
65
  return "contacts/#{number}/variables" if @args[:name].nil?
@@ -47,6 +67,8 @@ module PortaText
47
67
  @args.delete :name
48
68
  "contacts/#{number}/variables/#{name}"
49
69
  end
70
+ # rubocop:enable Metrics/MethodLength
71
+ # rubocop:enable Metrics/AbcSize
50
72
  end
51
73
  end
52
74
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'portatext'
3
- s.version = '1.1.11'
3
+ s.version = '1.2.0'
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.11
4
+ version: 1.2.0
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-08 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -145,6 +145,7 @@ files:
145
145
  - lib/portatext/command/api/campaigns.rb
146
146
  - lib/portatext/command/api/cnam.rb
147
147
  - lib/portatext/command/api/contact_lists.rb
148
+ - lib/portatext/command/api/contacts.rb
148
149
  - lib/portatext/command/api/credit_cards.rb
149
150
  - lib/portatext/command/api/did_search.rb
150
151
  - lib/portatext/command/api/did_settings.rb
@@ -160,7 +161,6 @@ files:
160
161
  - lib/portatext/command/api/tariffs.rb
161
162
  - lib/portatext/command/api/templates.rb
162
163
  - lib/portatext/command/api/timezones.rb
163
- - lib/portatext/command/api/variables.rb
164
164
  - lib/portatext/command/base.rb
165
165
  - lib/portatext/command/descriptor.rb
166
166
  - lib/portatext/command/result.rb