dropio 1.0.7 → 1.0.8
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/dropio.gemspec +1 -1
- data/lib/dropio/api.rb +4 -0
- data/lib/dropio/client.rb +6 -0
- data/lib/dropio/drop.rb +4 -0
- data/lib/dropio.rb +1 -1
- data/spec/dropio/drop_spec.rb +8 -0
- metadata +1 -1
data/dropio.gemspec
CHANGED
data/lib/dropio/api.rb
CHANGED
@@ -146,6 +146,10 @@ class Dropio::Api
|
|
146
146
|
self.class.post("/drops/#{drop_name}/subscriptions", :body => { :token => token, :type => "twitter", :username => username, :password => password, :message => message}.merge(events))
|
147
147
|
end
|
148
148
|
|
149
|
+
def create_pingback_subscription(drop_name, url, events = {}, token = nil)
|
150
|
+
self.class.post("/drops/#{drop_name}/subscriptions", :body => { :token => token, :type => "pingback", :url => url}.merge(events))
|
151
|
+
end
|
152
|
+
|
149
153
|
def create_email_subscription(drop_name, emails, welcome_message = nil, welcome_subject = nil, welcome_from = nil, message = nil, events = {}, token = nil)
|
150
154
|
params = {:token => token, :type => "email", :emails => emails, :welcome_from => welcome_from , :welcome_subject => welcome_subject, :welcome_message => welcome_message }.merge(events)
|
151
155
|
self.class.post("/drops/#{drop_name}/subscriptions", :body => params)
|
data/lib/dropio/client.rb
CHANGED
@@ -170,6 +170,12 @@ class Dropio::Client
|
|
170
170
|
s
|
171
171
|
end
|
172
172
|
|
173
|
+
def create_pingback_subscription(drop, url, events)
|
174
|
+
s = handle(:subscription, self.service.create_pingback_subscription(drop.name, url, events, drop.default_token))
|
175
|
+
s.drop = drop
|
176
|
+
s
|
177
|
+
end
|
178
|
+
|
173
179
|
def subscriptions(drop, page = 1)
|
174
180
|
subscriptions = handle(:subscriptions, self.service.subscriptions(drop.name,page,drop.admin_token))
|
175
181
|
subscriptions.each{|s| s.drop = drop}
|
data/lib/dropio/drop.rb
CHANGED
@@ -72,6 +72,10 @@ class Dropio::Drop < Dropio::Resource
|
|
72
72
|
Dropio::Resource.client.create_link(self, url, title, description)
|
73
73
|
end
|
74
74
|
|
75
|
+
def create_pingback_subscription(url, events = {})
|
76
|
+
Dropio::Resource.client.create_pingback_subscription(self,url,events)
|
77
|
+
end
|
78
|
+
|
75
79
|
# Creates a Twitter Subscription
|
76
80
|
def create_twitter_subscription(username,password,message = nil, events = {})
|
77
81
|
Dropio::Resource.client.create_twitter_subscription(self,username,password,message,events)
|
data/lib/dropio.rb
CHANGED
data/spec/dropio/drop_spec.rb
CHANGED
@@ -150,6 +150,14 @@ describe Drop do
|
|
150
150
|
@mydrop.create_email_subscription("jake@dropio.com","My welcome message")
|
151
151
|
end
|
152
152
|
|
153
|
+
it "should be able to create pingback subscriptions" do
|
154
|
+
@sub = stub(Subscription)
|
155
|
+
@sub.should_receive(:drop=).once
|
156
|
+
@client.should_receive(:handle).with(:subscription,{}).and_return(@sub)
|
157
|
+
@api.should_receive(:create_pingback_subscription).with(@mydrop.name,"http://drop.io",{},@mydrop.default_token).and_return({})
|
158
|
+
@mydrop.create_pingback_subscription("http://drop.io")
|
159
|
+
end
|
160
|
+
|
153
161
|
it "should be able to get a list of subscriptions back" do
|
154
162
|
@sub = stub(Subscription)
|
155
163
|
@sub.should_receive(:drop=).once
|