bemurphy-google_plus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +24 -0
- data/Rakefile +2 -0
- data/google_plus.gemspec +24 -0
- data/lib/google_plus.rb +19 -0
- data/lib/google_plus/activities.rb +28 -0
- data/lib/google_plus/client.rb +15 -0
- data/lib/google_plus/people.rb +19 -0
- data/lib/google_plus/version.rb +3 -0
- data/test/.gitkeep +0 -0
- metadata +119 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Google-Plus
|
2
|
+
===========
|
3
|
+
|
4
|
+
A light wrapper around the new Google+ API. It's late, this is really rough.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
TODO Gem
|
10
|
+
|
11
|
+
Usage
|
12
|
+
-----
|
13
|
+
|
14
|
+
require "google_plus"
|
15
|
+
GooglePlus.connect("your_api_key")
|
16
|
+
GooglePlus::People.get("111277284611154414539")
|
17
|
+
GooglePlus::Activities.list("111277284611154414539")
|
18
|
+
|
19
|
+
TODO
|
20
|
+
----
|
21
|
+
|
22
|
+
* Docs
|
23
|
+
* Get rid of class var for api key
|
24
|
+
* tests (ahem)
|
data/Rakefile
ADDED
data/google_plus.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "google_plus/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "bemurphy-google_plus"
|
7
|
+
s.version = GooglePlus::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Brendon Murphy"]
|
10
|
+
s.email = ["xternal1+github@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Light wrapper for Google+ API}
|
13
|
+
s.description = %q{Light wrapper for Google+ API, using HTTParty}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_dependency "httparty"
|
21
|
+
s.add_dependency "hashie"
|
22
|
+
|
23
|
+
s.add_development_dependency "minitest"
|
24
|
+
end
|
data/lib/google_plus.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'hashie'
|
3
|
+
|
4
|
+
module GooglePlus
|
5
|
+
autoload :Client, File.expand_path('../google_plus/client', __FILE__)
|
6
|
+
autoload :People, File.expand_path('../google_plus/people', __FILE__)
|
7
|
+
autoload :Activities, File.expand_path('../google_plus/activities', __FILE__)
|
8
|
+
|
9
|
+
include HTTParty
|
10
|
+
|
11
|
+
def self.connect(api_key)
|
12
|
+
@@api_key = api_key
|
13
|
+
base_uri "https://www.googleapis.com/plus/v1"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.api_key
|
17
|
+
@@api_key
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GooglePlus
|
2
|
+
class Activity < Hashie::Mash; end
|
3
|
+
|
4
|
+
module Activities
|
5
|
+
class << self
|
6
|
+
def get(activity_id)
|
7
|
+
Client.new.get activity_id
|
8
|
+
end
|
9
|
+
|
10
|
+
def list(user_id)
|
11
|
+
Client.new.list user_id
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Client
|
16
|
+
include GooglePlus::Client
|
17
|
+
|
18
|
+
def get(activity_id)
|
19
|
+
Activity.new get_with_key("/activities/#{activity_id}")
|
20
|
+
end
|
21
|
+
|
22
|
+
def list(user_id)
|
23
|
+
items = get_with_key("/people/#{user_id}/activities/public")["items"]
|
24
|
+
items.collect { |item| Activity.new item }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module GooglePlus
|
2
|
+
class Person < Hashie::Mash; end
|
3
|
+
|
4
|
+
module People
|
5
|
+
class << self
|
6
|
+
def get(user_id)
|
7
|
+
Client.new.get user_id
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Client
|
12
|
+
include GooglePlus::Client
|
13
|
+
|
14
|
+
def get(user_id)
|
15
|
+
Person.new get_with_key("/people/#{user_id}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/test/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bemurphy-google_plus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Brendon Murphy
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-09-16 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: httparty
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hashie
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: minitest
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
description: Light wrapper for Google+ API, using HTTParty
|
64
|
+
email:
|
65
|
+
- xternal1+github@gmail.com
|
66
|
+
executables: []
|
67
|
+
|
68
|
+
extensions: []
|
69
|
+
|
70
|
+
extra_rdoc_files: []
|
71
|
+
|
72
|
+
files:
|
73
|
+
- .gitignore
|
74
|
+
- Gemfile
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- google_plus.gemspec
|
78
|
+
- lib/google_plus.rb
|
79
|
+
- lib/google_plus/activities.rb
|
80
|
+
- lib/google_plus/client.rb
|
81
|
+
- lib/google_plus/people.rb
|
82
|
+
- lib/google_plus/version.rb
|
83
|
+
- test/.gitkeep
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: ""
|
86
|
+
licenses: []
|
87
|
+
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
111
|
+
requirements: []
|
112
|
+
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.3.7
|
115
|
+
signing_key:
|
116
|
+
specification_version: 3
|
117
|
+
summary: Light wrapper for Google+ API
|
118
|
+
test_files:
|
119
|
+
- test/.gitkeep
|