snapchat_api 0.1.6 → 0.1.7

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
2
  SHA256:
3
- metadata.gz: 610ba62897a08a9423272ac199a3c0bb3d9a2e4784d7bf7eb7f3f1122b696773
4
- data.tar.gz: 3cdb587109ab2340f7a765f2f0e41c83fa1e228ffbc2147ae29aea1c7036ff72
3
+ metadata.gz: 3d2fddf9efbe9f9729c3684370ed34e34c3eb2e7bcb852c31fd20f8704bce3e4
4
+ data.tar.gz: 5239d2a84ec3bf82425ec3ec6c3dc1a90a0885c65200a72e020cec2e9217a64d
5
5
  SHA512:
6
- metadata.gz: 375ea46e5c1a6d95ae99655e0da9959245e62bea8294bba8c752db0cd60e41d71125003bc1f8e883ce35190d6ed2ffeacde620592816e4f0e98a34ee8123bd79
7
- data.tar.gz: b4ee14a9e0207b32573609d5673b25365890fe0c2ff756f007cc82c83439aa11292fbf1d998e8a97ad5ea82e13c313c19d64cee05efd402778d14a76c7136448
6
+ metadata.gz: 358a31a8b86397994b76f6c0fafd80a874a48a589f5482ece61bcd185c3547887cfa039dc9e5ce536b22b2f34813823ded87b0eddd35e4250417b1ab57dfdccc
7
+ data.tar.gz: 42afb3def8554e05bbf827096756db9a86146a2762d56c6e2a9535a81d1871f8d0c24947b812e463dd610bb4ed4b14b1e8ad5bea6006322f1ceda1d694f89532
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.7](https://github.com/k0va1/snapchat_api/compare/v0.1.6...v0.1.7) (2026-01-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * add new endpoint for filtering ad squads by campaign ([#11](https://github.com/k0va1/snapchat_api/issues/11)) ([06a1aa3](https://github.com/k0va1/snapchat_api/commit/06a1aa389f69e7757760c26bb17d8a80cf588328))
9
+
3
10
  ## [0.1.6](https://github.com/k0va1/snapchat_api/compare/v0.1.5...v0.1.6) (2025-12-30)
4
11
 
5
12
 
@@ -1,20 +1,14 @@
1
+ require "uri"
2
+
1
3
  module SnapchatApi
2
4
  module Resources
3
5
  class AdSquad < Base
4
6
  def list_all(ad_account_id:, params: {})
5
- params[:limit] ||= 50
6
-
7
- ad_squads = []
8
- next_link = "adaccounts/#{ad_account_id}/adsquads?limit=#{params[:limit]}"
9
-
10
- loop do
11
- response = client.request(:get, next_link)
12
- next_link = response.body["paging"]["next_link"]
13
- ad_squads.concat(response.body["adsquads"].map { |el| el["adsquad"] })
14
- break if next_link.nil?
15
- end
7
+ fetch_all_adsquads("adaccounts/#{ad_account_id}/adsquads", params)
8
+ end
16
9
 
17
- ad_squads
10
+ def list_all_by_campaign(campaign_id:, params: {})
11
+ fetch_all_adsquads("campaigns/#{campaign_id}/adsquads", params)
18
12
  end
19
13
 
20
14
  def get(ad_squad_id:)
@@ -49,6 +43,23 @@ module SnapchatApi
49
43
  response = client.request(:get, "adsquads/#{ad_squad_id}/stats", params)
50
44
  response.body
51
45
  end
46
+
47
+ private
48
+
49
+ def fetch_all_adsquads(base_path, params)
50
+ params[:limit] ||= 50
51
+ ad_squads = []
52
+ next_link = "#{base_path}?#{URI.encode_www_form(params)}"
53
+
54
+ loop do
55
+ response = client.request(:get, next_link)
56
+ next_link = response.body["paging"]["next_link"]
57
+ ad_squads.concat(response.body["adsquads"].map { |el| el["adsquad"] })
58
+ break if next_link.nil?
59
+ end
60
+
61
+ ad_squads
62
+ end
52
63
  end
53
64
  end
54
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SnapchatApi
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapchat_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Koval