ooyala_fb 0.2.1 → 0.2.2
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.
- data/README.md +30 -4
- data/lib/ooyala_fb.rb +19 -13
- metadata +2 -2
data/README.md
CHANGED
@@ -1,11 +1,37 @@
|
|
1
1
|
# Ooyala Fb
|
2
2
|
|
3
|
-
|
3
|
+
### easilly enables meta tag creation on your ruby/rails/rack app for Ooyala Facebook sharing
|
4
4
|
|
5
5
|
this is the code found on: http://www.ooyala.com/support/docs/facebook_sharing_sdk
|
6
6
|
repackaged as a gem
|
7
7
|
|
8
|
-
|
9
|
-
- examples/simple.rb contains sample usage for this sdk.
|
8
|
+
You can find your Partner and Secret codes under the Developers area of the Backlot Account tab.
|
10
9
|
|
11
|
-
|
10
|
+
|
11
|
+
## Install:
|
12
|
+
gem install ooyala_fb
|
13
|
+
|
14
|
+
|
15
|
+
### In your Gemfile:
|
16
|
+
from rubygems:
|
17
|
+
|
18
|
+
gem "ooyala_fb"
|
19
|
+
or from the git repo:
|
20
|
+
|
21
|
+
gem "ooyala_fb", :git => "git://github.com/makevoid/ooyala_fb"
|
22
|
+
|
23
|
+
|
24
|
+
## Usage:
|
25
|
+
require "ooyala_fb"
|
26
|
+
fbs = OoyalaFb.new partner_code: 'lxN2o63vhDmltiPGrrBoRLs6Mdpe', secret_code: 'bhBuI1mEzvu4MgSpuJvZdl1oiXZNrCGJ69CYiuMU'
|
27
|
+
|
28
|
+
puts fbs.header 'libjV0MTomg4gFR1h9S2zONQdqRXiZUu'
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
### Changes:
|
33
|
+
- 0.2.2 - constructor takes an hash as argument, logger is now optional
|
34
|
+
- 0.2.1 - first release
|
35
|
+
|
36
|
+
|
37
|
+
|
data/lib/ooyala_fb.rb
CHANGED
@@ -27,19 +27,25 @@ class OoyalaFb
|
|
27
27
|
|
28
28
|
FACEBOOK_MAX_WIDTH = 420
|
29
29
|
|
30
|
-
def initialize (
|
31
|
-
@partner_code = partner_code
|
32
|
-
@secret_code = secret_code
|
33
|
-
|
30
|
+
def initialize (options = {})
|
31
|
+
@partner_code = options[:partner_code]
|
32
|
+
@secret_code = options[:secret_code]
|
33
|
+
@log = options[:log]
|
34
|
+
@log_path = options[:log_path]
|
35
|
+
|
34
36
|
# Create a logger which ages logfile once it reaches
|
35
37
|
# a certain size. Leave 10 "old log files" and each file is about 1,024,000 bytes.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
# log disabled by default
|
39
|
+
|
40
|
+
if @log
|
41
|
+
log_path = options[:log_path] || 'ooyala_fb.log'
|
42
|
+
$LOG = Logger.new(log_path, 10, 1024000)
|
43
|
+
|
44
|
+
# Set the default logging level to INFO. So it will print messages
|
45
|
+
# about missing attribute values in the FacebookSharing.log file.
|
46
|
+
# Change this to Logger:ERROR if the messages should not be logged.
|
47
|
+
$LOG.sev_threshold = Logger::INFO
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
51
|
# Returns the string containing meta tags required by videos being uploaded to facebook
|
@@ -93,8 +99,8 @@ embedCode=#{metadata['embedCode']}&keepEmbedCode=true" />
|
|
93
99
|
|
94
100
|
node_value = doc.get_elements("list/item/#{node_name}")[0].get_text().value rescue nil
|
95
101
|
|
96
|
-
if @node_value == nil
|
97
|
-
$LOG.info("Value not found for: #{node_name}, embed_code: #{embed_code}")
|
102
|
+
if @log && @node_value == nil
|
103
|
+
$LOG.info("Value not found for: #{node_name}, embed_code: #{embed_code}")
|
98
104
|
end
|
99
105
|
|
100
106
|
return node_value
|