pushco 1.0.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.
Files changed (2) hide show
  1. data/lib/pushco.rb +41 -0
  2. metadata +46 -0
data/lib/pushco.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'httparty'
2
+ require 'json'
3
+ class Pushco
4
+
5
+ # Example:
6
+ # >> Pushco.new("YOUR_API_KEY", "YOUR_API_SECRET")
7
+ # Arguments:
8
+ # String
9
+
10
+ def initialize api_key, api_secret
11
+
12
+ if ((api_key.nil? || api_key.empty?) && (api_secret.nil? || api_secret.empty?))
13
+ p "Please Provide Both API key and API Secret!"
14
+ end
15
+
16
+ @api_key = api_key
17
+ @api_secret = api_secret
18
+
19
+ end
20
+
21
+
22
+ # Example:
23
+ # >> Pushco.push("Hello Mum I am on TV", {:url => 'http://sky.com'})
24
+ # Arguments:
25
+ # String and Hashmap
26
+
27
+ def push messsage, options = {}
28
+ connect_to_push(messsage, options)
29
+ end
30
+
31
+ def connect_to_push(message, options)
32
+
33
+ data = {:message => message,
34
+ :api_key => @api_key,
35
+ :api_secret => @api_secret
36
+ }.merge(options)
37
+
38
+ p HTTParty.post('https://api.push.co/1.0/push', {:body => data}).body
39
+ end
40
+
41
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pushco
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sabeur Thabti
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-22 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Simple Push.co Ruby Wrapper
15
+ email: thabti.sabeur@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/pushco.rb
21
+ homepage: http://rubygems.org/gems/pushco
22
+ licenses:
23
+ - MIT
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.23
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: Simple Push.co Ruby Wrapper
46
+ test_files: []