twilio-ruby 5.31.0 → 5.31.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/.rubocop_todo.yml +90 -48
- data/CHANGES.md +18 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/preview.rb +9 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +16 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +219 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +111 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights/success_rate.rb +264 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +0 -8
- data/lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb +0 -8
- data/lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb +0 -8
- data/lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb +0 -8
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -11
- data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +8 -11
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account_spec.rb +18 -7
- data/spec/integration/lookups/v1/phone_number_spec.rb +37 -32
- data/spec/integration/preview/trusted_comms/business/insights/success_rate_spec.rb +58 -0
- data/spec/integration/preview/trusted_comms/business/insights_spec.rb +12 -0
- data/spec/integration/preview/trusted_comms/business_spec.rb +46 -0
- data/spec/integration/verify/v2/service_spec.rb +4 -0
- data/spec/integration/wireless/v1/rate_plan_spec.rb +4 -0
- data/twilio-ruby.gemspec +1 -1
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da33f200b81c577227ae4cf3995c0f9f543c02ac772650dec19b18e957f5aafd
|
4
|
+
data.tar.gz: 23bb9c4f559311cd52f5bff9e4ecfe1180bf58c8f6e78ab4ad99cff53161cca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dd198905771ba661dcf12953312a76c2b28bce1883edace5a074a2da34a53a69db9231e2ec3b4a8427fb39f309f2bed81c04aece804bffe53c7cddac8ab43aa
|
7
|
+
data.tar.gz: 57ca86c1045b02240b6b8e1f061a7e36b6fd14f662cc04f3269e3df40a2c10db954cff234d19906a8f32832d645f4a48ce24857792576da58f0d418a7563e575
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
3
|
AllCops:
|
4
|
-
TargetRubyVersion: 2.
|
4
|
+
TargetRubyVersion: 2.6
|
5
5
|
Exclude:
|
6
6
|
- 'lib/twilio-ruby/rest/**/*'
|
7
7
|
- 'spec/integration/**/*'
|
@@ -19,7 +19,7 @@ Metrics/BlockLength:
|
|
19
19
|
Exclude:
|
20
20
|
- 'spec/**/*'
|
21
21
|
|
22
|
-
Layout/
|
22
|
+
Layout/HeredocIndentation:
|
23
23
|
Enabled: false
|
24
24
|
|
25
25
|
Metrics/ClassLength:
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2019-12-18 11:23:55 -0600 using RuboCop version 0.77.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,18 +8,32 @@
|
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
10
|
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters:
|
12
|
-
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/OrderedDependencies:
|
13
14
|
Exclude:
|
14
15
|
- 'twilio-ruby.gemspec'
|
15
16
|
|
16
17
|
# Offense count: 1
|
18
|
+
# Configuration parameters: Include.
|
19
|
+
# Include: **/*.gemspec,
|
20
|
+
Gemspec/RequiredRubyVersion:
|
21
|
+
Exclude:
|
22
|
+
- 'twilio-ruby.gemspec'
|
23
|
+
|
24
|
+
# Offense count: 2
|
17
25
|
# Cop supports --auto-correct.
|
18
|
-
|
19
|
-
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
20
|
-
Layout/IndentHeredoc:
|
26
|
+
Layout/EmptyLineAfterGuardClause:
|
21
27
|
Exclude:
|
22
|
-
- '
|
28
|
+
- 'lib/rack/twilio_webhook_authentication.rb'
|
29
|
+
- 'lib/twilio-ruby/framework/serialize.rb'
|
30
|
+
|
31
|
+
# Offense count: 1
|
32
|
+
# Cop supports --auto-correct.
|
33
|
+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
34
|
+
Layout/ExtraSpacing:
|
35
|
+
Exclude:
|
36
|
+
- 'twilio-ruby.gemspec'
|
23
37
|
|
24
38
|
# Offense count: 2
|
25
39
|
# Cop supports --auto-correct.
|
@@ -30,7 +44,7 @@ Layout/SpaceAroundOperators:
|
|
30
44
|
|
31
45
|
# Offense count: 8
|
32
46
|
# Cop supports --auto-correct.
|
33
|
-
# Configuration parameters: EnforcedStyle,
|
47
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
34
48
|
# SupportedStyles: space, no_space, compact
|
35
49
|
# SupportedStylesForEmptyBraces: space, no_space
|
36
50
|
Layout/SpaceInsideHashLiteralBraces:
|
@@ -40,9 +54,10 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
40
54
|
|
41
55
|
# Offense count: 1
|
42
56
|
# Cop supports --auto-correct.
|
43
|
-
|
57
|
+
# Configuration parameters: IndentationWidth.
|
58
|
+
Layout/Tab:
|
44
59
|
Exclude:
|
45
|
-
- '
|
60
|
+
- 'twilio-ruby.gemspec'
|
46
61
|
|
47
62
|
# Offense count: 2
|
48
63
|
# Cop supports --auto-correct.
|
@@ -72,30 +87,37 @@ Lint/UselessAssignment:
|
|
72
87
|
Exclude:
|
73
88
|
- 'spec/rack/twilio_webhook_authentication_spec.rb'
|
74
89
|
|
75
|
-
# Offense count:
|
76
|
-
Metrics/AbcSize:
|
77
|
-
Max: 28
|
78
|
-
|
79
|
-
# Offense count: 24
|
90
|
+
# Offense count: 1
|
80
91
|
# Configuration parameters: CountComments, ExcludedMethods.
|
92
|
+
# ExcludedMethods: refine
|
81
93
|
Metrics/BlockLength:
|
82
|
-
Max:
|
83
|
-
|
84
|
-
# Offense count: 53
|
85
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
86
|
-
# URISchemes: http, https
|
87
|
-
Metrics/LineLength:
|
88
|
-
Max: 249
|
94
|
+
Max: 28
|
89
95
|
|
90
96
|
# Offense count: 1
|
91
|
-
#
|
92
|
-
|
97
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
98
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
99
|
+
Naming/FileName:
|
93
100
|
Exclude:
|
94
|
-
- 'lib/twilio-ruby
|
101
|
+
- 'lib/twilio-ruby.rb'
|
102
|
+
|
103
|
+
# Offense count: 2
|
104
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
105
|
+
# AllowedNames: io, id, to, by, on, in, at, ip, db, os
|
106
|
+
Naming/MethodParameterName:
|
107
|
+
Exclude:
|
108
|
+
- 'lib/twilio-ruby/security/request_validator.rb'
|
109
|
+
|
110
|
+
# Offense count: 19
|
111
|
+
# Configuration parameters: EnforcedStyle.
|
112
|
+
# SupportedStyles: snake_case, camelCase
|
113
|
+
Naming/VariableName:
|
114
|
+
Exclude:
|
115
|
+
- 'spec/jwt/client_capability_spec.rb'
|
116
|
+
- 'spec/jwt/task_router_spec.rb'
|
95
117
|
|
96
|
-
# Offense count:
|
118
|
+
# Offense count: 8
|
97
119
|
# Cop supports --auto-correct.
|
98
|
-
# Configuration parameters: EnforcedStyle
|
120
|
+
# Configuration parameters: EnforcedStyle.
|
99
121
|
# SupportedStyles: braces, no_braces, context_dependent
|
100
122
|
Style/BracesAroundHashParameters:
|
101
123
|
Exclude:
|
@@ -103,18 +125,30 @@ Style/BracesAroundHashParameters:
|
|
103
125
|
- 'spec/jwt/access_token_spec.rb'
|
104
126
|
- 'spec/jwt/client_capability_spec.rb'
|
105
127
|
- 'spec/rack/twilio_webhook_authentication_spec.rb'
|
106
|
-
- 'spec/twiml/voice_response_spec.rb'
|
107
128
|
|
108
|
-
# Offense count:
|
129
|
+
# Offense count: 38
|
109
130
|
Style/Documentation:
|
110
131
|
Enabled: false
|
111
132
|
|
112
133
|
# Offense count: 1
|
113
|
-
#
|
114
|
-
|
115
|
-
Style/FileName:
|
134
|
+
# Cop supports --auto-correct.
|
135
|
+
Style/Encoding:
|
116
136
|
Exclude:
|
117
|
-
- '
|
137
|
+
- 'twilio-ruby.gemspec'
|
138
|
+
|
139
|
+
# Offense count: 2
|
140
|
+
# Cop supports --auto-correct.
|
141
|
+
Style/ExpandPathArguments:
|
142
|
+
Exclude:
|
143
|
+
- 'spec/spec_helper.rb'
|
144
|
+
- 'twilio-ruby.gemspec'
|
145
|
+
|
146
|
+
# Offense count: 23
|
147
|
+
# Cop supports --auto-correct.
|
148
|
+
# Configuration parameters: EnforcedStyle.
|
149
|
+
# SupportedStyles: always, never
|
150
|
+
Style/FrozenStringLiteralComment:
|
151
|
+
Enabled: false
|
118
152
|
|
119
153
|
# Offense count: 3
|
120
154
|
# Configuration parameters: MinBodyLength.
|
@@ -124,12 +158,28 @@ Style/GuardClause:
|
|
124
158
|
|
125
159
|
# Offense count: 1
|
126
160
|
# Cop supports --auto-correct.
|
127
|
-
# Configuration parameters: EnforcedStyle,
|
161
|
+
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
128
162
|
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
129
163
|
Style/HashSyntax:
|
130
164
|
Exclude:
|
131
165
|
- 'spec/jwt/access_token_spec.rb'
|
132
166
|
|
167
|
+
# Offense count: 12
|
168
|
+
# Cop supports --auto-correct.
|
169
|
+
Style/IfUnlessModifier:
|
170
|
+
Exclude:
|
171
|
+
- 'lib/twilio-ruby/framework/page.rb'
|
172
|
+
- 'lib/twilio-ruby/framework/version.rb'
|
173
|
+
- 'lib/twilio-ruby/jwt/access_token.rb'
|
174
|
+
- 'lib/twilio-ruby/jwt/client_capability.rb'
|
175
|
+
- 'lib/twilio-ruby/jwt/jwt.rb'
|
176
|
+
|
177
|
+
# Offense count: 4
|
178
|
+
# Cop supports --auto-correct.
|
179
|
+
Style/RedundantFreeze:
|
180
|
+
Exclude:
|
181
|
+
- 'lib/twilio-ruby/jwt/task_router.rb'
|
182
|
+
|
133
183
|
# Offense count: 2
|
134
184
|
# Cop supports --auto-correct.
|
135
185
|
Style/RedundantSelf:
|
@@ -138,7 +188,7 @@ Style/RedundantSelf:
|
|
138
188
|
|
139
189
|
# Offense count: 16
|
140
190
|
# Cop supports --auto-correct.
|
141
|
-
# Configuration parameters: EnforcedStyle,
|
191
|
+
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
142
192
|
# SupportedStyles: slashes, percent_r, mixed
|
143
193
|
Style/RegexpLiteral:
|
144
194
|
Exclude:
|
@@ -147,9 +197,9 @@ Style/RegexpLiteral:
|
|
147
197
|
- 'lib/twilio-ruby/framework/version.rb'
|
148
198
|
- 'spec/rack/twilio_webhook_authentication_spec.rb'
|
149
199
|
|
150
|
-
# Offense count:
|
200
|
+
# Offense count: 5
|
151
201
|
# Cop supports --auto-correct.
|
152
|
-
# Configuration parameters: EnforcedStyle,
|
202
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
153
203
|
# SupportedStyles: single_quotes, double_quotes
|
154
204
|
Style/StringLiterals:
|
155
205
|
Exclude:
|
@@ -157,12 +207,12 @@ Style/StringLiterals:
|
|
157
207
|
|
158
208
|
# Offense count: 1
|
159
209
|
# Cop supports --auto-correct.
|
160
|
-
# Configuration parameters: MinSize
|
210
|
+
# Configuration parameters: MinSize.
|
161
211
|
# SupportedStyles: percent, brackets
|
162
212
|
Style/SymbolArray:
|
163
213
|
EnforcedStyle: brackets
|
164
214
|
|
165
|
-
# Offense count:
|
215
|
+
# Offense count: 14
|
166
216
|
# Cop supports --auto-correct.
|
167
217
|
# Configuration parameters: AllowNamedUnderscoreVariables.
|
168
218
|
Style/TrailingUnderscoreVariable:
|
@@ -172,16 +222,8 @@ Style/TrailingUnderscoreVariable:
|
|
172
222
|
- 'spec/jwt/task_router_spec.rb'
|
173
223
|
|
174
224
|
# Offense count: 15
|
175
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
176
|
-
# SupportedStyles: snake_case, camelCase
|
177
|
-
Style/VariableName:
|
178
|
-
Exclude:
|
179
|
-
- 'spec/jwt/client_capability_spec.rb'
|
180
|
-
- 'spec/jwt/task_router_spec.rb'
|
181
|
-
|
182
|
-
# Offense count: 3
|
183
225
|
# Cop supports --auto-correct.
|
184
|
-
# Configuration parameters:
|
226
|
+
# Configuration parameters: MinSize, WordRegex.
|
185
227
|
# SupportedStyles: percent, brackets
|
186
228
|
Style/WordArray:
|
187
229
|
EnforcedStyle: brackets
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2019-12-18] Version 5.31.1
|
5
|
+
---------------------------
|
6
|
+
**Library - Chore**
|
7
|
+
- [PR #488](https://github.com/twilio/twilio-ruby/pull/488): upgrade rubocop to 0.77.0. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
8
|
+
|
9
|
+
**Preview**
|
10
|
+
- Add `/Insights/SuccessRate` endpoint for Businesses Branded Calls (Verified by Twilio)
|
11
|
+
|
12
|
+
**Studio**
|
13
|
+
- StudioV2 API in beta
|
14
|
+
|
15
|
+
**Verify**
|
16
|
+
- Add `MailerSid` property to Verify Service resource.
|
17
|
+
|
18
|
+
**Wireless**
|
19
|
+
- Added `data_limit_strategy` to Rate Plan resource.
|
20
|
+
|
21
|
+
|
4
22
|
[2019-12-12] Version 5.31.0
|
5
23
|
---------------------------
|
6
24
|
**Api**
|
data/README.md
CHANGED
@@ -31,13 +31,13 @@ This library supports the following Ruby implementations:
|
|
31
31
|
To install using [Bundler][bundler] grab the latest stable version:
|
32
32
|
|
33
33
|
```ruby
|
34
|
-
gem 'twilio-ruby', '~> 5.31.
|
34
|
+
gem 'twilio-ruby', '~> 5.31.1'
|
35
35
|
```
|
36
36
|
|
37
37
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
38
38
|
|
39
39
|
```bash
|
40
|
-
gem install twilio-ruby -v 5.31.
|
40
|
+
gem install twilio-ruby -v 5.31.1
|
41
41
|
```
|
42
42
|
|
43
43
|
To build and install the development branch yourself from the latest source:
|
@@ -193,6 +193,15 @@ module Twilio
|
|
193
193
|
self.trusted_comms.branded_calls()
|
194
194
|
end
|
195
195
|
|
196
|
+
##
|
197
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
198
|
+
# Business.
|
199
|
+
# @return [Twilio::REST::Preview::TrustedComms::BusinessInstance] if sid was passed.
|
200
|
+
# @return [Twilio::REST::Preview::TrustedComms::BusinessList]
|
201
|
+
def businesses(sid=:unset)
|
202
|
+
self.trusted_comms.businesses(sid)
|
203
|
+
end
|
204
|
+
|
196
205
|
##
|
197
206
|
# @return [Twilio::REST::Preview::TrustedComms::CpsInstance]
|
198
207
|
def cps
|
@@ -16,6 +16,7 @@ module Twilio
|
|
16
16
|
super
|
17
17
|
@version = 'TrustedComms'
|
18
18
|
@branded_calls = nil
|
19
|
+
@businesses = nil
|
19
20
|
@cps = nil
|
20
21
|
@current_calls = nil
|
21
22
|
@devices = nil
|
@@ -28,6 +29,21 @@ module Twilio
|
|
28
29
|
@branded_calls ||= BrandedCallList.new self
|
29
30
|
end
|
30
31
|
|
32
|
+
##
|
33
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
34
|
+
# Business.
|
35
|
+
# @return [Twilio::REST::Preview::TrustedComms::BusinessContext] if sid was passed.
|
36
|
+
# @return [Twilio::REST::Preview::TrustedComms::BusinessList]
|
37
|
+
def businesses(sid=:unset)
|
38
|
+
if sid.nil?
|
39
|
+
raise ArgumentError, 'sid cannot be nil'
|
40
|
+
elsif sid == :unset
|
41
|
+
@businesses ||= BusinessList.new self
|
42
|
+
else
|
43
|
+
BusinessContext.new(self, sid)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
##
|
32
48
|
# @return [Twilio::REST::Preview::TrustedComms::CpsContext]
|
33
49
|
def cps
|
@@ -0,0 +1,219 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Preview < Domain
|
12
|
+
class TrustedComms < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
15
|
+
class BusinessList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the BusinessList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [BusinessList] BusinessList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'#<Twilio.Preview.TrustedComms.BusinessList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
36
|
+
class BusinessPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the BusinessPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [BusinessPage] BusinessPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of BusinessInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [BusinessInstance] BusinessInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
BusinessInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.Preview.TrustedComms.BusinessPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
67
|
+
class BusinessContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the BusinessContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
72
|
+
# Business.
|
73
|
+
# @return [BusinessContext] BusinessContext
|
74
|
+
def initialize(version, sid)
|
75
|
+
super(version)
|
76
|
+
|
77
|
+
# Path Solution
|
78
|
+
@solution = {sid: sid, }
|
79
|
+
@uri = "/Businesses/#{@solution[:sid]}"
|
80
|
+
|
81
|
+
# Dependents
|
82
|
+
@insights = nil
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Fetch a BusinessInstance
|
87
|
+
# @return [BusinessInstance] Fetched BusinessInstance
|
88
|
+
def fetch
|
89
|
+
params = Twilio::Values.of({})
|
90
|
+
|
91
|
+
payload = @version.fetch(
|
92
|
+
'GET',
|
93
|
+
@uri,
|
94
|
+
params,
|
95
|
+
)
|
96
|
+
|
97
|
+
BusinessInstance.new(@version, payload, sid: @solution[:sid], )
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Access the insights
|
102
|
+
# @return [InsightsList]
|
103
|
+
# @return [InsightsContext]
|
104
|
+
def insights
|
105
|
+
unless @insights
|
106
|
+
@insights = InsightsList.new(@version, business_sid: @solution[:sid], )
|
107
|
+
end
|
108
|
+
|
109
|
+
@insights
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Provide a user friendly representation
|
114
|
+
def to_s
|
115
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
116
|
+
"#<Twilio.Preview.TrustedComms.BusinessContext #{context}>"
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# Provide a detailed, user friendly representation
|
121
|
+
def inspect
|
122
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
123
|
+
"#<Twilio.Preview.TrustedComms.BusinessContext #{context}>"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
129
|
+
class BusinessInstance < InstanceResource
|
130
|
+
##
|
131
|
+
# Initialize the BusinessInstance
|
132
|
+
# @param [Version] version Version that contains the resource
|
133
|
+
# @param [Hash] payload payload that contains response from Twilio
|
134
|
+
# @param [String] sid A 34 character string that uniquely identifies this
|
135
|
+
# Business.
|
136
|
+
# @return [BusinessInstance] BusinessInstance
|
137
|
+
def initialize(version, payload, sid: nil)
|
138
|
+
super(version)
|
139
|
+
|
140
|
+
# Marshaled Properties
|
141
|
+
@properties = {
|
142
|
+
'account_sid' => payload['account_sid'],
|
143
|
+
'sid' => payload['sid'],
|
144
|
+
'url' => payload['url'],
|
145
|
+
'links' => payload['links'],
|
146
|
+
}
|
147
|
+
|
148
|
+
# Context
|
149
|
+
@instance_context = nil
|
150
|
+
@params = {'sid' => sid || @properties['sid'], }
|
151
|
+
end
|
152
|
+
|
153
|
+
##
|
154
|
+
# Generate an instance context for the instance, the context is capable of
|
155
|
+
# performing various actions. All instance actions are proxied to the context
|
156
|
+
# @return [BusinessContext] BusinessContext for this BusinessInstance
|
157
|
+
def context
|
158
|
+
unless @instance_context
|
159
|
+
@instance_context = BusinessContext.new(@version, @params['sid'], )
|
160
|
+
end
|
161
|
+
@instance_context
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# @return [String] Account Sid.
|
166
|
+
def account_sid
|
167
|
+
@properties['account_sid']
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# @return [String] A string that uniquely identifies this Business.
|
172
|
+
def sid
|
173
|
+
@properties['sid']
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# @return [String] The URL of this resource.
|
178
|
+
def url
|
179
|
+
@properties['url']
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# @return [String] Nested resource URLs.
|
184
|
+
def links
|
185
|
+
@properties['links']
|
186
|
+
end
|
187
|
+
|
188
|
+
##
|
189
|
+
# Fetch a BusinessInstance
|
190
|
+
# @return [BusinessInstance] Fetched BusinessInstance
|
191
|
+
def fetch
|
192
|
+
context.fetch
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# Access the insights
|
197
|
+
# @return [insights] insights
|
198
|
+
def insights
|
199
|
+
context.insights
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# Provide a user friendly representation
|
204
|
+
def to_s
|
205
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
206
|
+
"<Twilio.Preview.TrustedComms.BusinessInstance #{values}>"
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Provide a detailed, user friendly representation
|
211
|
+
def inspect
|
212
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
213
|
+
"<Twilio.Preview.TrustedComms.BusinessInstance #{values}>"
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|