Class: SnapchatApi::Resources::FundingSource
- Inherits:
-
Base
- Object
- Base
- SnapchatApi::Resources::FundingSource
show all
- Defined in:
- lib/snapchat_api/resources/funding_source.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#get(funding_source_id:) ⇒ Object
21
22
23
24
|
# File 'lib/snapchat_api/resources/funding_source.rb', line 21
def get(funding_source_id:)
response = client.request(:get, "fundingsources/#{funding_source_id}")
response.body["fundingsources"].first["fundingsource"]
end
|
#list_all(organization_id:, params: {}) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/snapchat_api/resources/funding_source.rb', line 4
def list_all(organization_id:, params: {})
params[:limit] ||= 50
funding_sources = []
query = URI.encode_www_form(params.compact)
next_link = "organizations/#{organization_id}/fundingsources?#{query}"
loop do
response = client.request(:get, next_link)
next_link = response.body.dig("paging", "next_link")
funding_sources.concat(response.body["fundingsources"].map { |el| el["fundingsource"] })
break if next_link.nil?
end
funding_sources
end
|