onebox 1.5.30 → 1.5.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4878ec1dc9d22c57ca8d519f0cb25197bd44556
4
- data.tar.gz: 072619a5da444658a108e8883cf0c94f96af7581
3
+ metadata.gz: 168c41ce81094aaa302822d95c75191890a96dc2
4
+ data.tar.gz: 3e6fcf7bc9cbc8a7f9c0f7fe7a024d563f1f758a
5
5
  SHA512:
6
- metadata.gz: dafe65f344abfd5fd1fea36bd05d004a4d83fd9296e8cf94336d6ef0d7fa3f50996730c897d48bd88cba05efeb8f003e98a8df1cf2e3e610ad184320543b96c9
7
- data.tar.gz: c4abced39688318fa9cf30280f8f2b0ab09831571f790a4cef99141f2cf19d05e1da7f79e1bed7bb54b20898c2c95e4e6e1f629512d3353d9175646b3324092e
6
+ metadata.gz: 68b17a619d440e150fea9f956480f2ae4c415ae56443368776f8406c423c84511833376aefc934dbfc33e85f703dff0ca3128899c7a2b5023ca4574eb5a10e55
7
+ data.tar.gz: a564013c615125738cc41e750c5493f81f57da1dd2dd85639fbcad784d8de0a3c09211dfcd0a092fa8141aca6c151dc39f07903e5e92823f7a601dc31bd495d8
@@ -85,6 +85,7 @@ module Onebox
85
85
  attrs_list = %w(title url type description)
86
86
  html.css('meta').each do |m|
87
87
  if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i)
88
+ # og properties
88
89
  m_content = m.attribute('content').to_s.strip
89
90
  m_name = m.attribute('property').to_s.gsub('og:', '')
90
91
  og.metadata[m_name.to_sym] ||= []
@@ -101,6 +102,14 @@ module Onebox
101
102
  og.send("#{m_name}=", m_content) unless m_content.empty?
102
103
  end
103
104
  end
105
+ if m.attribute('name') && m.attribute('name').to_s.match(/^twitter:/i)
106
+ # twitter properties
107
+ m_content = m.attribute('content').to_s.strip if m.attribute('content')
108
+ m_content = m.attribute('value').to_s.strip if m.attribute('value')
109
+ m_name = m.attribute('name').to_s
110
+ og.metadata[m_name.to_sym] ||= []
111
+ og.metadata[m_name.to_sym].push m_content
112
+ end
104
113
  end
105
114
 
106
115
  og
@@ -77,6 +77,7 @@ module Onebox
77
77
  livestream.com
78
78
  lessonplanet.com
79
79
  mashable.com
80
+ medium.com
80
81
  meetup.com
81
82
  mixcloud.com
82
83
  mlb.com
@@ -245,6 +246,16 @@ module Onebox
245
246
  data_hash[:video] = raw.metadata[:video].first
246
247
  end
247
248
 
249
+ if raw.metadata && raw.metadata[:"twitter:label1"] && raw.metadata[:"twitter:data1"]
250
+ data_hash[:twitter_label1] = raw.metadata[:"twitter:label1"].first
251
+ data_hash[:twitter_data1] = raw.metadata[:"twitter:data1"].first
252
+ end
253
+
254
+ if raw.metadata && raw.metadata[:"twitter:label2"] && raw.metadata[:"twitter:data2"]
255
+ data_hash[:twitter_label2] = raw.metadata[:"twitter:label2"].first
256
+ data_hash[:twitter_data2] = raw.metadata[:"twitter:data2"].first
257
+ end
258
+
248
259
  data_hash
249
260
  end
250
261
 
@@ -55,12 +55,32 @@ module Onebox
55
55
  record[:repository_path]
56
56
  end
57
57
 
58
+ def twitter_label1
59
+ record[:twitter_label1]
60
+ end
61
+
62
+ def twitter_data1
63
+ record[:twitter_data1]
64
+ end
65
+
66
+ def twitter_label2
67
+ record[:twitter_label2]
68
+ end
69
+
70
+ def twitter_data2
71
+ record[:twitter_data2]
72
+ end
73
+
58
74
  def details
59
75
  {
60
76
  link: record[:link],
61
77
  title: record[:title],
62
78
  domain: domain,
63
79
  repository_path: repository_path,
80
+ twitter_label1: record[:twitter_label1],
81
+ twitter_data1: record[:twitter_data1],
82
+ twitter_label2: record[:twitter_label2],
83
+ twitter_data2: record[:twitter_data2],
64
84
  subname: view.template_name,
65
85
  view: view.to_html
66
86
  }
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.5.30"
2
+ VERSION = "1.5.31"
3
3
  end
@@ -8,5 +8,9 @@
8
8
  <article class="onebox-body">
9
9
  {{{view}}}
10
10
  </article>
11
+ <div style='clear: both'>
12
+ {{#twitter_label1}}<span style="float: left;">{{twitter_label1}}: {{twitter_data1}}</span>{{/twitter_label1}}
13
+ {{#twitter_label2}}<span style="float: right;">{{twitter_label2}}: {{twitter_data2}}</span>{{/twitter_label2}}
14
+ </div>
11
15
  <div style='clear: both'></div>
12
16
  </aside>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.30
4
+ version: 1.5.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-26 00:00:00.000000000 Z
13
+ date: 2016-01-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -431,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
431
  version: '0'
432
432
  requirements: []
433
433
  rubyforge_project:
434
- rubygems_version: 2.4.8
434
+ rubygems_version: 2.5.1
435
435
  signing_key:
436
436
  specification_version: 4
437
437
  summary: A gem for turning URLs into previews.