rails-pinterest 0.2.4 → 0.2.6
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/CHANGELOG.md +18 -1
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/pinterest/http.rb +6 -0
- data/lib/pinterest/pins.rb +6 -2
- data/lib/pinterest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5241dc461ae0e5ff783ee12bd61c843945c177c4b952a5abb2f1c973c3326fc
|
4
|
+
data.tar.gz: fee7c390da7e21bd343fc35266de5ea2446c4e7dec5ec84ada5fb094a8243d25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7acfcca9742594f95e831ce2d61cf0944c65d116c552ed958a25a82c434e870e14963bc9f9c8753315665fa6de1b0104f26d1e958fd0270619bbc0a5525ec6bb
|
7
|
+
data.tar.gz: c806f17d45a9f1866f8e16ae018324a2a2b783b3644a09ed6a4f4ff5c2f3262ec5c8f0f57d1c3ebed05e0cd4469d8346f07b4403fbc9a0b1a46926f2b3f4ed77
|
data/CHANGELOG.md
CHANGED
@@ -47,4 +47,21 @@
|
|
47
47
|
- Revert V.0.2.3
|
48
48
|
|
49
49
|
## [0.2.4] - 2024-04-09
|
50
|
-
- Add User Account to API
|
50
|
+
- Add User Account to API
|
51
|
+
|
52
|
+
## [0.2.5] - 2024-05-10
|
53
|
+
- Add the beta endpoint https://developer.pinterest.com/docs/api/v5/#operation/multi_pins/analytics (it doesn't really work right now)
|
54
|
+
- Example usage:
|
55
|
+
```ruby
|
56
|
+
client = Pinterest::Client.new(access_token: "some-access-token")
|
57
|
+
params = {
|
58
|
+
pin_ids: ["920634348815764178","920634348815790715","920634348815829069","920634348815865049","920634348815897303","920634348815911959","920634348815943797","920634348816238458","920634348816183143","920634348816403644","920634348816488886","920634348816699966"],
|
59
|
+
start_date: "2024-03-01",
|
60
|
+
end_date: "2024-05-10",
|
61
|
+
metric_types: ["IMPRESSION", "OUTBOUND_CLICK", "PIN_CLICK", "SAVE", "SAVE_RATE", "VIDEO_MRC_VIEW", "VIDEO_10S_VIEW", "QUARTILE_95_PERCENT_VIEW", "VIDEO_V50_WATCH_TIME", "VIDEO_START", "VIDEO_AVG_WATCH_TIME", "TOTAL_COMMENTS", "TOTAL_REACTIONS"]
|
62
|
+
}
|
63
|
+
response = client.pins.get_multiple_pin_analytics(ids: params[:pin_ids], start_date: params[:start_date], end_date: params[:end_date], metric_types: params[:metric_types], parameters: {})
|
64
|
+
```
|
65
|
+
|
66
|
+
## [0.2.6] - 2024-06-22
|
67
|
+
- Added retries to the Faraday connections
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -260,4 +260,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
260
260
|
Everyone interacting in the Ruby Pinterest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/royalgiant/rails-pinterest/blob/main/CODE_OF_CONDUCT.md).
|
261
261
|
|
262
262
|
## Influences
|
263
|
-
Project heavily influenced by [https://github.com/alexrudall/ruby-openai](https://github.com/alexrudall/ruby-openai). Great project, go give them a star!
|
263
|
+
Project heavily influenced by [https://github.com/alexrudall/ruby-openai](https://github.com/alexrudall/ruby-openai). Great project, go give them a star!
|
264
|
+
|
265
|
+
## Where Is Rails-Pinterest Used?
|
266
|
+
Currently used by [Imagifyr](https://imagifyr.com) to allow creators to schedule their content. SEO Optimized with AI.
|
data/lib/pinterest/http.rb
CHANGED
@@ -56,6 +56,9 @@ module Pinterest
|
|
56
56
|
def conn(multipart: false)
|
57
57
|
Faraday.new do |f|
|
58
58
|
f.options[:timeout] = @request_timeout
|
59
|
+
f.request :retry, max: 3, interval: 0.05,
|
60
|
+
interval_randomness: 0.5, backoff_factor: 2,
|
61
|
+
exceptions: [Faraday::ConnectionFailed, Errno::ECONNRESET]
|
59
62
|
f.request(:multipart) if multipart
|
60
63
|
end
|
61
64
|
end
|
@@ -63,6 +66,9 @@ module Pinterest
|
|
63
66
|
def oauth_conn(multipart: false)
|
64
67
|
Faraday.new do |f|
|
65
68
|
f.options[:timeout] = @request_timeout
|
69
|
+
f.request :retry, max: 3, interval: 0.05,
|
70
|
+
interval_randomness: 0.5, backoff_factor: 2,
|
71
|
+
exceptions: [Faraday::ConnectionFailed, Errno::ECONNRESET]
|
66
72
|
f.request :url_encoded
|
67
73
|
f.adapter Faraday.default_adapter
|
68
74
|
end
|
data/lib/pinterest/pins.rb
CHANGED
@@ -24,8 +24,12 @@ module Pinterest
|
|
24
24
|
@client.patch(path: "/pins/#{id}", parameters: parameters)
|
25
25
|
end
|
26
26
|
|
27
|
-
def get_pin_analytics(id:, parameters: {})
|
28
|
-
@client.get(path: "/pins/#{id}/analytics", parameters: parameters)
|
27
|
+
def get_pin_analytics(id:, start_date:, end_date:, metric_types:, parameters: {})
|
28
|
+
@client.get(path: "/pins/#{id}/analytics?start_date=#{start_date}&end_date=#{end_date}&metric_types=#{metric_types}", parameters: parameters)
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_multiple_pin_analytics(ids:, start_date:, end_date:, metric_types:, parameters: {})
|
32
|
+
@client.get(path: "/pins/analytics?pin_ids=#{ids}&start_date=#{start_date}&end_date=#{end_date}&metric_types=#{metric_types}", parameters: parameters)
|
29
33
|
end
|
30
34
|
|
31
35
|
def save_pin(id: , parameters: {})
|
data/lib/pinterest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-pinterest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donald Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|