omniauth-pixiv-public 0.1.6 → 0.1.9

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
- SHA1:
3
- metadata.gz: 03d3a0c9e2e892713f5f45efd6b80afba91f84a8
4
- data.tar.gz: '05649e31cdf616fe1543c8eebe36c6c041888f15'
2
+ SHA256:
3
+ metadata.gz: 0d16b85097d5d2f56a5edf0e82b63ba09f4905692f1d606c99df612b289ac5b2
4
+ data.tar.gz: 5d59780b1aa8ce0e92a63290dbe2a63436c4a22bb943f73e05576aed2f229259
5
5
  SHA512:
6
- metadata.gz: 6c0d3bbc338d2c46aad0baa65be76ee0d0aec1522d25f72ef40faafa35990aa3d2b6bd96b400e9883394eddf029f150ae2e904a3224b9e5f61f6f6e91acdcbb2
7
- data.tar.gz: '0811d9f03f46d14b23d66f18eab89194cb59a3c46ba64cfd526b989dda9a8c3d7c0cef963816e249e06a201119bfbff6fb3a47a48c49abc5d9c6d1984b7f89ad'
6
+ metadata.gz: c5693da04cf614a052b06b932439fa92dfdffe78ec13dec703bc5411a6bef531a28ae8cf61f260d5d4e70b858851795d4a6b873cbc1c579c9cffe827575186e2
7
+ data.tar.gz: 65cdf5008ba1fdaf2c71efb073a4187d24d2d8aca86be81989906b6e8ee1eaa5f49b357a2c4eb72d807e7c4c0006e8c0318cb05ebda1399decf5bbdfa4278675
@@ -1,2 +1,9 @@
1
1
  require 'omniauth-pixiv/version'
2
+ require 'omniauth-pixiv/faraday'
2
3
  require 'omniauth/strategies/pixiv'
4
+
5
+ module Omniauth
6
+ module Pixiv
7
+ end
8
+ end
9
+
@@ -0,0 +1,13 @@
1
+ require 'faraday'
2
+
3
+ module Omniauth
4
+ module Pixiv
5
+ module Faraday
6
+ module Request
7
+ autoload :UserAgent, 'omniauth-pixiv/faraday/request/user_agent'
8
+
9
+ ::Faraday::Request.register_middleware user_agent: -> { UserAgent }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../../version'
2
+
3
+ module Omniauth
4
+ module Pixiv
5
+ module Faraday
6
+ module Request
7
+ class UserAgent < ::Faraday::Middleware
8
+ DEFAULT_USER_AGENT = "omniauth-pixiv/#{Omniauth::Pixiv::VERSION}"
9
+
10
+ def initialize(app, user_agent)
11
+ @user_agent = user_agent
12
+ super(app)
13
+ end
14
+
15
+ def call(env)
16
+ env.request_headers['User-Agent'] = if env.request_headers['User-Agent']
17
+ @user_agent + " (#{env.request_headers['User-Agent']})"
18
+ else
19
+ @user_agent
20
+ end
21
+ @app.call(env)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Pixiv
3
- VERSION = '0.1.6'
3
+ VERSION = '0.1.9'
4
4
  end
5
5
  end
@@ -8,10 +8,11 @@ module OmniAuth
8
8
  option :client_options, {
9
9
  site: 'https://public-api.secure.pixiv.net',
10
10
  authorize_url: 'https://oauth.secure.pixiv.net/v2/auth/authorize',
11
- token_url: 'https://oauth.secure.pixiv.net/v2/auth/token'
11
+ token_url: 'https://oauth.secure.pixiv.net/v2/auth/token',
12
12
  }
13
13
 
14
14
  option :image_size, 'px_170x170'
15
+ option :user_agent, Omniauth::Pixiv::Faraday::Request::UserAgent::DEFAULT_USER_AGENT
15
16
 
16
17
  uid { raw_info['id'] }
17
18
 
@@ -29,6 +30,18 @@ module OmniAuth
29
30
  { raw_info: raw_info }
30
31
  end
31
32
 
33
+ def client
34
+ ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options)) do |faraday|
35
+ faraday.request :url_encoded
36
+ faraday.request :user_agent, options[:user_agent]
37
+ faraday.adapter Faraday.default_adapter
38
+ end
39
+ end
40
+
41
+ def callback_url
42
+ full_host + script_name + callback_path
43
+ end
44
+
32
45
  def raw_info
33
46
  @raw_info ||= access_token.get(RAW_INFO_URL).parsed['response'].first
34
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-pixiv-public
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edho Arief
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-19 00:00:00.000000000 Z
12
+ date: 2018-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2
@@ -67,6 +67,8 @@ files:
67
67
  - README.md
68
68
  - Rakefile
69
69
  - lib/omniauth-pixiv.rb
70
+ - lib/omniauth-pixiv/faraday.rb
71
+ - lib/omniauth-pixiv/faraday/request/user_agent.rb
70
72
  - lib/omniauth-pixiv/version.rb
71
73
  - lib/omniauth/strategies/pixiv.rb
72
74
  - omniauth-pixiv-public.gemspec
@@ -90,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
92
  version: '0'
91
93
  requirements: []
92
94
  rubyforge_project:
93
- rubygems_version: 2.6.11
95
+ rubygems_version: 2.7.6
94
96
  signing_key:
95
97
  specification_version: 4
96
98
  summary: OmniAuth strategy for pixiv.