grove-rb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +22 -0
- data/README.md +10 -0
- data/grove-rb.gemspec +16 -0
- data/lib/grove-rb.rb +1 -0
- data/lib/grove.rb +29 -0
- data/lib/grove/version.rb +3 -0
- metadata +62 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -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!
|
data/README.md
ADDED
data/grove-rb.gemspec
ADDED
@@ -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
|
data/lib/grove-rb.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path("..", __FILE__) + "/grove"
|
data/lib/grove.rb
ADDED
@@ -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
|
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: []
|