postful 0.1.1 → 0.2.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.
- data/doc/classes/Postful/Letter.html +60 -60
- data/doc/classes/Postful/Letter.src/M000018.html +4 -4
- data/doc/classes/Postful/Letter.src/M000019.html +4 -4
- data/doc/classes/Postful/Letter.src/M000020.html +4 -4
- data/doc/classes/Postful/Letter.src/M000021.html +4 -4
- data/doc/classes/Postful/Letter.src/M000022.html +4 -4
- data/doc/classes/Postful/Letter.src/M000023.html +4 -4
- data/doc/classes/Postful/Letter.src/M000024.html +4 -4
- data/doc/classes/Postful/Letter.src/M000025.html +4 -4
- data/doc/classes/Postful/Letter.src/M000026.html +4 -4
- data/doc/classes/Postful/Letter.src/{M000016.html → M000027.html} +4 -4
- data/doc/classes/Postful/Letter.src/{M000017.html → M000028.html} +4 -4
- data/doc/classes/Postful/Letter.src/{M000015.html → M000029.html} +4 -4
- data/doc/classes/Postful/Postcard.html +222 -0
- data/doc/classes/Postful/{Service.src → Postcard.src}/M000011.html +4 -5
- data/doc/classes/Postful/Postcard.src/M000012.html +18 -0
- data/doc/classes/Postful/Postcard.src/M000013.html +18 -0
- data/doc/classes/Postful/Service.html +20 -20
- data/doc/classes/Postful/Service.src/M000014.html +5 -10
- data/doc/classes/Postful/Service.src/{M000012.html → M000015.html} +0 -0
- data/doc/classes/Postful/Service.src/{M000013.html → M000016.html} +0 -0
- data/doc/classes/Postful/Service.src/M000017.html +24 -0
- data/doc/created.rid +1 -1
- data/doc/files/README.html +42 -2
- data/doc/files/lib/postful/base_rb.html +1 -1
- data/doc/files/lib/postful/letter_rb.html +1 -1
- data/doc/files/lib/postful/postcard_rb.html +109 -0
- data/doc/files/lib/postful/service_rb.html +1 -1
- data/doc/files/lib/postful/util_rb.html +1 -1
- data/doc/files/lib/postful_rb.html +2 -1
- data/doc/fr_class_index.html +1 -0
- data/doc/fr_file_index.html +1 -0
- data/doc/fr_method_index.html +19 -16
- data/lib/postful.rb +2 -1
- data/lib/postful/base.rb +0 -1
- data/lib/postful/letter.rb +7 -3
- data/lib/postful/postcard.rb +162 -0
- data/lib/postful/util.rb +10 -7
- data/test/suite.rb +1 -0
- data/test/test_letter.rb +2 -2
- data/test/test_postcard.rb +104 -2
- metadata +15 -8
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>File: postcard.rb</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="fileHeader">
|
|
50
|
+
<h1>postcard.rb</h1>
|
|
51
|
+
<table class="header-table">
|
|
52
|
+
<tr class="top-aligned-row">
|
|
53
|
+
<td><strong>Path:</strong></td>
|
|
54
|
+
<td>lib/postful/postcard.rb
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr class="top-aligned-row">
|
|
58
|
+
<td><strong>Last Update:</strong></td>
|
|
59
|
+
<td>Tue Aug 12 17:56:30 -0700 2008</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</div>
|
|
63
|
+
<!-- banner header -->
|
|
64
|
+
|
|
65
|
+
<div id="bodyContent">
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<div id="contextContent">
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
<div id="requires-list">
|
|
73
|
+
<h3 class="section-bar">Required files</h3>
|
|
74
|
+
|
|
75
|
+
<div class="name-list">
|
|
76
|
+
net/https
|
|
77
|
+
builder
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<!-- if includes -->
|
|
88
|
+
|
|
89
|
+
<div id="section">
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
<!-- if method_list -->
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<div id="validator-badges">
|
|
105
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
</body>
|
|
109
|
+
</html>
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Mon Aug 11 14:14:29 -0700 2008</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
postful/base
|
|
77
77
|
postful/letter
|
|
78
78
|
postful/service
|
|
79
|
+
postful/postcard
|
|
79
80
|
</div>
|
|
80
81
|
</div>
|
|
81
82
|
|
data/doc/fr_class_index.html
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
<a href="classes/Postful/Letter.html">Postful::Letter</a><br />
|
|
27
27
|
<a href="classes/Postful/NotFoundException.html">Postful::NotFoundException</a><br />
|
|
28
28
|
<a href="classes/Postful/Order.html">Postful::Order</a><br />
|
|
29
|
+
<a href="classes/Postful/Postcard.html">Postful::Postcard</a><br />
|
|
29
30
|
<a href="classes/Postful/Service.html">Postful::Service</a><br />
|
|
30
31
|
<a href="classes/Postful/UnknownResponseException.html">Postful::UnknownResponseException</a><br />
|
|
31
32
|
<a href="classes/Postful/ValidationException.html">Postful::ValidationException</a><br />
|
data/doc/fr_file_index.html
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
<a href="files/lib/postful/instance_exec_module_rb.html">lib/postful/instance_exec_module.rb</a><br />
|
|
28
28
|
<a href="files/lib/postful/letter_rb.html">lib/postful/letter.rb</a><br />
|
|
29
29
|
<a href="files/lib/postful/order_rb.html">lib/postful/order.rb</a><br />
|
|
30
|
+
<a href="files/lib/postful/postcard_rb.html">lib/postful/postcard.rb</a><br />
|
|
30
31
|
<a href="files/lib/postful/service_rb.html">lib/postful/service.rb</a><br />
|
|
31
32
|
<a href="files/lib/postful/util_rb.html">lib/postful/util.rb</a><br />
|
|
32
33
|
</div>
|
data/doc/fr_method_index.html
CHANGED
|
@@ -21,27 +21,30 @@
|
|
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
|
22
22
|
<div id="index-entries">
|
|
23
23
|
<a href="classes/Postful/Base.html#M000002">add_address (Postful::Base)</a><br />
|
|
24
|
-
<a href="classes/Postful/
|
|
25
|
-
<a href="classes/Postful/Letter.html#
|
|
24
|
+
<a href="classes/Postful/Postcard.html#M000013">add_border (Postful::Postcard)</a><br />
|
|
25
|
+
<a href="classes/Postful/Letter.html#M000018">add_html_document (Postful::Letter)</a><br />
|
|
26
|
+
<a href="classes/Postful/Letter.html#M000019">add_html_document_from_file (Postful::Letter)</a><br />
|
|
26
27
|
<a href="classes/Postful/Base.html#M000003">add_international_address (Postful::Base)</a><br />
|
|
27
|
-
<a href="classes/Postful/Letter.html#
|
|
28
|
-
<a href="classes/Postful/Letter.html#
|
|
29
|
-
<a href="classes/Postful/Letter.html#
|
|
30
|
-
<a href="classes/Postful/Letter.html#
|
|
31
|
-
<a href="classes/Postful/Letter.html#
|
|
32
|
-
<a href="classes/Postful/Letter.html#
|
|
33
|
-
<a href="classes/Postful/Letter.html#
|
|
34
|
-
<a href="classes/Postful/Letter.html#
|
|
35
|
-
<a href="classes/Postful/Letter.html#
|
|
36
|
-
<a href="classes/Postful/Letter.html#
|
|
28
|
+
<a href="classes/Postful/Letter.html#M000024">add_open_office_document (Postful::Letter)</a><br />
|
|
29
|
+
<a href="classes/Postful/Letter.html#M000025">add_open_office_document_from_file (Postful::Letter)</a><br />
|
|
30
|
+
<a href="classes/Postful/Letter.html#M000028">add_pdf_document (Postful::Letter)</a><br />
|
|
31
|
+
<a href="classes/Postful/Letter.html#M000029">add_pdf_document_from_file (Postful::Letter)</a><br />
|
|
32
|
+
<a href="classes/Postful/Letter.html#M000022">add_rtf_document (Postful::Letter)</a><br />
|
|
33
|
+
<a href="classes/Postful/Letter.html#M000023">add_rtf_document_from_file (Postful::Letter)</a><br />
|
|
34
|
+
<a href="classes/Postful/Letter.html#M000026">add_text_document (Postful::Letter)</a><br />
|
|
35
|
+
<a href="classes/Postful/Letter.html#M000027">add_text_document_from_file (Postful::Letter)</a><br />
|
|
36
|
+
<a href="classes/Postful/Letter.html#M000020">add_word_document (Postful::Letter)</a><br />
|
|
37
|
+
<a href="classes/Postful/Letter.html#M000021">add_word_document_from_file (Postful::Letter)</a><br />
|
|
38
|
+
<a href="classes/Postful/Postcard.html#M000012">back_image_from_file= (Postful::Postcard)</a><br />
|
|
37
39
|
<a href="classes/Postful/Order.html#M000009">cancel (Postful::Order)</a><br />
|
|
38
|
-
<a href="classes/Postful/Service.html#
|
|
40
|
+
<a href="classes/Postful/Service.html#M000016">cancel_order_by_id (Postful::Service)</a><br />
|
|
39
41
|
<a href="classes/Postful/Base.html#M000006">errors (Postful::Base)</a><br />
|
|
40
|
-
<a href="classes/Postful/Service.html#
|
|
41
|
-
<a href="classes/Postful/Service.html#
|
|
42
|
+
<a href="classes/Postful/Service.html#M000017">find_all_orders (Postful::Service)</a><br />
|
|
43
|
+
<a href="classes/Postful/Service.html#M000015">find_order_by_id (Postful::Service)</a><br />
|
|
44
|
+
<a href="classes/Postful/Postcard.html#M000011">front_image_from_file= (Postful::Postcard)</a><br />
|
|
42
45
|
<a href="classes/Postful/Base.html#M000004">mail! (Postful::Base)</a><br />
|
|
43
|
-
<a href="classes/Postful/Service.html#M000011">new (Postful::Service)</a><br />
|
|
44
46
|
<a href="classes/Postful/Order.html#M000010">new (Postful::Order)</a><br />
|
|
47
|
+
<a href="classes/Postful/Service.html#M000014">new (Postful::Service)</a><br />
|
|
45
48
|
<a href="classes/Postful/Base.html#M000001">new (Postful::Base)</a><br />
|
|
46
49
|
<a href="classes/Postful/Order.html#M000007">preview (Postful::Order)</a><br />
|
|
47
50
|
<a href="classes/Postful/Order.html#M000008">refresh (Postful::Order)</a><br />
|
data/lib/postful.rb
CHANGED
data/lib/postful/base.rb
CHANGED
data/lib/postful/letter.rb
CHANGED
|
@@ -73,6 +73,11 @@ module Postful
|
|
|
73
73
|
super
|
|
74
74
|
errors << 'Requires at least one document' if @documents.empty?
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
def mail_without_validation! #:nodoc:
|
|
78
|
+
upload_documents
|
|
79
|
+
super
|
|
80
|
+
end
|
|
76
81
|
|
|
77
82
|
private
|
|
78
83
|
|
|
@@ -95,7 +100,7 @@ module Postful
|
|
|
95
100
|
io.read
|
|
96
101
|
end
|
|
97
102
|
add_document(format, content)
|
|
98
|
-
end
|
|
103
|
+
end
|
|
99
104
|
|
|
100
105
|
class Document #:nodoc:
|
|
101
106
|
include Util
|
|
@@ -103,7 +108,7 @@ module Postful
|
|
|
103
108
|
attr_accessor :format
|
|
104
109
|
attr_accessor :content
|
|
105
110
|
attr_accessor :attachment_name
|
|
106
|
-
|
|
111
|
+
|
|
107
112
|
def initialize(email, password)
|
|
108
113
|
@email = email
|
|
109
114
|
@password = password
|
|
@@ -129,6 +134,5 @@ module Postful
|
|
|
129
134
|
end
|
|
130
135
|
end
|
|
131
136
|
end
|
|
132
|
-
|
|
133
137
|
end
|
|
134
138
|
end
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
require 'net/https'
|
|
2
|
+
require 'builder'
|
|
3
|
+
require File.join(File.dirname(__FILE__), 'base')
|
|
4
|
+
require File.join(File.dirname(__FILE__), 'util')
|
|
5
|
+
|
|
6
|
+
module Postful
|
|
7
|
+
# Builder for mailing postcards with the Postful Web Service.
|
|
8
|
+
class Postcard < Base
|
|
9
|
+
FIT = 'Postcard: Image fit front'
|
|
10
|
+
FILL = 'Postcard: Image fill front'
|
|
11
|
+
IMAGES = 'Postcard: Image front and back'
|
|
12
|
+
|
|
13
|
+
attr_accessor :front_image
|
|
14
|
+
attr_accessor :back_image
|
|
15
|
+
attr_accessor :back_text
|
|
16
|
+
|
|
17
|
+
def front_image_from_file=(filename)
|
|
18
|
+
@front_image = get_file(filename)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def back_image_from_file=(filename)
|
|
22
|
+
@back_image = get_file(filename)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def add_border
|
|
26
|
+
@border = true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
protected
|
|
30
|
+
|
|
31
|
+
def mail_without_validation! #:nodoc:
|
|
32
|
+
build_sections
|
|
33
|
+
upload_attachments
|
|
34
|
+
build_template_document
|
|
35
|
+
super
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def validate #:nodoc:
|
|
39
|
+
super
|
|
40
|
+
if @back_image && @back_text
|
|
41
|
+
errors << 'Cannot have both image and text on back'
|
|
42
|
+
end
|
|
43
|
+
if @border && @back_image
|
|
44
|
+
errors << 'Cannot have both front border and image on back'
|
|
45
|
+
end
|
|
46
|
+
unless @back_text || @back_image
|
|
47
|
+
errors << 'Must have either text or image on back'
|
|
48
|
+
end
|
|
49
|
+
unless @front_image
|
|
50
|
+
errors << 'Must have image on front'
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def build_sections
|
|
57
|
+
@sections = []
|
|
58
|
+
if back_text
|
|
59
|
+
@sections << Section.new(@email, @password, 'Text', back_text, :text)
|
|
60
|
+
end
|
|
61
|
+
if back_image
|
|
62
|
+
@sections << Section.new(@email, @password, 'Back', back_image, :image)
|
|
63
|
+
end
|
|
64
|
+
@sections << if choose_template == IMAGES
|
|
65
|
+
Section.new(@email, @password, 'Front', front_image, :image)
|
|
66
|
+
else
|
|
67
|
+
Section.new(@email, @password, 'Image', front_image, :image)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def upload_attachments
|
|
72
|
+
@sections.each do |section|
|
|
73
|
+
section.upload
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def build_template_document
|
|
78
|
+
returning Document.new(choose_template) do |document|
|
|
79
|
+
document.sections = @sections
|
|
80
|
+
@documents = [document]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def get_file(filename)
|
|
85
|
+
open(filename, "rb") do |io|
|
|
86
|
+
io.read
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def choose_template
|
|
91
|
+
if @border
|
|
92
|
+
FIT
|
|
93
|
+
elsif @front_image && @back_image
|
|
94
|
+
IMAGES
|
|
95
|
+
else
|
|
96
|
+
FILL
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
class Document#:nodoc:
|
|
101
|
+
attr_accessor :sections
|
|
102
|
+
|
|
103
|
+
def initialize(template_name)
|
|
104
|
+
@template_name = template_name
|
|
105
|
+
@sections = []
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def build_request(builder)
|
|
109
|
+
builder.document do
|
|
110
|
+
builder.template do
|
|
111
|
+
builder.source 'gallery'
|
|
112
|
+
builder.name @template_name
|
|
113
|
+
end
|
|
114
|
+
builder.sections do
|
|
115
|
+
sections.each do |section|
|
|
116
|
+
section.build_request(builder)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
class Section #:nodoc:
|
|
125
|
+
include Util
|
|
126
|
+
|
|
127
|
+
def initialize(email, password, name, content, kind)
|
|
128
|
+
@email = email
|
|
129
|
+
@password = password
|
|
130
|
+
@name = name
|
|
131
|
+
@content = content
|
|
132
|
+
@kind = kind
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def build_request(builder)
|
|
136
|
+
builder.section do
|
|
137
|
+
builder.name @name
|
|
138
|
+
if @kind == :image
|
|
139
|
+
builder.attachment @attachment_name
|
|
140
|
+
elsif @kind == :text
|
|
141
|
+
builder.text @content
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def upload
|
|
147
|
+
return if @kind == :text
|
|
148
|
+
headers = {
|
|
149
|
+
'Content-Type' => 'application/octet-stream',
|
|
150
|
+
'Content-Length' => @content.size.to_s
|
|
151
|
+
}
|
|
152
|
+
response = post_request_on_path('/service/upload', @content, @email, @password, headers)
|
|
153
|
+
if response.is_a?(Net::HTTPOK) && response.body =~ /<id>(.*)<\/id>/
|
|
154
|
+
@attachment_name = $1
|
|
155
|
+
else
|
|
156
|
+
# raise stuff
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
end
|
|
162
|
+
end
|
data/lib/postful/util.rb
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
module Postful
|
|
2
2
|
module Util #:nodoc:
|
|
3
|
-
|
|
3
|
+
HOST = 'www.postful.com'
|
|
4
|
+
PORT = 443
|
|
4
5
|
|
|
6
|
+
protected
|
|
7
|
+
|
|
5
8
|
def build_error_message_from_response(response)
|
|
6
9
|
document = REXML::Document.new response
|
|
7
10
|
errors = []
|
|
@@ -29,8 +32,8 @@ module Postful
|
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
def delete_request_on_path(path, email, password)
|
|
32
|
-
http = Net::HTTP.new(
|
|
33
|
-
http.use_ssl = true
|
|
35
|
+
http = Net::HTTP.new(HOST, PORT)
|
|
36
|
+
http.use_ssl = true if PORT == 443
|
|
34
37
|
silence_warnings do
|
|
35
38
|
http.start() {|http|
|
|
36
39
|
request = Net::HTTP::Delete.new(path)
|
|
@@ -41,8 +44,8 @@ module Postful
|
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
def get_request_on_path(path, email, password)
|
|
44
|
-
http = Net::HTTP.new(
|
|
45
|
-
http.use_ssl = true
|
|
47
|
+
http = Net::HTTP.new(HOST, PORT)
|
|
48
|
+
http.use_ssl = true if PORT == 443
|
|
46
49
|
silence_warnings do
|
|
47
50
|
http.start() {|http|
|
|
48
51
|
request = Net::HTTP::Get.new(path)
|
|
@@ -53,8 +56,8 @@ module Postful
|
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
def post_request_on_path(path, post, email, password, headers = {})
|
|
56
|
-
http = Net::HTTP.new(
|
|
57
|
-
http.use_ssl = true
|
|
59
|
+
http = Net::HTTP.new(HOST, PORT)
|
|
60
|
+
http.use_ssl = true if PORT == 443
|
|
58
61
|
headers.merge!({ 'Authorization' => authorization_header(email, password) })
|
|
59
62
|
silence_warnings { http.post(path, post, headers) }
|
|
60
63
|
end
|