portatext 1.3.1 → 1.4.0

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: f4530e6e0b70946a596e4b650e83c9c597b40dfb
4
- data.tar.gz: 4f69cd974ba5f399512fb7fb30d6c0bd04cfb760
3
+ metadata.gz: 63784633a089b44c9a5255016f19fbfb06d94df7
4
+ data.tar.gz: eb24e9015bb78a150231c53e0e2d0a718e1523ef
5
5
  SHA512:
6
- metadata.gz: 9bcccdfe7f69a44c127b10a35d4b846fefc04b12a2b76cd5366f0c07d697774bda0a9799cbcd79e5068d3956180f7275efa646629170ae4cf07bd77e7a469123
7
- data.tar.gz: c0285d43c333f95f0ecd8ae4e6361d8b17ca2b93cc53719c1303e1ae66700e83951cbae2bc80efacbaf10671861f252c4ec422f0bd0d4209a4f6aa6284155c73
6
+ metadata.gz: f209e1bf0c09563c528a817556e7a307826f24df441ac308a3e6a127aa3a960f5bf58c4c75a9c3a4da0c9be31eb7e043f0b42f58cdeace5bd845a11452e233aa
7
+ data.tar.gz: aa504008c39ded3ea3cde9783d80bdf37f1802417fe2be4ce405dfefc6dfc043bb47599f17a71c3bfe80857228ae8fb7c362b69e23c2afc09291ebac7048f66c
@@ -32,6 +32,22 @@ module PortaText
32
32
  set :file, file
33
33
  end
34
34
 
35
+ def use_template(template_id, variables)
36
+ set :settings, template_id: template_id, variables: variables
37
+ end
38
+
39
+ def text(text)
40
+ set :settings, text: text
41
+ end
42
+
43
+ def from_service(service_id)
44
+ set :service_id, service_id
45
+ end
46
+
47
+ def all_subscribers
48
+ set :all_subscribers, true
49
+ end
50
+
35
51
  # rubocop:disable Metrics/MethodLength
36
52
  def endpoint(_method)
37
53
  unless @args[:file].nil?
@@ -0,0 +1,37 @@
1
+ module PortaText
2
+ module Command
3
+ module Api
4
+ # The sms_services endpoint.
5
+ # https://github.com/PortaText/docs/wiki/REST-API#api_sms_services
6
+ #
7
+ # Author:: Marcelo Gornstein (mailto:marcelog@portatext.com)
8
+ # Copyright:: Copyright (c) 2015 PortaText
9
+ # License:: Apache-2.0
10
+ class Services < Base
11
+ def id(id)
12
+ set :id, id
13
+ end
14
+
15
+ def save_to(file)
16
+ set :accept_file, file
17
+ end
18
+
19
+ def page(page)
20
+ set :page, page
21
+ end
22
+
23
+ def endpoint(_method)
24
+ base = 'sms_services'
25
+ return base if @args[:id].nil?
26
+ id = @args[:id]
27
+ @args.delete :id
28
+ page = @args[:page]
29
+ @args.delete :page
30
+ return "#{base}/#{id}/subscribers" unless @args[:accept_file].nil?
31
+ return "#{base}/#{id}/subscribers?page=#{page}" unless page.nil?
32
+ "#{base}/#{id}"
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -24,9 +24,8 @@ module PortaText
24
24
  set :email_on_inbound_sms, email
25
25
  end
26
26
 
27
- def enable_autorecharges(when_credit, card_id, total)
27
+ def enable_autorecharges(when_credit, total)
28
28
  set :autorecharge_enabled, true
29
- set :autorecharge_card_id, card_id
30
29
  set :autorecharge_total, total
31
30
  set :autorecharge_when_credit, when_credit
32
31
  end
@@ -35,6 +34,10 @@ module PortaText
35
34
  set :autorecharge_enabled, false
36
35
  end
37
36
 
37
+ def default_credit_card(card_id)
38
+ set :default_card_id, card_id
39
+ end
40
+
38
41
  def endpoint(_method)
39
42
  'me/settings'
40
43
  end
@@ -20,6 +20,10 @@ module PortaText
20
20
  set :from, from
21
21
  end
22
22
 
23
+ def from_service(service_id)
24
+ set :service_id, service_id
25
+ end
26
+
23
27
  def use_template(id, variables = {})
24
28
  set :template_id, id
25
29
  set :variables, variables
data/lib/portatext.rb CHANGED
@@ -31,11 +31,11 @@ require_relative 'portatext/command/api/contact_lists'
31
31
  require_relative 'portatext/command/api/did_search'
32
32
  require_relative 'portatext/command/api/blacklist'
33
33
  require_relative 'portatext/command/api/campaigns'
34
- require_relative 'portatext/command/api/sms_campaign'
35
34
  require_relative 'portatext/command/api/campaign_lifecycle'
36
35
  require_relative 'portatext/command/api/my_password'
37
36
  require_relative 'portatext/command/api/contacts'
38
37
  require_relative 'portatext/command/api/number_verify'
38
+ require_relative 'portatext/command/api/services'
39
39
 
40
40
  # The PortaText namespace.
41
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.3.1'
3
+ s.version = '1.4.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.3.1
4
+ version: 1.4.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-03-07 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -155,9 +155,9 @@ files:
155
155
  - lib/portatext/command/api/my_password.rb
156
156
  - lib/portatext/command/api/number_verify.rb
157
157
  - lib/portatext/command/api/recharge.rb
158
+ - lib/portatext/command/api/services.rb
158
159
  - lib/portatext/command/api/settings.rb
159
160
  - lib/portatext/command/api/sms.rb
160
- - lib/portatext/command/api/sms_campaign.rb
161
161
  - lib/portatext/command/api/tariffs.rb
162
162
  - lib/portatext/command/api/templates.rb
163
163
  - lib/portatext/command/api/timezones.rb
@@ -1,26 +0,0 @@
1
- module PortaText
2
- module Command
3
- module Api
4
- # An SMS campaign.
5
- # https://github.com/PortaText/docs/wiki/REST-API#api_campaigns
6
- #
7
- # Author:: Marcelo Gornstein (mailto:marcelog@portatext.com)
8
- # Copyright:: Copyright (c) 2015 PortaText
9
- # License:: Apache-2.0
10
- class SmsCampaign < Campaigns
11
- def use_template(template_id, variables)
12
- set :settings, template_id: template_id, variables: variables
13
- end
14
-
15
- def text(text)
16
- set :settings, text: text
17
- end
18
-
19
- def initialize
20
- super
21
- set :type, 'sms'
22
- end
23
- end
24
- end
25
- end
26
- end