nuntium_api 0.19 → 0.20

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 (2) hide show
  1. data/lib/nuntium.rb +25 -2
  2. metadata +4 -4
data/lib/nuntium.rb CHANGED
@@ -194,8 +194,6 @@ class Nuntium
194
194
  end
195
195
 
196
196
  # Sends one or many AO messages.
197
- # Returns an enhanced HTTParty::Response instance with id, guid and token readers that matches those x-headers
198
- # returned by Nuntium.
199
197
  #
200
198
  # To send a token, just include it in the message as :token => 'my_token'
201
199
  #
@@ -253,6 +251,31 @@ class Nuntium
253
251
  end
254
252
  end
255
253
 
254
+
255
+ # Creates a friendship between the channel's twitter account and the given user.
256
+ # Returns the response from twitter.
257
+ # Refer to Twitter's documentation: https://dev.twitter.com/docs/api/1/post/friendships/create
258
+ #
259
+ # Raises Nuntium::Exception if something goes wrong.
260
+ def twitter_friendship_create(channel_name, user, follow = true)
261
+ get("/api/channels/#{channel_name}/twitter/friendships/create?user=#{CGI.escape user}&follow=#{follow}") do |response, error|
262
+ raise Nuntium::Exception.new error.message if error
263
+
264
+ response
265
+ end
266
+ end
267
+
268
+ # Adds an xmpp conact to the xmpp account associated to the given channel.
269
+ #
270
+ # Raises Nuntium::Exception if something goes wrong.
271
+ def xmpp_add_contact(channel_name, jid)
272
+ get("/api/channels/#{channel_name}/xmpp/add_contact?jid=#{CGI.escape jid}") do |response, error|
273
+ raise Nuntium::Exception.new error.message if error
274
+
275
+ response
276
+ end
277
+ end
278
+
256
279
  private
257
280
 
258
281
  def write_configuration(channel)
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuntium_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 45
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 19
9
- version: "0.19"
8
+ - 20
9
+ version: "0.20"
10
10
  platform: ruby
11
11
  authors:
12
12
  - InsTEDD
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-09-23 00:00:00 Z
17
+ date: 2011-11-11 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rest-client