naver-sdk 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/lib/naver/configration.rb +1 -1
- data/lib/naver/configuration.rb +30 -0
- data/lib/naver/connection.rb +2 -2
- data/lib/naver/oauth.rb +2 -2
- data/lib/naver/sdk.rb +2 -2
- data/lib/naver/sdk/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e0243cfe19078ff67d9712ea9e7cb391565a736
|
4
|
+
data.tar.gz: 919a6fb9458ecc66e3b442e45205f4dd617a2c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad842ba0141739859b1f00cc6931b54c4ff2e4b9e31871025c80f7a5394ccfa14f7459a891c9481fc8fd18dc3118027cdc3a929246f26e7738a6aa8027a96df3
|
7
|
+
data.tar.gz: 453d890ba05bf8b98bb72335b7b54abb2a0acdb5c6d155325caa51320d2406bee87974b42e709053f996cfc64f260520fdc1046f99beae7f1476b25ef60fd168
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,12 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
## [unreleased]
|
5
5
|
|
6
|
+
## [0.6.0] - 2017-07-09
|
7
|
+
- rename Configration -> Configuration, configration -> configuration
|
8
|
+
- fix typo
|
9
|
+
|
6
10
|
## [0.5.0] - 2017-07-09
|
7
|
-
- improve
|
11
|
+
- improve configuration
|
8
12
|
- core_ext/hash/keys
|
9
13
|
|
10
14
|
## [0.4.0] - 2017-06-26
|
@@ -32,4 +36,5 @@ All notable changes to this project will be documented in this file.
|
|
32
36
|
[0.3.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.2.0...v0.3.0
|
33
37
|
[0.4.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.3.0...v0.4.0
|
34
38
|
[0.5.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.4.0...v0.5.0
|
35
|
-
[
|
39
|
+
[0.6.0]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.5.0...v0.6.0
|
40
|
+
[unreleased]: https://github.com/kimsuelim/naver-sdk-ruby/compare/v0.6.0...HEAD
|
data/lib/naver/configration.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Naver
|
2
2
|
# Defines constants and methods related to configuration.
|
3
|
-
module
|
3
|
+
module Configuration
|
4
4
|
# An array of valid keys in the options hash when configuring a Naver::Client.
|
5
5
|
OPTION_KEYS = [:client_id, :client_secret, :redirect_uri, :timeout, :debug].freeze
|
6
6
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Naver
|
2
|
+
# Defines constants and methods related to configuration.
|
3
|
+
module Configuration
|
4
|
+
# An array of valid keys in the options hash when configuring a Naver::Client.
|
5
|
+
OPTION_KEYS = [:client_id, :client_secret, :redirect_uri, :timeout, :debug].freeze
|
6
|
+
|
7
|
+
# The user agent that will be sent to the API endpoint if none is set.
|
8
|
+
DEFAULT_USER_AGENT = "NAVER Ruby SDK Gem #{Naver::Sdk::VERSION}".freeze
|
9
|
+
|
10
|
+
# Base URI for the NAVER API.
|
11
|
+
DEFAULT_API_BASE_URI = "https://openapi.naver.com".freeze
|
12
|
+
|
13
|
+
# Base URI for NAVER OAuth.
|
14
|
+
DEFAULT_OAUTH_BASE_URI = "https://nid.naver.com".freeze
|
15
|
+
|
16
|
+
attr_accessor *OPTION_KEYS
|
17
|
+
|
18
|
+
# Convenience method to allow configuration options to be set in a block.
|
19
|
+
def configure
|
20
|
+
yield(self)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Creates a hash of options and their values.
|
24
|
+
def options
|
25
|
+
options = {}
|
26
|
+
OPTION_KEYS.each { |key| options[key] = send(key) }
|
27
|
+
options
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/naver/connection.rb
CHANGED
@@ -4,8 +4,8 @@ module Naver
|
|
4
4
|
def initialize
|
5
5
|
@client_id = Naver.client_id
|
6
6
|
@client_secret = Naver.client_secret
|
7
|
-
@api_base_uri =
|
8
|
-
@headers = { user_agent:
|
7
|
+
@api_base_uri = Configuration::DEFAULT_API_BASE_URI
|
8
|
+
@headers = { user_agent: Configuration::DEFAULT_USER_AGENT }
|
9
9
|
@connection = Faraday.new(url: @api_base_uri, headers: @headers) do |faraday|
|
10
10
|
faraday.request :multipart
|
11
11
|
faraday.request :url_encoded
|
data/lib/naver/oauth.rb
CHANGED
@@ -5,10 +5,10 @@ module Naver
|
|
5
5
|
def initialize(redirect_uri: Naver.redirect_uri)
|
6
6
|
@client_id = Naver.client_id
|
7
7
|
@client_secret = Naver.client_secret
|
8
|
-
@oauth_base_uri =
|
8
|
+
@oauth_base_uri = Configuration::DEFAULT_OAUTH_BASE_URI
|
9
9
|
@redirect_uri = redirect_uri
|
10
10
|
|
11
|
-
headers = { user_agent:
|
11
|
+
headers = { user_agent: Configuration::DEFAULT_USER_AGENT }
|
12
12
|
@oauth = OAuth2::Client.new(@client_id, @client_secret, site: @oauth_base_uri, authorize_url: "/oauth2.0/authorize", token_url: "/oauth2.0/token", headers: headers) do |http|
|
13
13
|
http.request :multipart
|
14
14
|
http.request :url_encoded
|
data/lib/naver/sdk.rb
CHANGED
@@ -3,7 +3,7 @@ require "faraday"
|
|
3
3
|
|
4
4
|
require "naver/sdk/version"
|
5
5
|
require "naver/core_ext/hash/keys"
|
6
|
-
require "naver/
|
6
|
+
require "naver/configuration"
|
7
7
|
require "naver/connection"
|
8
8
|
require "naver/client"
|
9
9
|
require "naver/error"
|
@@ -20,5 +20,5 @@ require "naver/vision"
|
|
20
20
|
require "naver/voice"
|
21
21
|
|
22
22
|
module Naver
|
23
|
-
extend
|
23
|
+
extend Configuration
|
24
24
|
end
|
data/lib/naver/sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naver-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Surim Kim
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- bin/setup
|
135
135
|
- lib/naver/client.rb
|
136
136
|
- lib/naver/configration.rb
|
137
|
+
- lib/naver/configuration.rb
|
137
138
|
- lib/naver/connection.rb
|
138
139
|
- lib/naver/core_ext/hash/keys.rb
|
139
140
|
- lib/naver/error.rb
|