sailthru-client 1.13 → 1.14
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.
- data/README.md +181 -169
- data/lib/sailthru.rb +44 -54
- metadata +7 -18
data/README.md
CHANGED
@@ -24,202 +24,214 @@ It can make requests to following [API calls](http://docs.sailthru.com/api):
|
|
24
24
|
|
25
25
|
Examples
|
26
26
|
--------
|
27
|
-
require 'sailthru' #if using as gem
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
api_url = "https://api.sailthru.com";
|
32
|
-
sailthru = Sailthru::SailthruClient.new(api_key, api_secret, api_url)
|
28
|
+
``` ruby
|
29
|
+
require 'sailthru' #if using as gem
|
33
30
|
|
34
|
-
|
31
|
+
api_key = "api_key";
|
32
|
+
api_secret = 'secret';
|
33
|
+
api_url = "https://api.sailthru.com";
|
34
|
+
sailthru = Sailthru::SailthruClient.new(api_key, api_secret, api_url)
|
35
|
+
```
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
37
|
+
### [send](http://docs.sailthru.com/api/send)
|
38
|
+
``` ruby
|
39
|
+
#send
|
40
|
+
template_name = 'my-template'
|
41
|
+
email = 'praj@sailthru.com'
|
42
|
+
vars = {'name' => 'Prajwal Tuladhar', "myvar" => [1111,2,3]}
|
43
|
+
options = {'test' => 1}
|
44
|
+
schedule_time = '+3 hours'
|
45
|
+
response = sailthru.send(template_name, email, vars, options, schedule_time)
|
46
|
+
|
47
|
+
#get send
|
48
|
+
send_id = '6363'
|
49
|
+
response = sailthru.get_send(send_id)
|
50
|
+
|
51
|
+
#cancel send
|
52
|
+
send_id = '236236sbs'
|
53
|
+
response = sailthru.cancel_send(send_id)
|
54
|
+
|
55
|
+
#multi send
|
56
|
+
template_name = 'my-template'
|
57
|
+
emails = 'praj@sailthru.com, ian@sailthru.com'
|
58
|
+
vars = {'name' => 'Prajwal Tuladhar', "myvar" => [1111,2,3]}
|
59
|
+
options = {'test' => 1}
|
60
|
+
response = sailthru.multi_send(template_name, emails, vars, options)
|
61
|
+
```
|
58
62
|
|
59
63
|
### [email](http://docs.sailthru.com/api/email)
|
64
|
+
``` ruby
|
65
|
+
#get email
|
66
|
+
email = 'praj@sailthru.com'
|
67
|
+
response = sailthru.get_email(email)
|
60
68
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#set email
|
66
|
-
email = 'praj@sailthru.com'
|
67
|
-
response = sailthru.set_email(email)
|
69
|
+
#set email
|
70
|
+
email = 'praj@sailthru.com'
|
71
|
+
response = sailthru.set_email(email)
|
72
|
+
```
|
68
73
|
|
69
74
|
### [blast](http://docs.sailthru.com/api/blast)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
75
|
+
``` ruby
|
76
|
+
#schedule blast
|
77
|
+
blast_name = 'My blast name'
|
78
|
+
template = 'my-template'
|
79
|
+
schedule_time = '+5 hours'
|
80
|
+
from_name = 'prajwal tuladhar'
|
81
|
+
from_email = 'praj@sailthru.com'
|
82
|
+
subject = "What's up!"
|
83
|
+
html = '<p>Lorem ispum is great</p>'
|
84
|
+
text = 'Lorem ispum is great'
|
85
|
+
response = sailthru.schedule_blast(blast_name, template, schedule_time, from_name, from_email, subject, html, text)
|
86
|
+
|
87
|
+
#schedule blast from template
|
88
|
+
template = 'default'
|
89
|
+
list = 'default'
|
90
|
+
schedule_time = 'now'
|
91
|
+
response = sailthru.schedule_blast_from_template(template, list, schedule_time)
|
92
|
+
|
93
|
+
#schedule blast from previous blast
|
94
|
+
blast_id = 67535
|
95
|
+
schedule_time ='now'
|
96
|
+
vars = {
|
97
|
+
'my_var' => '3y6366546363',
|
98
|
+
'my_var2' => [7,8,9],
|
99
|
+
'my_var3' => {'president' => 'obama', 'nested' => {'vp' => 'palin'}}
|
100
|
+
}
|
101
|
+
options = {:vars => vars}
|
102
|
+
response = sailthru.schedule_blast_from_blast(blast_id, "now", options)
|
103
|
+
|
104
|
+
#update blast
|
105
|
+
blast_id = 7886
|
106
|
+
name = 'prajwal tuladhar 64'
|
107
|
+
response = sailthru.update_blast(blast_id, name = name)
|
108
|
+
|
109
|
+
#get blast info
|
110
|
+
blast_id = 7886
|
111
|
+
response = sailthru.get_blast(blast_id)
|
112
|
+
|
113
|
+
#cancel blast
|
114
|
+
blast_id = 7886
|
115
|
+
response = sailthru.cancel_blast(blast_id)
|
116
|
+
|
117
|
+
#delete blast
|
118
|
+
blast_id = 7886
|
119
|
+
response = sailthru.delete_blast(blast_id)
|
120
|
+
```
|
116
121
|
|
117
122
|
### [list](http://docs.sailthru.com/api/list)
|
118
123
|
|
119
|
-
|
120
|
-
list_name = 'my-list'
|
121
|
-
emails = ['praj@sailthru.com', 'ian@sailthru.com']
|
122
|
-
response = sailthru.save_list(list_name, emails)
|
124
|
+
Get information about a list, or create a list.
|
123
125
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
126
|
+
``` ruby
|
127
|
+
#save list
|
128
|
+
list_name = 'my-list'
|
129
|
+
options = {
|
130
|
+
'primary' => 1,
|
131
|
+
}
|
132
|
+
response = sailthru.save_list(list_name, options)
|
128
133
|
|
129
|
-
|
130
|
-
|
131
|
-
|
134
|
+
#get list information
|
135
|
+
list_name = 'my-list'
|
136
|
+
response = sailthru.get_list(list_name)
|
132
137
|
|
133
|
-
|
138
|
+
#get all lists
|
139
|
+
response = sailthru.get_lists()
|
134
140
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
response = sailthru.import_contacts(email, password, with_names)
|
141
|
+
#delete list
|
142
|
+
list_name = 'my-list'
|
143
|
+
response = sailthru.delete_list(list_name)
|
144
|
+
```
|
140
145
|
|
141
146
|
### [content](http://docs.sailthru.com/api/content)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
147
|
+
``` ruby
|
148
|
+
#push content
|
149
|
+
title = 'hello world'
|
150
|
+
url = 'http://example.com/product-url'
|
151
|
+
response = sailthru.push_content(title, url)
|
152
|
+
|
153
|
+
#another push content exammple
|
154
|
+
title = 'hello world'
|
155
|
+
url = 'http://example.com/product-url'
|
156
|
+
tags = ["blue", "red", "green"]
|
157
|
+
vars = {'vars' => ['price' => 17299]}
|
158
|
+
date = nil
|
159
|
+
response = sailthru.push_content(title, url, date, tags = tags, vars = vars)
|
160
|
+
```
|
155
161
|
|
156
162
|
### [alert](http://docs.sailthru.com/api/alert)
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
163
|
+
``` ruby
|
164
|
+
#get alert info
|
165
|
+
email = 'praj@sailthru.com'
|
166
|
+
response = sailthru.get_alert(email)
|
167
|
+
|
168
|
+
#save alert
|
169
|
+
email = 'praj@sailthru.com'
|
170
|
+
type = 'daily'
|
171
|
+
_when = '+5 hours'
|
172
|
+
extras = {'tags' => ['red', 'blue'], 'match' => {'type' => 'yellow'}}
|
173
|
+
response = sailthru.save_alert(email, type, _when, extras)
|
174
|
+
|
175
|
+
#delete alert
|
176
|
+
email = 'praj@sailthru.com'
|
177
|
+
alert_id = '4d4b17a36763d930210007ba'
|
178
|
+
response = sailthru.delete_alert(email, alert_id)
|
179
|
+
``` ruby
|
173
180
|
|
174
181
|
### [purchase](http://docs.sailthru.com/api/purchase)
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
182
|
+
``` ruby
|
183
|
+
#purchase API call
|
184
|
+
email = 'praj@sailthru.com'
|
185
|
+
items = [{"price"=>1099, "qty"=>22, "title"=>"High-Impact Water Bottle", "url"=>"http://example.com/234/high-impact-water-bottle", "id"=>"234"}, {"price"=>500, "qty"=>2, "title"=>"Lorem Ispum", "url"=>"http://example.com/2304/lorem-ispum", "id"=>"2304"}]
|
186
|
+
response = sailthru.purchase(email, items)
|
187
|
+
```
|
180
188
|
|
181
189
|
### [stats](http://docs.sailthru.com/api/stats)
|
190
|
+
``` ruby
|
191
|
+
#stats list
|
192
|
+
response = sailthru.stats_list()
|
182
193
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
blast_id = 42382
|
188
|
-
response = sailthru.stats_blast(blast_id)
|
194
|
+
#stats blast
|
195
|
+
blast_id = 42382
|
196
|
+
response = sailthru.stats_blast(blast_id)
|
197
|
+
```
|
189
198
|
|
190
199
|
### [horizon](http://docs.sailthru.com/api/horizon)
|
200
|
+
``` ruby
|
201
|
+
#get horizon user info
|
202
|
+
email = 'praj@sailthru.com'
|
203
|
+
response = sailthru.get_horizon(email)
|
191
204
|
|
192
|
-
|
193
|
-
|
194
|
-
|
205
|
+
#set horizon data
|
206
|
+
email = 'praj@sailthru.com'
|
207
|
+
tags = ['red', 'blue']
|
208
|
+
response = sailthru.set_horizon(email, tags)
|
209
|
+
```
|
195
210
|
|
196
|
-
#set horizon data
|
197
|
-
email = 'praj@sailthru.com'
|
198
|
-
tags = ['red', 'blue']
|
199
|
-
response = sailthru.set_horizon(email, tags)
|
200
211
|
|
201
212
|
### [job] (http://docs.sailthru.com/api/job)
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
213
|
+
``` ruby
|
214
|
+
# get status of job id
|
215
|
+
job_id = '4dd58f036803fa3b5500000b'
|
216
|
+
response = sailthru.get_job_status(job_id)
|
217
|
+
|
218
|
+
# process import job for email string
|
219
|
+
list = 'test-list'
|
220
|
+
emails = 'a@a.com,b@b.com'
|
221
|
+
response = sailthru.process_import_job(list, emails)
|
222
|
+
|
223
|
+
# process import job from CSV or text file
|
224
|
+
list = 'test-list'
|
225
|
+
source_file = '/home/praj/Desktop/emails.txt'
|
226
|
+
response = sailthru.process_import_job(list, source_file)
|
227
|
+
|
228
|
+
# process snapshot job
|
229
|
+
query = {}
|
230
|
+
report_email = 'praj@sailthru.com'
|
231
|
+
postback_url = 'http://example.com/reports/snapshot_postback'
|
232
|
+
response = sailthru.process_snapshot_job(query)
|
233
|
+
|
234
|
+
# process export list job
|
235
|
+
list = 'test-list'
|
236
|
+
response = sailthru.process_export_list_job(list)
|
237
|
+
```
|
data/lib/sailthru.rb
CHANGED
@@ -9,7 +9,7 @@ require 'net/http/post/multipart'
|
|
9
9
|
|
10
10
|
module Sailthru
|
11
11
|
|
12
|
-
Version = VERSION = '1.
|
12
|
+
Version = VERSION = '1.14'
|
13
13
|
|
14
14
|
class SailthruClientException < Exception
|
15
15
|
end
|
@@ -87,7 +87,7 @@ module Sailthru
|
|
87
87
|
end
|
88
88
|
return f
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
end
|
92
92
|
|
93
93
|
class SailthruClient
|
@@ -101,11 +101,13 @@ module Sailthru
|
|
101
101
|
# secret, String
|
102
102
|
# api_uri, String
|
103
103
|
#
|
104
|
-
# Instantiate a new client; constructor optionally takes overrides for key/secret/uri.
|
105
|
-
def initialize(api_key, secret, api_uri = nil)
|
104
|
+
# Instantiate a new client; constructor optionally takes overrides for key/secret/uri and proxy server settings.
|
105
|
+
def initialize(api_key, secret, api_uri=nil, proxy_host=nil, proxy_port=nil)
|
106
106
|
@api_key = api_key
|
107
107
|
@secret = secret
|
108
108
|
@api_uri = if api_uri.nil? then 'https://api.sailthru.com' else api_uri end
|
109
|
+
@proxy_host = proxy_host
|
110
|
+
@proxy_port = proxy_port
|
109
111
|
@verify_ssl = true
|
110
112
|
end
|
111
113
|
|
@@ -200,7 +202,7 @@ module Sailthru
|
|
200
202
|
post[:schedule_time] = schedule_time
|
201
203
|
api_post(:blast, post)
|
202
204
|
end
|
203
|
-
|
205
|
+
|
204
206
|
|
205
207
|
# params
|
206
208
|
# blast_id, Fixnum | String
|
@@ -298,22 +300,6 @@ module Sailthru
|
|
298
300
|
self.api_post(:email, data)
|
299
301
|
end
|
300
302
|
|
301
|
-
# params:
|
302
|
-
# email, String
|
303
|
-
# password, String
|
304
|
-
# with_names, Boolean
|
305
|
-
# returns:
|
306
|
-
# Hash, response data from server
|
307
|
-
#
|
308
|
-
# Fetch email contacts from an address book at one of the major email providers (aol/gmail/hotmail/yahoo)
|
309
|
-
# Use the with_names parameter if you want to fetch the contact names as well as emails
|
310
|
-
def import_contacts(email, password, with_names = false)
|
311
|
-
data = { :email => email, :password => password }
|
312
|
-
data[:names] = 1 if with_names
|
313
|
-
self.api_post(:contacts, data)
|
314
|
-
end
|
315
|
-
|
316
|
-
|
317
303
|
# params:
|
318
304
|
# template_name, String
|
319
305
|
# returns:
|
@@ -337,7 +323,7 @@ module Sailthru
|
|
337
323
|
data[:template] = template_name
|
338
324
|
self.api_post(:template, data)
|
339
325
|
end
|
340
|
-
|
326
|
+
|
341
327
|
# params:
|
342
328
|
# template_name, String
|
343
329
|
# returns:
|
@@ -490,27 +476,29 @@ module Sailthru
|
|
490
476
|
|
491
477
|
# params
|
492
478
|
# list, String
|
493
|
-
# format, String
|
494
479
|
#
|
495
|
-
#
|
496
|
-
|
497
|
-
|
498
|
-
return api_get(:list, {:list => list, :format => format})
|
480
|
+
# Get information about a list.
|
481
|
+
def get_list(list)
|
482
|
+
return api_get(:list, {:list => list})
|
499
483
|
end
|
500
484
|
|
485
|
+
# params
|
486
|
+
#
|
487
|
+
# Get information about all lists
|
488
|
+
def get_lists()
|
489
|
+
return api_get(:list, {})
|
490
|
+
end
|
501
491
|
|
502
492
|
# params
|
503
493
|
# list, String
|
504
|
-
#
|
505
|
-
#
|
506
|
-
def save_list(list,
|
507
|
-
data =
|
494
|
+
# options, Hash
|
495
|
+
# Create a list, or update a list.
|
496
|
+
def save_list(list, options = {})
|
497
|
+
data = options
|
508
498
|
data[:list] = list
|
509
|
-
data[:emails] = (emails.class == Array) ? emails.join(',') : emails
|
510
499
|
return api_post(:list, data)
|
511
500
|
end
|
512
501
|
|
513
|
-
|
514
502
|
# params
|
515
503
|
# list, String
|
516
504
|
#
|
@@ -590,7 +578,7 @@ module Sailthru
|
|
590
578
|
def stats(data)
|
591
579
|
api_get(:stats, data)
|
592
580
|
end
|
593
|
-
|
581
|
+
|
594
582
|
# params
|
595
583
|
# job, String
|
596
584
|
# options, hash
|
@@ -605,21 +593,23 @@ module Sailthru
|
|
605
593
|
if !report_email.nil?
|
606
594
|
data['report_email'] = report_email
|
607
595
|
end
|
608
|
-
|
596
|
+
|
609
597
|
if !postback_url.nil?
|
610
598
|
data['postback_url'] = postback_url
|
611
599
|
end
|
612
600
|
api_post(:job, data, binary_key)
|
613
601
|
end
|
614
602
|
|
603
|
+
# params
|
604
|
+
# emails, String | Array
|
615
605
|
# implementation for import_job
|
616
606
|
def process_import_job(list, emails, report_email = nil, postback_url = nil)
|
617
607
|
data = {}
|
618
608
|
data['list'] = list
|
619
|
-
data['emails'] = emails
|
609
|
+
data['emails'] = Array(emails).join(',')
|
620
610
|
process_job(:import, data, report_email, postback_url)
|
621
611
|
end
|
622
|
-
|
612
|
+
|
623
613
|
# implementation for import job using file upload
|
624
614
|
def process_import_job_from_file(list, file_path, report_email = nil, postback_url = nil)
|
625
615
|
data = {}
|
@@ -627,26 +617,26 @@ module Sailthru
|
|
627
617
|
data['file'] = file_path
|
628
618
|
process_job(:import, data, report_email, postback_url, 'file')
|
629
619
|
end
|
630
|
-
|
620
|
+
|
631
621
|
# implementation for snapshot job
|
632
622
|
def process_snapshot_job(query = {}, report_email = nil, postback_url = nil)
|
633
623
|
data = {}
|
634
624
|
data['query'] = query
|
635
625
|
process_job(:snapshot, data, report_email, postback_url)
|
636
626
|
end
|
637
|
-
|
627
|
+
|
638
628
|
# implementation for export list job
|
639
629
|
def process_export_list_job(list, report_email = nil, postback_url = nil)
|
640
630
|
data = {}
|
641
631
|
data['list'] = list
|
642
632
|
process_job(:export_list_data, data, report_email, postback_url)
|
643
633
|
end
|
644
|
-
|
634
|
+
|
645
635
|
# get status of a job
|
646
636
|
def get_job_status(job_id)
|
647
637
|
api_get(:job, {'job_id' => job_id})
|
648
638
|
end
|
649
|
-
|
639
|
+
|
650
640
|
|
651
641
|
# Perform API GET request
|
652
642
|
def api_get(action, data)
|
@@ -662,7 +652,7 @@ module Sailthru
|
|
662
652
|
def api_delete(action, data)
|
663
653
|
api_request(action, data, 'DELETE')
|
664
654
|
end
|
665
|
-
|
655
|
+
|
666
656
|
protected
|
667
657
|
|
668
658
|
# params:
|
@@ -687,10 +677,10 @@ module Sailthru
|
|
687
677
|
data[:format] ||= 'json'
|
688
678
|
data[:sig] = get_signature_hash(data, @secret)
|
689
679
|
end
|
690
|
-
|
680
|
+
|
691
681
|
if (!binary_key.nil?)
|
692
682
|
data[binary_key] = binary_key_data
|
693
|
-
end
|
683
|
+
end
|
694
684
|
_result = self.http_request("#{@api_uri}/#{action}", data, request_type, binary_key)
|
695
685
|
|
696
686
|
# NOTE: don't do the unserialize here
|
@@ -714,18 +704,18 @@ module Sailthru
|
|
714
704
|
# String, body of response
|
715
705
|
def http_request(uri, data, method = 'POST', binary_key = nil)
|
716
706
|
data = flatten_nested_hash(data, false)
|
717
|
-
|
707
|
+
|
718
708
|
if method != 'POST'
|
719
709
|
uri += "?" + data.map{ |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}" }.join("&")
|
720
710
|
end
|
721
|
-
|
711
|
+
|
722
712
|
req = nil
|
723
713
|
headers = {"User-Agent" => "Sailthru API Ruby Client #{VERSION}"}
|
724
714
|
|
725
715
|
_uri = URI.parse(uri)
|
726
|
-
|
716
|
+
|
727
717
|
if method == 'POST'
|
728
|
-
if (!binary_key.nil?)
|
718
|
+
if (!binary_key.nil?)
|
729
719
|
binary_data = data[binary_key]
|
730
720
|
data[binary_key] = UploadIO.new(File.open(binary_data), "text/plain")
|
731
721
|
req = Net::HTTP::Post::Multipart.new(_uri.path, data)
|
@@ -733,7 +723,7 @@ module Sailthru
|
|
733
723
|
req = Net::HTTP::Post.new(_uri.path, headers)
|
734
724
|
req.set_form_data(data)
|
735
725
|
end
|
736
|
-
|
726
|
+
|
737
727
|
else
|
738
728
|
request_uri = "#{_uri.path}?#{_uri.query}"
|
739
729
|
if method == 'DELETE'
|
@@ -744,8 +734,8 @@ module Sailthru
|
|
744
734
|
end
|
745
735
|
|
746
736
|
begin
|
747
|
-
http = Net::HTTP.new(_uri.host, _uri.port)
|
748
|
-
|
737
|
+
http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(_uri.host, _uri.port)
|
738
|
+
|
749
739
|
if _uri.scheme == 'https'
|
750
740
|
http.use_ssl = true
|
751
741
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @verify_ssl != true # some openSSL client doesn't work without doing this
|
@@ -754,18 +744,18 @@ module Sailthru
|
|
754
744
|
response = http.start {
|
755
745
|
http.request(req)
|
756
746
|
}
|
757
|
-
|
747
|
+
|
758
748
|
rescue Exception => e
|
759
749
|
raise SailthruClientException.new("Unable to open stream: #{_uri}\n#{e}");
|
760
750
|
end
|
761
|
-
|
751
|
+
|
762
752
|
if response.body
|
763
753
|
return response.body
|
764
754
|
else
|
765
755
|
raise SailthruClientException.new("No response received from stream: #{_uri}")
|
766
756
|
end
|
767
757
|
end
|
768
|
-
|
758
|
+
|
769
759
|
def http_multipart_request(uri, data)
|
770
760
|
req = Net::HTTP::Post::Multipart.new url.path,
|
771
761
|
"file" => UploadIO.new(data['file'], "application/octet-stream")
|
metadata
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sailthru-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
7
|
+
- 14
|
8
|
+
version: "1.14"
|
10
9
|
platform: ruby
|
11
10
|
authors:
|
12
11
|
- Prajwal Tuladhar
|
@@ -14,17 +13,16 @@ autorequire:
|
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
15
|
|
17
|
-
date:
|
16
|
+
date: 2012-02-10 00:00:00 -05:00
|
17
|
+
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: json
|
21
21
|
prerelease: false
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
hash: 3
|
28
26
|
segments:
|
29
27
|
- 0
|
30
28
|
version: "0"
|
@@ -34,11 +32,9 @@ dependencies:
|
|
34
32
|
name: multipart-post
|
35
33
|
prerelease: false
|
36
34
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
35
|
requirements:
|
39
36
|
- - ">="
|
40
37
|
- !ruby/object:Gem::Version
|
41
|
-
hash: 3
|
42
38
|
segments:
|
43
39
|
- 0
|
44
40
|
version: "0"
|
@@ -48,11 +44,9 @@ dependencies:
|
|
48
44
|
name: fakeweb
|
49
45
|
prerelease: false
|
50
46
|
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
47
|
requirements:
|
53
48
|
- - ">="
|
54
49
|
- !ruby/object:Gem::Version
|
55
|
-
hash: 3
|
56
50
|
segments:
|
57
51
|
- 0
|
58
52
|
version: "0"
|
@@ -62,11 +56,9 @@ dependencies:
|
|
62
56
|
name: shoulda
|
63
57
|
prerelease: false
|
64
58
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
59
|
requirements:
|
67
60
|
- - ">="
|
68
61
|
- !ruby/object:Gem::Version
|
69
|
-
hash: 3
|
70
62
|
segments:
|
71
63
|
- 0
|
72
64
|
version: "0"
|
@@ -83,6 +75,7 @@ extra_rdoc_files:
|
|
83
75
|
files:
|
84
76
|
- README.md
|
85
77
|
- lib/sailthru.rb
|
78
|
+
has_rdoc: true
|
86
79
|
homepage: http://docs.sailthru.com
|
87
80
|
licenses: []
|
88
81
|
|
@@ -93,27 +86,23 @@ rdoc_options:
|
|
93
86
|
require_paths:
|
94
87
|
- lib
|
95
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
89
|
requirements:
|
98
90
|
- - ">="
|
99
91
|
- !ruby/object:Gem::Version
|
100
|
-
hash: 3
|
101
92
|
segments:
|
102
93
|
- 0
|
103
94
|
version: "0"
|
104
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
96
|
requirements:
|
107
97
|
- - ">="
|
108
98
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
99
|
segments:
|
111
100
|
- 0
|
112
101
|
version: "0"
|
113
102
|
requirements: []
|
114
103
|
|
115
104
|
rubyforge_project:
|
116
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 1.3.6
|
117
106
|
signing_key:
|
118
107
|
specification_version: 3
|
119
108
|
summary: A simple client library to remotely access the Sailthru REST API.
|