dschn-tweetsy 0.1.8 → 0.1.9

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.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/tweetsy/client.rb +16 -2
  3. metadata +1 -1
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 8
2
+ :patch: 9
3
3
  :major: 0
4
4
  :minor: 1
@@ -1,5 +1,5 @@
1
1
  module Tweetsy
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
 
4
4
  class Client
5
5
  API_HOST = "http://twitter.com"
@@ -58,6 +58,16 @@ module Tweetsy
58
58
  User.new(doc.at('user'))
59
59
  end
60
60
 
61
+ def create_block(id_or_screen_name)
62
+ doc = request(:post, "/blocks/create/#{id_or_screen_name}.xml", :auth => true)
63
+ User.new(doc.at('user'))
64
+ end
65
+
66
+ def destroy_block(id_or_screen_name)
67
+ doc = request(:post, "/blocks/destroy/#{id_or_screen_name}.xml", :auth => true)
68
+ User.new(doc.at('user'))
69
+ end
70
+
61
71
  def update(status, options = {})
62
72
  form_data = { :status => status }
63
73
  form_data[:source] = options[:source] if options[:source]
@@ -107,9 +117,13 @@ module Tweetsy
107
117
 
108
118
  # --------------------------------------------------------------
109
119
 
120
+ def cgi_escape(str)
121
+ str.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }
122
+ end
123
+
110
124
  def build_path(path, params = {})
111
125
  if params.any?
112
- path += "?" + params.inject('') { |str, h| str += "#{CGI.escape(h[0].to_s)}=#{CGI.escape(h[1].to_s)}&" }
126
+ path += "?" + params.inject('') { |str, h| str += "#{cgi_escape(h[0].to_s)}=#{cgi_escape(h[1].to_s)}&" }
113
127
  else
114
128
  path
115
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dschn-tweetsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Schneider