snapchat_api 0.1.7 → 0.1.8

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: 3d2fddf9efbe9f9729c3684370ed34e34c3eb2e7bcb852c31fd20f8704bce3e4
4
- data.tar.gz: 5239d2a84ec3bf82425ec3ec6c3dc1a90a0885c65200a72e020cec2e9217a64d
3
+ metadata.gz: 68c01081685c51092fac5d51d23bfdd92783647f615454dba7b1ea42f2ce4796
4
+ data.tar.gz: 36708edcfd4d108effdd48e17a99d7d7c010913b40f0651eb104bc54ea9a7f01
5
5
  SHA512:
6
- metadata.gz: 358a31a8b86397994b76f6c0fafd80a874a48a589f5482ece61bcd185c3547887cfa039dc9e5ce536b22b2f34813823ded87b0eddd35e4250417b1ab57dfdccc
7
- data.tar.gz: 42afb3def8554e05bbf827096756db9a86146a2762d56c6e2a9535a81d1871f8d0c24947b812e463dd610bb4ed4b14b1e8ad5bea6006322f1ceda1d694f89532
6
+ metadata.gz: 4acabf2f1ddf87f1477bfdf509756cc5ae30623b4a9437ce157f8fee964a06916bb5d9f8e9bc9c6b8e9863f158052979dca9dcdd00b6b4d95ddcc23ac6aaae8a
7
+ data.tar.gz: 0f8bdb643cb3a189890eac966912788f0cb7d4da19973f86a26d37798bc87f1382b66f3c127eea45c241d239e96c9fa773f0a16547a1c60477cabc10878c8a8e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.8](https://github.com/k0va1/snapchat_api/compare/v0.1.7...v0.1.8) (2026-01-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * add funding sources api ([#15](https://github.com/k0va1/snapchat_api/issues/15)) ([1974240](https://github.com/k0va1/snapchat_api/commit/19742401dd77f4209cccf1be3a0c1cb5e8397ba0))
9
+ * add organizations ([#13](https://github.com/k0va1/snapchat_api/issues/13)) ([920bcc0](https://github.com/k0va1/snapchat_api/commit/920bcc08baee865da03cd174d4937a3dab35a6f0))
10
+
3
11
  ## [0.1.7](https://github.com/k0va1/snapchat_api/compare/v0.1.6...v0.1.7) (2026-01-13)
4
12
 
5
13
 
@@ -132,6 +132,14 @@ module SnapchatApi
132
132
  @ads ||= SnapchatApi::Resources::Ad.new(self)
133
133
  end
134
134
 
135
+ def organizations
136
+ @organizations ||= SnapchatApi::Resources::Organization.new(self)
137
+ end
138
+
139
+ def funding_sources
140
+ @funding_sources ||= SnapchatApi::Resources::FundingSource.new(self)
141
+ end
142
+
135
143
  private
136
144
 
137
145
  def handle_response(response)
@@ -0,0 +1,27 @@
1
+ module SnapchatApi
2
+ module Resources
3
+ class FundingSource < Base
4
+ def list_all(organization_id:, params: {})
5
+ params[:limit] ||= 50
6
+
7
+ funding_sources = []
8
+ query = URI.encode_www_form(params.compact)
9
+ next_link = "organizations/#{organization_id}/fundingsources?#{query}"
10
+
11
+ loop do
12
+ response = client.request(:get, next_link)
13
+ next_link = response.body.dig("paging", "next_link")
14
+ funding_sources.concat(response.body["fundingsources"].map { |el| el["fundingsource"] })
15
+ break if next_link.nil?
16
+ end
17
+
18
+ funding_sources
19
+ end
20
+
21
+ def get(funding_source_id:)
22
+ response = client.request(:get, "fundingsources/#{funding_source_id}")
23
+ response.body["fundingsources"].first["fundingsource"]
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module SnapchatApi
2
+ module Resources
3
+ class Organization < Base
4
+ def list_all(params: {})
5
+ params[:limit] ||= 50
6
+
7
+ organizations = []
8
+ query = URI.encode_www_form(params.compact)
9
+ next_link = "me/organizations?#{query}"
10
+
11
+ loop do
12
+ response = client.request(:get, next_link)
13
+ next_link = response.body.dig("paging", "next_link")
14
+ organizations.concat(response.body["organizations"].map { |el| el["organization"] })
15
+ break if next_link.nil?
16
+ end
17
+
18
+ organizations
19
+ end
20
+
21
+ def get(organization_id:)
22
+ response = client.request(:get, "organizations/#{organization_id}")
23
+ response.body["organizations"].first["organization"]
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SnapchatApi
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
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.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Koval
@@ -212,7 +212,9 @@ files:
212
212
  - lib/snapchat_api/resources/base.rb
213
213
  - lib/snapchat_api/resources/campaign.rb
214
214
  - lib/snapchat_api/resources/creative.rb
215
+ - lib/snapchat_api/resources/funding_source.rb
215
216
  - lib/snapchat_api/resources/media.rb
217
+ - lib/snapchat_api/resources/organization.rb
216
218
  - lib/snapchat_api/version.rb
217
219
  homepage: https://github.com/k0va1/snapchat_api
218
220
  licenses: []