yotpo 1.0.4 → 1.0.5
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 +4 -4
- data/lib/yotpo.rb +9 -1
- data/lib/yotpo/api/owner_feature.rb +2 -0
- data/lib/yotpo/client.rb +7 -2
- data/lib/yotpo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19ec639260657da67005f8aab271b0db691880fec072713f32c91fa1b1de1e79
|
4
|
+
data.tar.gz: feee72358ccf03f52a6d23688737d96a83b684f283417d7808b831f71694145e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d3cca8d9db338aec54be8e5a3394356424562a0f51d3bbc1968634e315d394884f78ac792dbe2482f8336c487f8383cd917208cea254d8b487a9a82591bc2dc
|
7
|
+
data.tar.gz: 081805d8331568f0caca62a570aa1ce0f132cc787105b92ba2e78f8d5fb7cc6dc7f99dafe05aa72f80eec5a983f9d367200ee672743371edfe4d715103212fb0
|
data/lib/yotpo.rb
CHANGED
@@ -19,6 +19,14 @@ module Yotpo
|
|
19
19
|
# @return [String] the secret that is registered with Yotpo
|
20
20
|
attr_accessor :secret
|
21
21
|
|
22
|
+
# @!attribute timeout
|
23
|
+
# @return [int] connection timeout in seconds
|
24
|
+
attr_accessor :timeout
|
25
|
+
|
26
|
+
# @!attribute user_agent
|
27
|
+
# @return [string] global user agent in header
|
28
|
+
attr_accessor :user_agent
|
29
|
+
|
22
30
|
# Configuration interface of the gem
|
23
31
|
#
|
24
32
|
# @yield [self] to accept configuration settings
|
@@ -40,7 +48,7 @@ module Yotpo
|
|
40
48
|
# @return an instance of Yotpo::Client
|
41
49
|
#
|
42
50
|
def client
|
43
|
-
@client ||= Yotpo::Client.new(@url || 'https://api.yotpo.com')
|
51
|
+
@client ||= Yotpo::Client.new(@url || 'https://api.yotpo.com', @parallel_requests || 5, @timeout || 60, @user_agent)
|
44
52
|
end
|
45
53
|
|
46
54
|
private
|
data/lib/yotpo/client.rb
CHANGED
@@ -47,9 +47,12 @@ module Yotpo
|
|
47
47
|
#
|
48
48
|
# @param url [String] The url to yotpo api (https://api.yotpo.com)
|
49
49
|
# @param parallel_requests [Integer String] The maximum parallel request to do (5)
|
50
|
-
def initialize(url = 'https://api.yotpo.com', parallel_requests
|
50
|
+
def initialize(url = 'https://api.yotpo.com', parallel_requests, timeout, user_agent)
|
51
51
|
@url = url
|
52
52
|
@parallel_requests = parallel_requests
|
53
|
+
@timeout = timeout
|
54
|
+
@headers = { yotpo_api_connector: 'Ruby'+Yotpo::VERSION }
|
55
|
+
@headers.merge!(user_agent: user_agent) if user_agent
|
53
56
|
end
|
54
57
|
|
55
58
|
#
|
@@ -134,7 +137,9 @@ module Yotpo
|
|
134
137
|
#
|
135
138
|
# @return an instance of Faraday initialized with all that this gem needs
|
136
139
|
def connection
|
137
|
-
@connection ||= Faraday.new(url: @url, parallel_manager: Typhoeus::Hydra.new(max_concurrency: @parallel_requests), headers:
|
140
|
+
@connection ||= Faraday.new(url: @url, parallel_manager: Typhoeus::Hydra.new(max_concurrency: @parallel_requests), headers: @headers) do |conn|
|
141
|
+
|
142
|
+
conn.options.timeout = @timeout
|
138
143
|
|
139
144
|
conn.use Yotpo::ResponseParser
|
140
145
|
|
data/lib/yotpo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yotpo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Shub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.7.
|
232
|
+
rubygems_version: 2.7.7
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: A Ruby interface to the YOTPO API
|