aws-sdk-sns 1.0.0.rc1 → 1.0.0.rc2

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.
@@ -1,266 +1,264 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module SNS
10
- class PlatformEndpoint
8
+ module Aws::SNS
9
+ class PlatformEndpoint
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
14
- # @overload def initialize(arn, options = {})
15
- # @param [String] arn
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :arn
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @arn = extract_arn(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
13
+ # @overload def initialize(arn, options = {})
14
+ # @param [String] arn
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :arn
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @arn = extract_arn(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def arn
31
- @arn
32
- end
28
+ # @return [String]
29
+ def arn
30
+ @arn
31
+ end
33
32
 
34
- # Attributes include the following:
35
- #
36
- # * `CustomUserData` -- arbitrary user data to associate with the
37
- # endpoint. Amazon SNS does not use this data. The data must be in
38
- # UTF-8 format and less than 2KB.
39
- #
40
- # * `Enabled` -- flag that enables/disables delivery to the endpoint.
41
- # Amazon SNS will set this to false when a notification service
42
- # indicates to Amazon SNS that the endpoint is invalid. Users can set
43
- # it back to true, typically after updating Token.
44
- #
45
- # * `Token` -- device token, also referred to as a registration id, for
46
- # an app and mobile device. This is returned from the notification
47
- # service when an app and mobile device are registered with the
48
- # notification service.
49
- # @return [Hash<String,String>]
50
- def attributes
51
- data.attributes
52
- end
33
+ # Attributes include the following:
34
+ #
35
+ # * `CustomUserData` -- arbitrary user data to associate with the
36
+ # endpoint. Amazon SNS does not use this data. The data must be in
37
+ # UTF-8 format and less than 2KB.
38
+ #
39
+ # * `Enabled` -- flag that enables/disables delivery to the endpoint.
40
+ # Amazon SNS will set this to false when a notification service
41
+ # indicates to Amazon SNS that the endpoint is invalid. Users can set
42
+ # it back to true, typically after updating Token.
43
+ #
44
+ # * `Token` -- device token, also referred to as a registration id, for
45
+ # an app and mobile device. This is returned from the notification
46
+ # service when an app and mobile device are registered with the
47
+ # notification service.
48
+ # @return [Hash<String,String>]
49
+ def attributes
50
+ data.attributes
51
+ end
53
52
 
54
- # @!endgroup
53
+ # @!endgroup
55
54
 
56
- # @return [Client]
57
- def client
58
- @client
59
- end
55
+ # @return [Client]
56
+ def client
57
+ @client
58
+ end
60
59
 
61
- # Loads, or reloads {#data} for the current {PlatformEndpoint}.
62
- # Returns `self` making it possible to chain methods.
63
- #
64
- # platform_endpoint.reload.data
65
- #
66
- # @return [self]
67
- def load
68
- resp = @client.get_endpoint_attributes(endpoint_arn: @arn)
69
- @data = resp.data
70
- self
71
- end
72
- alias :reload :load
60
+ # Loads, or reloads {#data} for the current {PlatformEndpoint}.
61
+ # Returns `self` making it possible to chain methods.
62
+ #
63
+ # platform_endpoint.reload.data
64
+ #
65
+ # @return [self]
66
+ def load
67
+ resp = @client.get_endpoint_attributes(endpoint_arn: @arn)
68
+ @data = resp.data
69
+ self
70
+ end
71
+ alias :reload :load
73
72
 
74
- # @return [Types::GetEndpointAttributesResponse]
75
- # Returns the data for this {PlatformEndpoint}. Calls
76
- # {Client#get_endpoint_attributes} if {#data_loaded?} is `false`.
77
- def data
78
- load unless @data
79
- @data
80
- end
73
+ # @return [Types::GetEndpointAttributesResponse]
74
+ # Returns the data for this {PlatformEndpoint}. Calls
75
+ # {Client#get_endpoint_attributes} if {#data_loaded?} is `false`.
76
+ def data
77
+ load unless @data
78
+ @data
79
+ end
81
80
 
82
- # @return [Boolean]
83
- # Returns `true` if this resource is loaded. Accessing attributes or
84
- # {#data} on an unloaded resource will trigger a call to {#load}.
85
- def data_loaded?
86
- !!@data
87
- end
81
+ # @return [Boolean]
82
+ # Returns `true` if this resource is loaded. Accessing attributes or
83
+ # {#data} on an unloaded resource will trigger a call to {#load}.
84
+ def data_loaded?
85
+ !!@data
86
+ end
88
87
 
89
- # @!group Actions
88
+ # @!group Actions
90
89
 
91
- # @example Request syntax with placeholder values
92
- #
93
- # platform_endpoint.delete()
94
- # @param [Hash] options ({})
95
- # @return [EmptyStructure]
96
- def delete(options = {})
97
- options = options.merge(endpoint_arn: @arn)
98
- resp = @client.delete_endpoint(options)
99
- resp.data
100
- end
90
+ # @example Request syntax with placeholder values
91
+ #
92
+ # platform_endpoint.delete()
93
+ # @param [Hash] options ({})
94
+ # @return [EmptyStructure]
95
+ def delete(options = {})
96
+ options = options.merge(endpoint_arn: @arn)
97
+ resp = @client.delete_endpoint(options)
98
+ resp.data
99
+ end
101
100
 
102
- # @example Request syntax with placeholder values
103
- #
104
- # platform_endpoint.publish({
105
- # topic_arn: "topicARN",
106
- # phone_number: "String",
107
- # message: "message", # required
108
- # subject: "subject",
109
- # message_structure: "messageStructure",
110
- # message_attributes: {
111
- # "String" => {
112
- # data_type: "String", # required
113
- # string_value: "String",
114
- # binary_value: "data",
115
- # },
116
- # },
117
- # })
118
- # @param [Hash] options ({})
119
- # @option options [String] :topic_arn
120
- # The topic you want to publish to.
121
- #
122
- # If you don't specify a value for the `TopicArn` parameter, you must
123
- # specify a value for the `PhoneNumber` or `TargetArn` parameters.
124
- # @option options [String] :phone_number
125
- # The phone number to which you want to deliver an SMS message. Use
126
- # E.164 format.
127
- #
128
- # If you don't specify a value for the `PhoneNumber` parameter, you
129
- # must specify a value for the `TargetArn` or `TopicArn` parameters.
130
- # @option options [required, String] :message
131
- # The message you want to send to the topic.
132
- #
133
- # If you want to send the same message to all transport protocols,
134
- # include the text of the message as a String value.
135
- #
136
- # If you want to send different messages for each transport protocol,
137
- # set the value of the `MessageStructure` parameter to `json` and use a
138
- # JSON object for the `Message` parameter.
139
- #
140
- # Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
141
- # size (262144 bytes, not 262144 characters).
142
- #
143
- # JSON-specific constraints:
144
- #
145
- # * Keys in the JSON object that correspond to supported transport
146
- # protocols must have simple JSON string values.
147
- #
148
- # * The values will be parsed (unescaped) before they are used in
149
- # outgoing messages.
150
- #
151
- # * Outbound notifications are JSON encoded (meaning that the characters
152
- # will be reescaped for sending).
153
- #
154
- # * Values have a minimum length of 0 (the empty string, "", is
155
- # allowed).
156
- #
157
- # * Values have a maximum length bounded by the overall message size
158
- # (so, including multiple protocols may limit message sizes).
159
- #
160
- # * Non-string values will cause the key to be ignored.
161
- #
162
- # * Keys that do not correspond to supported transport protocols are
163
- # ignored.
164
- #
165
- # * Duplicate keys are not allowed.
166
- #
167
- # * Failure to parse or validate any key or value in the message will
168
- # cause the `Publish` call to return an error (no partial delivery).
169
- # @option options [String] :subject
170
- # Optional parameter to be used as the "Subject" line when the message
171
- # is delivered to email endpoints. This field will also be included, if
172
- # present, in the standard JSON messages delivered to other endpoints.
173
- #
174
- # Constraints: Subjects must be ASCII text that begins with a letter,
175
- # number, or punctuation mark; must not include line breaks or control
176
- # characters; and must be less than 100 characters long.
177
- # @option options [String] :message_structure
178
- # Set `MessageStructure` to `json` if you want to send a different
179
- # message for each protocol. For example, using one publish action, you
180
- # can send a short message to your SMS subscribers and a longer message
181
- # to your email subscribers. If you set `MessageStructure` to `json`,
182
- # the value of the `Message` parameter must:
183
- #
184
- # * be a syntactically valid JSON object; and
185
- #
186
- # * contain at least a top-level JSON key of "default" with a value
187
- # that is a string.
188
- #
189
- # You can define other top-level keys that define the message you want
190
- # to send to a specific transport protocol (e.g., "http").
191
- #
192
- # For information about sending different messages for each protocol
193
- # using the AWS Management Console, go to [Create Different Messages for
194
- # Each Protocol][1] in the *Amazon Simple Notification Service Getting
195
- # Started Guide*.
196
- #
197
- # Valid value: `json`
198
- #
199
- #
200
- #
201
- # [1]: http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol
202
- # @option options [Hash<String,Types::MessageAttributeValue>] :message_attributes
203
- # Message attributes for Publish action.
204
- # @return [Types::PublishResponse]
205
- def publish(options = {})
206
- options = options.merge(target_arn: @arn)
207
- resp = @client.publish(options)
208
- resp.data
209
- end
101
+ # @example Request syntax with placeholder values
102
+ #
103
+ # platform_endpoint.publish({
104
+ # topic_arn: "topicARN",
105
+ # phone_number: "String",
106
+ # message: "message", # required
107
+ # subject: "subject",
108
+ # message_structure: "messageStructure",
109
+ # message_attributes: {
110
+ # "String" => {
111
+ # data_type: "String", # required
112
+ # string_value: "String",
113
+ # binary_value: "data",
114
+ # },
115
+ # },
116
+ # })
117
+ # @param [Hash] options ({})
118
+ # @option options [String] :topic_arn
119
+ # The topic you want to publish to.
120
+ #
121
+ # If you don't specify a value for the `TopicArn` parameter, you must
122
+ # specify a value for the `PhoneNumber` or `TargetArn` parameters.
123
+ # @option options [String] :phone_number
124
+ # The phone number to which you want to deliver an SMS message. Use
125
+ # E.164 format.
126
+ #
127
+ # If you don't specify a value for the `PhoneNumber` parameter, you
128
+ # must specify a value for the `TargetArn` or `TopicArn` parameters.
129
+ # @option options [required, String] :message
130
+ # The message you want to send to the topic.
131
+ #
132
+ # If you want to send the same message to all transport protocols,
133
+ # include the text of the message as a String value.
134
+ #
135
+ # If you want to send different messages for each transport protocol,
136
+ # set the value of the `MessageStructure` parameter to `json` and use a
137
+ # JSON object for the `Message` parameter.
138
+ #
139
+ # Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
140
+ # size (262144 bytes, not 262144 characters).
141
+ #
142
+ # JSON-specific constraints:
143
+ #
144
+ # * Keys in the JSON object that correspond to supported transport
145
+ # protocols must have simple JSON string values.
146
+ #
147
+ # * The values will be parsed (unescaped) before they are used in
148
+ # outgoing messages.
149
+ #
150
+ # * Outbound notifications are JSON encoded (meaning that the characters
151
+ # will be reescaped for sending).
152
+ #
153
+ # * Values have a minimum length of 0 (the empty string, "", is
154
+ # allowed).
155
+ #
156
+ # * Values have a maximum length bounded by the overall message size
157
+ # (so, including multiple protocols may limit message sizes).
158
+ #
159
+ # * Non-string values will cause the key to be ignored.
160
+ #
161
+ # * Keys that do not correspond to supported transport protocols are
162
+ # ignored.
163
+ #
164
+ # * Duplicate keys are not allowed.
165
+ #
166
+ # * Failure to parse or validate any key or value in the message will
167
+ # cause the `Publish` call to return an error (no partial delivery).
168
+ # @option options [String] :subject
169
+ # Optional parameter to be used as the "Subject" line when the message
170
+ # is delivered to email endpoints. This field will also be included, if
171
+ # present, in the standard JSON messages delivered to other endpoints.
172
+ #
173
+ # Constraints: Subjects must be ASCII text that begins with a letter,
174
+ # number, or punctuation mark; must not include line breaks or control
175
+ # characters; and must be less than 100 characters long.
176
+ # @option options [String] :message_structure
177
+ # Set `MessageStructure` to `json` if you want to send a different
178
+ # message for each protocol. For example, using one publish action, you
179
+ # can send a short message to your SMS subscribers and a longer message
180
+ # to your email subscribers. If you set `MessageStructure` to `json`,
181
+ # the value of the `Message` parameter must:
182
+ #
183
+ # * be a syntactically valid JSON object; and
184
+ #
185
+ # * contain at least a top-level JSON key of "default" with a value
186
+ # that is a string.
187
+ #
188
+ # You can define other top-level keys that define the message you want
189
+ # to send to a specific transport protocol (e.g., "http").
190
+ #
191
+ # For information about sending different messages for each protocol
192
+ # using the AWS Management Console, go to [Create Different Messages for
193
+ # Each Protocol][1] in the *Amazon Simple Notification Service Getting
194
+ # Started Guide*.
195
+ #
196
+ # Valid value: `json`
197
+ #
198
+ #
199
+ #
200
+ # [1]: http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol
201
+ # @option options [Hash<String,Types::MessageAttributeValue>] :message_attributes
202
+ # Message attributes for Publish action.
203
+ # @return [Types::PublishResponse]
204
+ def publish(options = {})
205
+ options = options.merge(target_arn: @arn)
206
+ resp = @client.publish(options)
207
+ resp.data
208
+ end
210
209
 
211
- # @example Request syntax with placeholder values
212
- #
213
- # platform_endpoint.set_attributes({
214
- # attributes: { # required
215
- # "String" => "String",
216
- # },
217
- # })
218
- # @param [Hash] options ({})
219
- # @option options [required, Hash<String,String>] :attributes
220
- # A map of the endpoint attributes. Attributes in this map include the
221
- # following:
222
- #
223
- # * `CustomUserData` -- arbitrary user data to associate with the
224
- # endpoint. Amazon SNS does not use this data. The data must be in
225
- # UTF-8 format and less than 2KB.
226
- #
227
- # * `Enabled` -- flag that enables/disables delivery to the endpoint.
228
- # Amazon SNS will set this to false when a notification service
229
- # indicates to Amazon SNS that the endpoint is invalid. Users can set
230
- # it back to true, typically after updating Token.
231
- #
232
- # * `Token` -- device token, also referred to as a registration id, for
233
- # an app and mobile device. This is returned from the notification
234
- # service when an app and mobile device are registered with the
235
- # notification service.
236
- # @return [EmptyStructure]
237
- def set_attributes(options = {})
238
- options = options.merge(endpoint_arn: @arn)
239
- resp = @client.set_endpoint_attributes(options)
240
- resp.data
241
- end
210
+ # @example Request syntax with placeholder values
211
+ #
212
+ # platform_endpoint.set_attributes({
213
+ # attributes: { # required
214
+ # "String" => "String",
215
+ # },
216
+ # })
217
+ # @param [Hash] options ({})
218
+ # @option options [required, Hash<String,String>] :attributes
219
+ # A map of the endpoint attributes. Attributes in this map include the
220
+ # following:
221
+ #
222
+ # * `CustomUserData` -- arbitrary user data to associate with the
223
+ # endpoint. Amazon SNS does not use this data. The data must be in
224
+ # UTF-8 format and less than 2KB.
225
+ #
226
+ # * `Enabled` -- flag that enables/disables delivery to the endpoint.
227
+ # Amazon SNS will set this to false when a notification service
228
+ # indicates to Amazon SNS that the endpoint is invalid. Users can set
229
+ # it back to true, typically after updating Token.
230
+ #
231
+ # * `Token` -- device token, also referred to as a registration id, for
232
+ # an app and mobile device. This is returned from the notification
233
+ # service when an app and mobile device are registered with the
234
+ # notification service.
235
+ # @return [EmptyStructure]
236
+ def set_attributes(options = {})
237
+ options = options.merge(endpoint_arn: @arn)
238
+ resp = @client.set_endpoint_attributes(options)
239
+ resp.data
240
+ end
242
241
 
243
- # @deprecated
244
- # @api private
245
- def identifiers
246
- { arn: @arn }
247
- end
248
- deprecated(:identifiers)
242
+ # @deprecated
243
+ # @api private
244
+ def identifiers
245
+ { arn: @arn }
246
+ end
247
+ deprecated(:identifiers)
249
248
 
250
- private
249
+ private
251
250
 
252
- def extract_arn(args, options)
253
- value = args[0] || options.delete(:arn)
254
- case value
255
- when String then value
256
- when nil then raise ArgumentError, "missing required option :arn"
257
- else
258
- msg = "expected :arn to be a String, got #{value.class}"
259
- raise ArgumentError, msg
260
- end
251
+ def extract_arn(args, options)
252
+ value = args[0] || options.delete(:arn)
253
+ case value
254
+ when String then value
255
+ when nil then raise ArgumentError, "missing required option :arn"
256
+ else
257
+ msg = "expected :arn to be a String, got #{value.class}"
258
+ raise ArgumentError, msg
261
259
  end
262
-
263
- class Collection < Aws::Resources::Collection; end
264
260
  end
261
+
262
+ class Collection < Aws::Resources::Collection; end
265
263
  end
266
264
  end