tms_client 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +26 -0
- data/lib/tms_client/client.rb +1 -1
- data/lib/tms_client/instance_resource.rb +3 -0
- data/lib/tms_client/resource/collections.rb +4 -0
- data/lib/tms_client/resource/webhook.rb +20 -0
- data/lib/tms_client/util/hal_link_parser.rb +0 -4
- data/lib/tms_client/version.rb +1 -1
- data/lib/tms_client.rb +1 -0
- metadata +27 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 28f2987f06ad23d327d06b2d38eb054259045dd6
|
4
|
+
data.tar.gz: 76870cb343e8a97e0303908a24191cea6bb9915b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d2e771630e5b9f77af2edf27a5ed9276d1ebced7d8f47cd74ff660088aa09dc03176cb73a26d525e41be72171e18b293852519abf827c88812670a36a9c5860
|
7
|
+
data.tar.gz: d0263120ec36f712428cc97de967153c4706ee5610560cf8cabfecf5680e1bc8f4bbd7bf9fae02f61b4b275f05b29cabdeade2b212a82b267eec9d5370d39c17
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/govdelivery/tms_client.svg?branch=master)](https://travis-ci.org/govdelivery/tms_client)
|
2
|
+
|
1
3
|
TMS Client
|
2
4
|
===========
|
3
5
|
This is a reference Ruby client to interact with the GovDelivery TMS REST API.
|
@@ -22,6 +24,7 @@ Connecting
|
|
22
24
|
Loading an instance of `TMS::Client` will automatically connect to the API to query the available resources for your account.
|
23
25
|
|
24
26
|
```ruby
|
27
|
+
# default api root endpoint is https://tms.govdelivery.com
|
25
28
|
client = TMS::Client.new('auth_token', :api_root => 'https://stage-tms.govdelivery.com')
|
26
29
|
```
|
27
30
|
|
@@ -111,6 +114,29 @@ alert.post # true
|
|
111
114
|
alert.ipaws_response # { "identifier"=>"CAP12-TEST-1397743203", "statuses"=> [{"CHANNELNAME"=>"CAPEXCH" ... }]}
|
112
115
|
```
|
113
116
|
|
117
|
+
|
118
|
+
Webhooks
|
119
|
+
-------
|
120
|
+
### POST to a URL when a recipient is blacklisted (i.e. to remove from your list)
|
121
|
+
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
webhook = client.webhooks.build(:url=>'http://your.url', :event_type=>'blacklisted')
|
125
|
+
webhook.post # true
|
126
|
+
```
|
127
|
+
|
128
|
+
POSTs will include in the body the following attributes:
|
129
|
+
|
130
|
+
attribute | description
|
131
|
+
------------- | -------------
|
132
|
+
message_type | 'sms', 'email', or 'voice'
|
133
|
+
status: | message state
|
134
|
+
recipient_url | recipient URL
|
135
|
+
messsage_url | message URL
|
136
|
+
error_message | (failures only)
|
137
|
+
completed_at | (sent or failed recipients only)
|
138
|
+
|
139
|
+
|
114
140
|
Metrics
|
115
141
|
-------
|
116
142
|
### Viewing recipients that clicked on a link in an email
|
data/lib/tms_client/client.rb
CHANGED
@@ -5,6 +5,8 @@ module TMS::InstanceResource
|
|
5
5
|
base.send(:include, InstanceMethods)
|
6
6
|
end
|
7
7
|
|
8
|
+
attr_accessor :response
|
9
|
+
|
8
10
|
module ClassMethods
|
9
11
|
##
|
10
12
|
# Writeable attributes are sent on POST/PUT.
|
@@ -149,6 +151,7 @@ module TMS::InstanceResource
|
|
149
151
|
end
|
150
152
|
|
151
153
|
def process_response(response, method)
|
154
|
+
self.response = response
|
152
155
|
error_class = TMS::Errors.const_get("Invalid#{method.to_s.capitalize}")
|
153
156
|
case response.status
|
154
157
|
when 204
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module TMS #:nodoc:
|
2
|
+
# A Webhook gets invoked when a recipient enters a queued or final state
|
3
|
+
#
|
4
|
+
# @attr url [String] The URL to POST webhooks to
|
5
|
+
# @attr event_type 'sending', 'inconclusive', 'blacklisted', 'sent', 'canceled', or 'failed'
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# webhook = client.webhooks.build(:url => 'http://your.url', :event_type => 'failed')
|
9
|
+
# webhook.post
|
10
|
+
# webhook.get
|
11
|
+
class Webhook
|
12
|
+
include InstanceResource
|
13
|
+
|
14
|
+
# @!parse attr_accessor :url, :event_type
|
15
|
+
writeable_attributes :url, :event_type
|
16
|
+
|
17
|
+
# @!parse attr_reader :created_at, :updated_at
|
18
|
+
readonly_attributes :created_at, :updated_at
|
19
|
+
end
|
20
|
+
end
|
data/lib/tms_client/version.rb
CHANGED
data/lib/tms_client.rb
CHANGED
metadata
CHANGED
@@ -1,65 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tms_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- GovDelivery
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: faraday
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: faraday_middleware
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
|
-
description:
|
55
|
+
description: "A reference implementation, written in Ruby, \n to
|
63
56
|
interact with GovDelivery's TMS API. The client is \n compatible
|
64
57
|
with Ruby 1.9 and 2.0. "
|
65
58
|
email:
|
@@ -81,7 +74,17 @@ files:
|
|
81
74
|
- Gemfile
|
82
75
|
- README.md
|
83
76
|
- Rakefile
|
84
|
-
-
|
77
|
+
- bin/autospec
|
78
|
+
- bin/htmldiff
|
79
|
+
- bin/ldiff
|
80
|
+
- bin/rake
|
81
|
+
- bin/redcarpet
|
82
|
+
- bin/rspec
|
83
|
+
- bin/tt
|
84
|
+
- bin/yard
|
85
|
+
- bin/yardoc
|
86
|
+
- bin/yri
|
87
|
+
- lib/tms_client.rb
|
85
88
|
- lib/tms_client/base.rb
|
86
89
|
- lib/tms_client/client.rb
|
87
90
|
- lib/tms_client/collection_resource.rb
|
@@ -114,10 +117,10 @@ files:
|
|
114
117
|
- lib/tms_client/resource/recipient.rb
|
115
118
|
- lib/tms_client/resource/sms_message.rb
|
116
119
|
- lib/tms_client/resource/voice_message.rb
|
120
|
+
- lib/tms_client/resource/webhook.rb
|
117
121
|
- lib/tms_client/util/core_ext.rb
|
118
122
|
- lib/tms_client/util/hal_link_parser.rb
|
119
123
|
- lib/tms_client/version.rb
|
120
|
-
- lib/tms_client.rb
|
121
124
|
- spec/client_spec.rb
|
122
125
|
- spec/command_types_spec.rb
|
123
126
|
- spec/email_message_spec.rb
|
@@ -138,45 +141,29 @@ files:
|
|
138
141
|
- spec/tms_client_spec.rb
|
139
142
|
- spec/voice_message_spec.rb
|
140
143
|
- spec/voice_messages_spec.rb
|
141
|
-
-
|
142
|
-
- bin/htmldiff
|
143
|
-
- bin/ldiff
|
144
|
-
- bin/rake
|
145
|
-
- bin/redcarpet
|
146
|
-
- bin/rspec
|
147
|
-
- bin/tt
|
148
|
-
- bin/yard
|
149
|
-
- bin/yardoc
|
150
|
-
- bin/yri
|
144
|
+
- tms_client.gemspec
|
151
145
|
homepage: http://govdelivery.com
|
152
146
|
licenses: []
|
147
|
+
metadata: {}
|
153
148
|
post_install_message:
|
154
149
|
rdoc_options: []
|
155
150
|
require_paths:
|
156
151
|
- lib
|
157
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
-
none: false
|
159
153
|
requirements:
|
160
|
-
- -
|
154
|
+
- - ">="
|
161
155
|
- !ruby/object:Gem::Version
|
162
156
|
version: '0'
|
163
|
-
segments:
|
164
|
-
- 0
|
165
|
-
hash: -3231966882544892365
|
166
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
-
none: false
|
168
158
|
requirements:
|
169
|
-
- -
|
159
|
+
- - ">="
|
170
160
|
- !ruby/object:Gem::Version
|
171
161
|
version: '0'
|
172
|
-
segments:
|
173
|
-
- 0
|
174
|
-
hash: -3231966882544892365
|
175
162
|
requirements: []
|
176
163
|
rubyforge_project:
|
177
|
-
rubygems_version:
|
164
|
+
rubygems_version: 2.2.2
|
178
165
|
signing_key:
|
179
|
-
specification_version:
|
166
|
+
specification_version: 4
|
180
167
|
summary: A ruby client to interact with the GovDelivery TMS REST API.
|
181
168
|
test_files:
|
182
169
|
- spec/client_spec.rb
|