mini_fb 2.3.0 → 2.4.0

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: d2412598e44c1895afa24f90c51c3dfa9cc455a5
4
- data.tar.gz: 1248ba2537bd4852bc345b1f484a5afcb9691648
3
+ metadata.gz: 3035e3f90f64cfc5e754e9e7a1017cc2c5f41fa5
4
+ data.tar.gz: 26f1ccd78b203c204eba259b9d673f5d72d14445
5
5
  SHA512:
6
- metadata.gz: 9ffb593d1f77925e35156c58fb80d0c41d8610f2abf9e0821c01ace02bbdc201b1aefd04d88603c64a666e4be570161e323e02f3541b1887e67e7ded8564b78a
7
- data.tar.gz: 9aefa41163573ffcc2c43d4b476c4f4d93e3b53d1e35d9be91f10300ddfa9cd15307be721351d557efb48b60b2ca7183b5e26019c5854ede7dd5e5ee6decf9b2
6
+ metadata.gz: '0969be3dc7034777e972904f70393f6c10013342d4b01bcf770a14efd50bee0578a949817150b90aa1e2482d23d149ea4f5597a4de6b4efe195d5a711678a450'
7
+ data.tar.gz: 78beff53728a238a059b5bb05bf148c956609fd2b8accb27d804b60ef99a0a488e458dd56e9e9a724c6ee24e11daf9be0e3b1090b013a244241f61e0eff36fd6
@@ -519,7 +519,7 @@ module MiniFB
519
519
  # - app_id: your app ID (string)
520
520
  # - secret: your app secret (string)
521
521
  # - access_token: short-lived user token (string)
522
- # returns a hash with one value being 'access_token', the other being 'expires'
522
+ # returns a hash with one value being 'access_token', the other being 'expires_in'
523
523
  #
524
524
  # Throws MiniFB::FaceBookError if response from Facebook Graph API is not successful
525
525
  def self.fb_exchange_token(app_id, secret, access_token)
@@ -531,17 +531,11 @@ module MiniFB
531
531
  response = @@http.get oauth_url
532
532
  body = response.body.to_s
533
533
  puts 'resp=' + body if @@logging
534
+ res_hash = JSON.parse(body)
534
535
  unless response.ok?
535
- res_hash = JSON.parse(body)
536
536
  raise MiniFB::FaceBookError.new(response.status, "#{res_hash["error"]["type"]}: #{res_hash["error"]["message"]}")
537
537
  end
538
- params = {}
539
- params_array = body.split("&")
540
- params_array.each do |p|
541
- ps = p.split("=")
542
- params[ps[0]] = ps[1]
543
- end
544
- return params
538
+ return res_hash
545
539
  end
546
540
 
547
541
  # Return a JSON object of working Oauth tokens from working session keys, returned in order given
@@ -567,7 +561,7 @@ module MiniFB
567
561
  options = {}
568
562
  options[:params] = params
569
563
  options[:method] = :get
570
- options[:response_type] = :params
564
+ options[:response_type] = :json
571
565
  resp = fetch(url, options)
572
566
  puts 'resp=' + resp.to_s if @@logging
573
567
  resp
@@ -1,3 +1,3 @@
1
1
  module MiniFB
2
- VERSION = "2.3.0"
2
+ VERSION = "2.4.0"
3
3
  end
@@ -41,7 +41,7 @@ describe MiniFB do
41
41
  res = MiniFB.fb_exchange_token(app_id, app_secret, access_token)
42
42
 
43
43
  expect(res).to include('access_token')
44
- expect(res).to include('expires')
44
+ expect(res).to include('expires_in')
45
45
  end
46
46
 
47
47
  it 'raises error on request with invalid params' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_fb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient