aweplug 1.0.0.a17 → 1.0.0.a18

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,7 +59,7 @@ module Aweplug
59
59
  #
60
60
  # full_name - the full name, e.g. Pete Muir
61
61
  def first_name(full_name)
62
- full_name.split[0] || full_name
62
+ (full_name.nil?) ? full_name : full_name.split[0]
63
63
  end
64
64
 
65
65
  # Internal: Data object to hold and parse values from the Vimeo API.
@@ -188,7 +188,6 @@ module Aweplug
188
188
  #
189
189
  # Returns JSON retreived from the Vimeo API
190
190
  def exec_method(method, video_id)
191
- # TODO: Look at switching this to faraday
192
191
  if access_token
193
192
  query = "http://vimeo.com/api/rest/v2?method=#{method}&video_id=#{video_id}&format=json"
194
193
  access_token.get(query).body
@@ -205,17 +204,35 @@ module Aweplug
205
204
  #
206
205
  # Returns an OAuth::AccessToken for the Vimeo API
207
206
  def access_token
207
+ site ||= @site
208
208
  if @access_token
209
209
  @access_token
210
210
  else
211
211
  if not ENV['vimeo_client_secret']
212
212
  puts 'Cannot fetch video info from vimeo, vimeo_client_secret is missing from environment variables'
213
- # now create the access token object from passed values
214
- token_hash = { :oauth_token => @site.vimeo_access_token,
215
- :oauth_token_secret => ENV['vimeo_access_token_secret']
216
- }
217
- OAuth::AccessToken.from_hash(consumer, token_hash )
213
+ return
218
214
  end
215
+ if not site.vimeo_client_id
216
+ puts 'Cannot fetch video info vimeo, vimeo_client_id is missing from _config/site.yml'
217
+ return
218
+ end
219
+ if not ENV['vimeo_access_token_secret']
220
+ puts 'Cannot fetch video info from vimeo, vimeo_access_token_secret is missing from environment variables'
221
+ return
222
+ end
223
+ if not site.vimeo_access_token
224
+ puts 'Cannot fetch video info from vimeo, vimeo_access_token is missing from _config/site.yml'
225
+ return
226
+ end
227
+ consumer = OAuth::Consumer.new(site.vimeo_client_id, ENV['vimeo_client_secret'],
228
+ { :site => "https://vimeo.com",
229
+ :scheme => :header
230
+ })
231
+ # now create the access token object from passed values
232
+ token_hash = { :oauth_token => site.vimeo_access_token,
233
+ :oauth_token_secret => ENV['vimeo_access_token_secret']
234
+ }
235
+ OAuth::AccessToken.from_hash(consumer, token_hash )
219
236
  end
220
237
  end
221
238
  end
@@ -1,4 +1,4 @@
1
1
  module Aweplug
2
- VERSION='1.0.0.a17'
2
+ VERSION='1.0.0.a18'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aweplug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.a17
4
+ version: 1.0.0.a18
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-07 00:00:00.000000000 Z
12
+ date: 2014-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: octokit
@@ -191,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  segments:
193
193
  - 0
194
- hash: -3243289337858499691
194
+ hash: 2401597976548953007
195
195
  required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  none: false
197
197
  requirements: