Class: Patreon::CampaignsResource
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#benefits(id:, fields: Benefit::DEFAULT_FIELDS) ⇒ Object
24
25
26
27
|
# File 'lib/patreon/resources/campaigns.rb', line 24
def benefits(id:, fields: Benefit::DEFAULT_FIELDS)
response = get_request("campaigns/#{id}?include=benefits&fields[benefit]=#{fields}")
Collection.from_response(response, type: Benefit, key: "included")
end
|
#creator(id:, fields: User::DEFAULT_FIELDS) ⇒ Object
19
20
21
22
|
# File 'lib/patreon/resources/campaigns.rb', line 19
def creator(id:, fields: User::DEFAULT_FIELDS)
response = get_request("campaigns/#{id}?include=creator&fields[user]=#{fields}")
User.new response.body.dig("included")[0]
end
|
#goals(id:, fields: Goal::DEFAULT_FIELDS) ⇒ Object
29
30
31
32
|
# File 'lib/patreon/resources/campaigns.rb', line 29
def goals(id:, fields: Goal::DEFAULT_FIELDS)
response = get_request("campaigns/#{id}?include=goals&fields[goal]=#{fields}")
Collection.from_response(response, type: Goal, key: "included")
end
|
#list(fields: Campaign::DEFAULT_FIELDS) ⇒ Object
#members(id:, member_fields: Member::DEFAULT_FIELDS, user_fields: User::DEFAULT_FIELDS, campaign_fields: Campaign::DEFAULT_FIELDS) ⇒ Object
#retrieve(id:, fields: Campaign::DEFAULT_FIELDS) ⇒ Object
9
10
11
12
|
# File 'lib/patreon/resources/campaigns.rb', line 9
def retrieve(id:, fields: Campaign::DEFAULT_FIELDS)
response = get_request("campaigns/#{id}?fields[campaign]=#{fields}")
Campaign.new response.body.dig("data")
end
|
#tiers(id:, fields: Tier::DEFAULT_FIELDS) ⇒ Object
14
15
16
17
|
# File 'lib/patreon/resources/campaigns.rb', line 14
def tiers(id:, fields: Tier::DEFAULT_FIELDS)
response = get_request("campaigns/#{id}?include=tiers&fields[tier]=#{fields}")
Collection.from_response(response, type: Tier, key: "included")
end
|