onebox 1.8.54 → 1.8.55

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bc1a0154796be863dd0f8261f8202b15dc77970af7fff8de9aae7e0636cad90
4
- data.tar.gz: aa1ecb7b1609e95c031cc26cd043464ebabd90f2bdd302383570b684a03c89ee
3
+ metadata.gz: c8a00f9099e20ceead5cc15b266194ec21b9146d9c1921ca76017f7653c038a1
4
+ data.tar.gz: ea3d01bcb2411573bdaf1a48ba109e31cb4c85874bc882d3039df7c596fb420a
5
5
  SHA512:
6
- metadata.gz: ed0a7904bdd5a0ac58d3c8f9e03205447b3ca511829cd1e072f6c6821e61fce5e3cadd93a67be46c764337ceef78008762ee5460f6f6b4894de18ecd6866c7b8
7
- data.tar.gz: 3ba7c3d8a555ff913fd0651c172f622f6f922235a47eda6c5e26cd27dc0caea61157a1673e5321bf8121fd9e1b41097b9dc8cd466375a1cd6cb19aead1414c77
6
+ metadata.gz: 4f8213dc2113c7c1db11577407da8f94d32311865a78a8ce28defa69d2a7e5caf3db4ddd6acad6f739b3d150c61aa2d55b782cc4b8dace11e3552c37b1f6a6da
7
+ data.tar.gz: aafdcb06bc1f396350b1a76e921da84e115d1417922d71589dcb4f515001efc81c15170cb7fab4494620a3a411ad7cf6238c810326de2443b4c470d80e2a5b7f
@@ -90,12 +90,32 @@ module Onebox
90
90
  end
91
91
  end
92
92
 
93
+ def likes
94
+ if twitter_api_credentials_present?
95
+ count = access(:favorite_count).to_i
96
+ return count > 0 ? client.prettify_number(count) : nil
97
+ else
98
+ raw.at_css(".request-favorited-popup").attr('data-compact-localized-count') rescue nil
99
+ end
100
+ end
101
+
102
+ def retweets
103
+ if twitter_api_credentials_present?
104
+ count = access(:retweet_count).to_i
105
+ return count > 0 ? client.prettify_number(count) : nil
106
+ else
107
+ raw.at_css(".request-retweeted-popup").attr('data-compact-localized-count') rescue nil
108
+ end
109
+ end
110
+
93
111
  def data
94
112
  { link: link,
95
113
  tweet: tweet,
96
114
  timestamp: timestamp,
97
115
  title: title,
98
- avatar: avatar }
116
+ avatar: avatar,
117
+ likes: likes,
118
+ retweets: retweets }
99
119
  end
100
120
  end
101
121
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "1.8.54"
4
+ VERSION = "1.8.55"
5
5
  end
@@ -9,4 +9,10 @@
9
9
 
10
10
  <div class='date'>
11
11
  <a href="{{link}}" target="_blank">{{timestamp}}</a>
12
+ {{#likes}}
13
+ <span class="like"><i class="fa fa-heart"></i> {{likes}}</span>
14
+ {{/likes}}
15
+ {{#retweets}}
16
+ <span class="retweet"><i class="fa fa-retweet"></i> {{retweets}}</span>
17
+ {{/retweets}}
12
18
  </div>
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.8.54
4
+ version: 1.8.55
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: 2018-07-16 00:00:00.000000000 Z
13
+ date: 2018-07-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json