Class: Tiltify::CampaignsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/tiltify/resources/campaigns.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Tiltify::Resource

Instance Method Details

#challenges(campaign_id:) ⇒ Object



23
24
25
26
# File 'lib/tiltify/resources/campaigns.rb', line 23

def challenges(campaign_id:)
  response = get_request("campaigns/#{campaign_id}/challenges")
  Collection.from_response(response, type: Challenge)
end

#donations(campaign_id:, **params) ⇒ Object



8
9
10
11
# File 'lib/tiltify/resources/campaigns.rb', line 8

def donations(campaign_id:, **params)
  response = get_request("campaigns/#{campaign_id}/donations", params: params)
  Collection.from_response(response, type: Donation)
end

#polls(campaign_id:) ⇒ Object



18
19
20
21
# File 'lib/tiltify/resources/campaigns.rb', line 18

def polls(campaign_id:)
  response = get_request("campaigns/#{campaign_id}/polls")
  Collection.from_response(response, type: Poll)
end

#retrieve(campaign_id:) ⇒ Object



4
5
6
# File 'lib/tiltify/resources/campaigns.rb', line 4

def retrieve(campaign_id:)
  Campaign.new get_request("campaigns/#{campaign_id}").body.dig("data")
end

#rewards(campaign_id:) ⇒ Object



13
14
15
16
# File 'lib/tiltify/resources/campaigns.rb', line 13

def rewards(campaign_id:)
  response = get_request("campaigns/#{campaign_id}/rewards")
  Collection.from_response(response, type: Reward)
end

#schedule(campaign_id:) ⇒ Object



28
29
30
31
# File 'lib/tiltify/resources/campaigns.rb', line 28

def schedule(campaign_id:)
  response = get_request("campaigns/#{campaign_id}/schedule")
  Collection.from_response(response, type: Schedule)
end