grove-rb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1,22 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ grove-rb (0.1.0)
5
+ faraday (~> 0.7.6)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ addressable (2.2.7)
11
+ faraday (0.7.6)
12
+ addressable (~> 2.2)
13
+ multipart-post (~> 1.1)
14
+ rack (~> 1.1)
15
+ multipart-post (1.1.5)
16
+ rack (1.4.1)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ grove-rb!
@@ -0,0 +1,10 @@
1
+ # Grove.io Client for Ruby
2
+
3
+ Just read the 2 LOC then you will be fine.
4
+
5
+ ``` ruby
6
+ # grovebot.rb
7
+ grove = Grove.new(GROVE_CHANNEL_KEY, "GroveBot")
8
+ grove.post "Hello World!"
9
+ ```
10
+
@@ -0,0 +1,16 @@
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+
3
+ require "rubygems"
4
+ require "grove/version"
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "grove-rb"
8
+ gem.version = Grove::VERSION
9
+ gem.author = "Bryan Goines"
10
+ gem.summary = "Grove.io client for Ruby"
11
+ gem.email = "bryann83@gmail.com"
12
+ gem.homepage = "http://github.com/bry4n/grove-rb"
13
+ gem.files = Dir['**/*']
14
+ # gem.executables = ""
15
+ gem.add_dependency "faraday", "~> 0.7.6"
16
+ end
@@ -0,0 +1 @@
1
+ require File.expand_path("..", __FILE__) + "/grove"
@@ -0,0 +1,29 @@
1
+ require 'faraday'
2
+
3
+ class Grove
4
+ attr_accessor :channel_key, :service_name
5
+
6
+ GROVE_API_URI = "https://grove.io/api/notice/%s/"
7
+
8
+ def initialize(channel_key, service_name = nil)
9
+ @channel_key = channel_key
10
+ @service_name = service_name || "Grove-rb"
11
+ @last_status = ""
12
+ end
13
+
14
+ def post(message)
15
+ response = client.post "", {:service => service_name, :message => message}
16
+ @last_status = response.status
17
+ end
18
+
19
+ def success?
20
+ @last_status == 200
21
+ end
22
+
23
+ private
24
+
25
+ def client
26
+ @client ||= Faraday.new(:url => (GROVE_API_URI % channel_key))
27
+ end
28
+
29
+ end
@@ -0,0 +1,3 @@
1
+ module Grove
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grove-rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bryan Goines
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: &70310847146480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.7.6
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70310847146480
25
+ description:
26
+ email: bryann83@gmail.com
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - Gemfile
32
+ - Gemfile.lock
33
+ - grove-rb.gemspec
34
+ - lib/grove/version.rb
35
+ - lib/grove-rb.rb
36
+ - lib/grove.rb
37
+ - README.md
38
+ homepage: http://github.com/bry4n/grove-rb
39
+ licenses: []
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 1.8.10
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: Grove.io client for Ruby
62
+ test_files: []