sant0sk1-dreamy 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION.yml +2 -2
  2. data/lib/dreamy/base.rb +29 -6
  3. metadata +6 -5
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
3
- :major: 0
4
2
  :minor: 5
3
+ :patch: 1
4
+ :major: 0
@@ -72,6 +72,24 @@ module Dreamy
72
72
  api_error?(doc)
73
73
  true
74
74
  end
75
+
76
+ # options:
77
+ # stamp - the time to send the message, like "2009-05-28" or "2009-05-28 14:24:36"
78
+ # charset - the character set in which the message is encoded
79
+ # type - the format of the message, either "text" or "html"
80
+ # duplicate_ok - whether to allow duplicate messages to be sent, like 1 or 0
81
+ def announce_post(listname,domain,subject,message,name,options={})
82
+ values = {
83
+ "listname" => listname,
84
+ "domain" => domain,
85
+ "subject" => subject,
86
+ "message" => message,
87
+ "name" => name
88
+ }.merge(options)
89
+ doc = request("announcement_list-post_announcement", values, true)
90
+ api_error?(doc)
91
+ true
92
+ end
75
93
 
76
94
  def mysql_dbs
77
95
  doc = request("mysql-list_dbs")
@@ -163,12 +181,11 @@ module Dreamy
163
181
  raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
164
182
  end
165
183
 
166
- def request(cmd,values={})
167
- handle_response!(response(cmd,values))
184
+ def request(cmd,values={},use_post=false)
185
+ handle_response!(response(cmd,values,use_post))
168
186
  end
169
187
 
170
-
171
- def response(cmd,values={})
188
+ def response(cmd,values={},use_post=false)
172
189
  values = {
173
190
  "username" => @username,
174
191
  "key" => @key,
@@ -177,14 +194,20 @@ module Dreamy
177
194
  "unique_id" => UUID.new.generate
178
195
  }.merge(values)
179
196
 
180
- path = "/?#{values.to_param_array.join("&")}"
181
197
  http = Net::HTTP.new(@@host, 443)
182
198
  http.use_ssl = true
183
199
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
184
200
 
185
201
  begin
186
202
  # puts path
187
- response = http.get(path)
203
+ response = if use_post
204
+ request = Net::HTTP::Post.new("/")
205
+ request.form_data = values
206
+ http.request(request)
207
+ else
208
+ path = "/?#{values.to_param_array.join("&")}"
209
+ http.get(path)
210
+ end
188
211
  rescue => error
189
212
  raise CantConnect, error.message
190
213
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sant0sk1-dreamy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerod Santo
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-30 00:00:00 -07:00
12
+ date: 2009-08-20 00:00:00 -07:00
13
13
  default_executable: dh
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -88,8 +88,9 @@ files:
88
88
  - test/subscriber_test.rb
89
89
  - test/test_helper.rb
90
90
  - test/user_test.rb
91
- has_rdoc: true
91
+ has_rdoc: false
92
92
  homepage: http://github.com/sant0sk1/dreamy
93
+ licenses:
93
94
  post_install_message:
94
95
  rdoc_options:
95
96
  - --charset=UTF-8
@@ -110,9 +111,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  requirements: []
111
112
 
112
113
  rubyforge_project:
113
- rubygems_version: 1.2.0
114
+ rubygems_version: 1.3.5
114
115
  signing_key:
115
- specification_version: 2
116
+ specification_version: 3
116
117
  summary: A Ruby library and command line tool for accessing DreamHost's API
117
118
  test_files:
118
119
  - test/announce_test.rb