frinkiac 0.0.2 → 0.0.3

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: 7615609051d44ae710df3264e8dd51ef555fb7a6
4
- data.tar.gz: 794e7ab721b1883471b91f9a3a9c6fcbdfdb8de9
3
+ metadata.gz: 70c4f08466ce28e543aad3104f077bcb7826e4aa
4
+ data.tar.gz: 68ceec3a8aee9418fc8cd37a48a3c937a07a9c5e
5
5
  SHA512:
6
- metadata.gz: dd4ba17cba260b3909c3e3870e7222546b3218c9b99633068ec4069a12833a98c13cdf8394b1538669ee1e399e6e71c7612d9d23728118498d695afb1eeff3b1
7
- data.tar.gz: c39d41b7c81cc7bc25f6396f42f3ac341cf6037489af1fe01516e86021e6f58d466fea119fee3cab6400f8bc4e017ecc4c9a33e9754b72e9fbeb6676163e8a8d
6
+ metadata.gz: 698a5c84d7625c336d45835c0ba149e49c4cfa7f737f2e630ed38e28572212a771a309d77363e94bbf3f821cb838bc4237a3a82be9a3d2e325a68d1af4ba4711
7
+ data.tar.gz: 24449eddfc56184ed166035dfbea2d717f6f30ee93ad764fa1d7500e98cc7a882f754ae95872076a25921f620c947ac510b6f804896fdc310017ab24388e660a
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'vcr', '~> 3.0.1'
27
27
  spec.add_development_dependency 'webmock', '~> 1.22.6'
28
28
 
29
- spec.add_dependency 'faraday'
30
- spec.add_dependency 'json'
29
+ spec.add_dependency 'faraday', '~> 0.9.2'
30
+ spec.add_dependency 'json', '~> 1.8.3'
31
+ spec.add_dependency 'word_wrap', '~> 1.0.0'
31
32
  end
@@ -1,5 +1,6 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
+ require 'word_wrap'
3
4
 
4
5
  SITE_URL = 'https://frinkiac.com'
5
6
  API_URL = "#{SITE_URL}/api/search"
@@ -22,14 +23,16 @@ module Frinkiac
22
23
  def meme_url(caption = nil)
23
24
  caption = self.caption if caption.nil?
24
25
  caption = caption.join("\n") if caption.is_a?(Array)
26
+
25
27
  "#{SITE_URL}/meme/#{episode}/#{timestamp}.jpg?lines=#{URI.escape caption}"
26
28
  end
27
29
 
28
30
  def caption
29
31
  @caption ||= begin
30
- response = Faraday.get("#{CAPTION_URL}?e=#{@episode}&t=#{@timestamp}")
32
+ response = Faraday.get("#{CAPTION_URL}?e=#{episode}&t=#{timestamp}")
31
33
  body = JSON.parse(response.body)
32
- body["Subtitles"].map { |s| s["Content"] }.join("\n")
34
+
35
+ format_captions(body['Subtitles'].collect { |s| s['Content'] })
33
36
  end
34
37
  end
35
38
 
@@ -44,5 +47,12 @@ module Frinkiac
44
47
  screencaps = search(query)
45
48
  screencaps[rand(screencaps.size)] if screencaps.any?
46
49
  end
50
+
51
+ private
52
+ def format_captions(captions)
53
+ caption_string = captions.join(' ')
54
+
55
+ WordWrap.ww(caption_string, 25).chop
56
+ end
47
57
  end
48
58
  end
@@ -1,3 +1,3 @@
1
1
  module Frinkiac
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frinkiac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cesar Camacho
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-16 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,30 +98,44 @@ dependencies:
98
98
  name: faraday
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.9.2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.9.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: json
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.8.3
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.8.3
125
+ - !ruby/object:Gem::Dependency
126
+ name: word_wrap
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.0.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '0'
138
+ version: 1.0.0
125
139
  description: Gem to wrap Frinkiac.com API
126
140
  email:
127
141
  - ccamacho@gapintelligence.com
@@ -130,7 +144,6 @@ extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
132
146
  - ".gitignore"
133
- - ".travis.yml"
134
147
  - CODE_OF_CONDUCT.md
135
148
  - Gemfile
136
149
  - LICENSE.txt
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.0
4
- before_install: gem install bundler -v 1.10.6