mambanation 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION.yml +3 -2
- data/lib/mambanation/base.rb +19 -8
- data/lib/mambanation/httpauth.rb +4 -4
- data/lib/mambanation.rb +0 -20
- metadata +6 -4
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require "yaml"
|
|
5
5
|
Jeweler::Tasks.new do |gem|
|
6
6
|
gem.name = "mambanation"
|
7
7
|
gem.summary = %Q{wrapper for mambanation-api}
|
8
|
-
gem.email = "jeremy.vandewyngaert@mimesis-republic.com"
|
8
|
+
gem.email = ["jeremy.vandewyngaert@mimesis-republic.com", "sbellity@gmail.com"]
|
9
9
|
gem.homepage = "https://github.com/mimesis/mambanation-wrapper"
|
10
10
|
gem.authors = ["Jeremy Van de Wyngaert"]
|
11
11
|
gem.files = FileList["[A-Z]*", "{lib,test}/**/*"]
|
data/VERSION.yml
CHANGED
data/lib/mambanation/base.rb
CHANGED
@@ -4,17 +4,22 @@ module MambaNation
|
|
4
4
|
|
5
5
|
def_delegators :client, :get, :post, :put, :delete
|
6
6
|
|
7
|
-
attr_reader :client
|
7
|
+
attr_reader :client, :fbs_cookies
|
8
8
|
|
9
|
-
def initialize(client)
|
9
|
+
def initialize(client, fbs_cookies = nil)
|
10
10
|
@client = client
|
11
|
+
@fbs_cookies = fbs_cookies
|
11
12
|
end
|
12
13
|
|
13
14
|
#
|
14
15
|
# Users
|
15
16
|
#
|
16
|
-
def create_user(user)
|
17
|
-
|
17
|
+
# def create_user(user)
|
18
|
+
# perform_post("/users", :body => { :user => user })
|
19
|
+
# end
|
20
|
+
|
21
|
+
def current_user
|
22
|
+
perform_post("/users/me") if !fbs_cookies.nil?
|
18
23
|
end
|
19
24
|
|
20
25
|
def user_by_facebook_id(facebook_id, query = {})
|
@@ -182,20 +187,26 @@ module MambaNation
|
|
182
187
|
|
183
188
|
private
|
184
189
|
|
190
|
+
def request_options opts={}
|
191
|
+
opts[:headers] ||= {}
|
192
|
+
opts[:headers].merge! "FB-Cookies" => fbs_cookies
|
193
|
+
opts
|
194
|
+
end
|
195
|
+
|
185
196
|
def perform_get(path, options={})
|
186
|
-
MambaNation::Request.get(self, path, options)
|
197
|
+
MambaNation::Request.get(self, path, request_options(options))
|
187
198
|
end
|
188
199
|
|
189
200
|
def perform_post(path, options={})
|
190
|
-
MambaNation::Request.post(self, path, options)
|
201
|
+
MambaNation::Request.post(self, path, request_options(options))
|
191
202
|
end
|
192
203
|
|
193
204
|
def perform_put(path, options={})
|
194
|
-
MambaNation::Request.put(self, path, options)
|
205
|
+
MambaNation::Request.put(self, path, request_options(options))
|
195
206
|
end
|
196
207
|
|
197
208
|
def perform_delete(path, options={})
|
198
|
-
MambaNation::Request.delete(self, path, options)
|
209
|
+
MambaNation::Request.delete(self, path, request_options(options))
|
199
210
|
end
|
200
211
|
|
201
212
|
end
|
data/lib/mambanation/httpauth.rb
CHANGED
@@ -8,17 +8,17 @@ module MambaNation
|
|
8
8
|
|
9
9
|
def initialize(username, password, options={})
|
10
10
|
@username, @password = username, password
|
11
|
-
@options = {:ssl => false}.merge(options)
|
11
|
+
@options = { :ssl => false, :timeout => 100 }.merge(options)
|
12
12
|
options[:api_endpoint] ||= "api.mambanation.com"
|
13
13
|
|
14
14
|
if options[:api_version] == false
|
15
|
-
version_path =
|
15
|
+
version_path = "v2"
|
16
16
|
else
|
17
17
|
options[:api_version] ||= API_VERSION
|
18
|
-
version_path = "#{options[:api_version]}"
|
18
|
+
version_path = "v#{options[:api_version]}"
|
19
19
|
end
|
20
20
|
|
21
|
-
self.class.base_uri "http#{'s' if options[:ssl]}://#{options[:api_endpoint]}
|
21
|
+
self.class.base_uri "http#{'s' if options[:ssl]}://#{options[:api_endpoint]}/#{version_path}"
|
22
22
|
self.class.default_timeout options[:timeout] if options[:timeout]
|
23
23
|
end
|
24
24
|
|
data/lib/mambanation.rb
CHANGED
@@ -26,26 +26,6 @@ module MambaNation
|
|
26
26
|
class Unavailable < StandardError; end
|
27
27
|
class InformMambaNation < StandardError; end
|
28
28
|
class NotFound < StandardError; end
|
29
|
-
|
30
|
-
# Options: user_id, facebook_id
|
31
|
-
def self.user(*user)
|
32
|
-
perform_get("/users/show.json", :body => { :user => user })
|
33
|
-
end
|
34
|
-
|
35
|
-
# Options: user_id, facebook_id
|
36
|
-
def self.user_facets(query = {})
|
37
|
-
perform_get("/users/facets.json", :query => query)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Options: user_id, :limit
|
41
|
-
def self.user_media(query = {})
|
42
|
-
perform_get("/users/media.json", :query => query)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Options: user_id, facebook_id
|
46
|
-
def self.user_friends(query = {})
|
47
|
-
perform_get("/users/friends.json", :query => query)
|
48
|
-
end
|
49
29
|
|
50
30
|
private
|
51
31
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.5
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Van de Wyngaert
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-12 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -130,7 +130,9 @@ dependencies:
|
|
130
130
|
type: :development
|
131
131
|
version_requirements: *id008
|
132
132
|
description:
|
133
|
-
email:
|
133
|
+
email:
|
134
|
+
- jeremy.vandewyngaert@mimesis-republic.com
|
135
|
+
- sbellity@gmail.com
|
134
136
|
executables: []
|
135
137
|
|
136
138
|
extensions: []
|