bobot 3.5.2 → 3.6.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 +4 -4
- data/lib/bobot/buttons.rb +9 -9
- data/lib/bobot/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a2b05679f62a29c34e5aea685a84199f485f8c3
|
4
|
+
data.tar.gz: bd073ad12a6b1ee33ab6aed2e59df7e438b8bfaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cca90475112b6f433834413dbf17a323b7905feeece9e5dc51fde3aad9b91e7f13c4caa1fa0e9c35e509c93ee299de44855dd089f9144740e6bf3a77113080c
|
7
|
+
data.tar.gz: 0b3e25c3017cfa623dadb5f11a9067d357177e9c1d386db8724dabd6902639565be5bf7dae6f47c445f92282d5aca812634c623d509117c11bf5f0d2a73d992d
|
data/lib/bobot/buttons.rb
CHANGED
@@ -13,7 +13,7 @@ module Bobot
|
|
13
13
|
|
14
14
|
def self.postback(title:, payload:)
|
15
15
|
raise Bobot::FieldFormat.new('title is required.') unless title.present?
|
16
|
-
raise Bobot::FieldFormat.new('title length is limited to 20.') if title.size > 20
|
16
|
+
raise Bobot::FieldFormat.new('title length is limited to 20.', title) if title.size > 20
|
17
17
|
raise Bobot::FieldFormat.new('payload is required.') unless payload.present?
|
18
18
|
payload = Bobot::Buttons.encode_payload(payload: payload)
|
19
19
|
raise Bobot::FieldFormat.new('payload length is limited to 1000.') if payload.bytesize > 1000
|
@@ -26,8 +26,8 @@ module Bobot
|
|
26
26
|
|
27
27
|
def self.generic_element(title:, subtitle: nil, image_url: nil, default_action_url: nil, buttons: nil)
|
28
28
|
raise Bobot::FieldFormat.new('title is required.') unless title.present?
|
29
|
-
raise Bobot::FieldFormat.new('title length is limited to 80.') if title.size > 80
|
30
|
-
raise Bobot::FieldFormat.new('subtitle length is limited to 80.') if subtitle.present? && subtitle.size > 80
|
29
|
+
raise Bobot::FieldFormat.new('title length is limited to 80.', title) if title.size > 80
|
30
|
+
raise Bobot::FieldFormat.new('subtitle length is limited to 80.', subtitle) if subtitle.present? && subtitle.size > 80
|
31
31
|
raise Bobot::FieldFormat.new('buttons are limited to 3.') if buttons.present? && buttons.size > 3
|
32
32
|
{
|
33
33
|
title: title,
|
@@ -52,7 +52,7 @@ module Bobot
|
|
52
52
|
|
53
53
|
def self.quick_reply_text(title:, payload:, image_url: nil)
|
54
54
|
raise Bobot::FieldFormat.new('title is required.') unless title.present?
|
55
|
-
raise Bobot::FieldFormat.new('title length is limited to 20.') if title.size > 20
|
55
|
+
raise Bobot::FieldFormat.new('title length is limited to 20.', title) if title.size > 20
|
56
56
|
raise Bobot::FieldFormat.new('payload is required.') unless payload.present?
|
57
57
|
payload = Bobot::Buttons.encode_payload(payload: payload)
|
58
58
|
raise Bobot::FieldFormat.new('payload length is limited to 1000.') if payload.bytesize > 1000
|
@@ -73,11 +73,11 @@ module Bobot
|
|
73
73
|
|
74
74
|
def self.share_custom(title:, subtitle:, image_url:, web_url:, button_title:, image_aspect_ratio: "square")
|
75
75
|
raise Bobot::FieldFormat.new('title is required.') unless title.present?
|
76
|
-
raise Bobot::FieldFormat.new('title length is limited to 80.') if title.size > 80
|
76
|
+
raise Bobot::FieldFormat.new('title length is limited to 80.', title) if title.size > 80
|
77
77
|
raise Bobot::FieldFormat.new('subtitle is required.') unless subtitle.present?
|
78
|
-
raise Bobot::FieldFormat.new('subtitle length is limited to 80.') if subtitle.size > 80
|
78
|
+
raise Bobot::FieldFormat.new('subtitle length is limited to 80.', subtitle) if subtitle.size > 80
|
79
79
|
raise Bobot::FieldFormat.new('button_title is required.') unless button_title.present?
|
80
|
-
raise Bobot::FieldFormat.new('button_title length is limited to 20.') if button_title.size > 20
|
80
|
+
raise Bobot::FieldFormat.new('button_title length is limited to 20.', button_title) if button_title.size > 20
|
81
81
|
{
|
82
82
|
type: 'element_share',
|
83
83
|
share_contents: {
|
@@ -131,7 +131,7 @@ module Bobot
|
|
131
131
|
|
132
132
|
def self.url(title:, url:, options: {})
|
133
133
|
raise Bobot::FieldFormat.new('title is required.') unless title.present?
|
134
|
-
raise Bobot::FieldFormat.new('title length is limited to 20.') if title.size > 20
|
134
|
+
raise Bobot::FieldFormat.new('title length is limited to 20.', title) if title.size > 20
|
135
135
|
raise Bobot::FieldFormat.new('url is required.') unless url.present?
|
136
136
|
if options.key?(:messenger_extensions) && options[:messenger_extensions] && !url.include?('https')
|
137
137
|
raise Bobot::FieldFormat.new('must use url HTTPS protocol if messenger_extensions is true.')
|
@@ -154,7 +154,7 @@ module Bobot
|
|
154
154
|
REGEX_PHONE_NUMBER = /\A(?:\+)(?:\d{1,3}\s*-?)?\(?(?:\d{3})?\)?[- ]?\d{3}[- ]?\d{4}\z/
|
155
155
|
def self.call(title:, payload:)
|
156
156
|
raise Bobot::FieldFormat.new('title is required.') unless title.present?
|
157
|
-
raise Bobot::FieldFormat.new('title length is limited to 20.') if title.size > 20
|
157
|
+
raise Bobot::FieldFormat.new('title length is limited to 20.', title) if title.size > 20
|
158
158
|
raise Bobot::FieldFormat.new('payload is required.') unless payload.present?
|
159
159
|
raise Bobot::FieldFormat.new('payload has to be only a string') unless payload.is_a?(String)
|
160
160
|
raise Bobot::FieldFormat.new('payload has to start with a "+" and be a valid phone number') unless REGEX_PHONE_NUMBER =~ payload
|
data/lib/bobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Navid EMAD
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|