Class: RallyUp::Partner::Campaign

Inherits:
Object
  • Object
show all
Defined in:
lib/rally_up/partner/campaign.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Campaign

Returns a new instance of Campaign.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rally_up/partner/campaign.rb', line 15

def initialize(json)
  @id = json[:Id]
  @name = json[:Name]
  @url = json[:Url]
  @campaign_setup_url = json[:CampaignSetupUrl]
  @campaign_status = json[:CampaignStatus]
  @start_date_utc = json[:StartDateUtc]
  @end_date_utc = json[:EndDateUtc]
  @amount_raised = json[:AmountRaised]
  @amount_raised_in_period = json[:AmountRaisedInPeriod]
  @amount_goal = json[:AmountGoal]
  @goal_period = json[:GoalPeriod]
  @total_views = json[:TotalViews]
  @total_supporters = json[:TotalSupporters]
  @organization_id = json[:OrganizationId]
  @organization_name = json[:OrganizationName]
  @timezone_name = json[:TimezoneName]
  @utcoffset_minutes = json[:UtcOffsetMinutes]
  @time_remaining_minutes = json[:TimeRemainingMinutes]
  @thumbnail_url = json[:ThumbnailUrl]
  @cta_label = json[:CtaLabel]
  @management_pages = json[:ManagementPages]
  @primary_currency = json[:PrimaryCurrency]
  @currency_symbol = json[:CurrencySymbol]
  @project_id = json[:ProjectId]
  @fund_code = json[:FundCode]
  @fundraising_activity_type = json[:FundraisingActivityType]
end

Instance Attribute Details

#amount_goalObject

Returns the value of attribute amount_goal.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def amount_goal
  @amount_goal
end

#amount_raisedObject

Returns the value of attribute amount_raised.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def amount_raised
  @amount_raised
end

#amount_raised_in_periodObject

Returns the value of attribute amount_raised_in_period.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def amount_raised_in_period
  @amount_raised_in_period
end

#campaign_setup_urlObject

Returns the value of attribute campaign_setup_url.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def campaign_setup_url
  @campaign_setup_url
end

#campaign_statusObject

Returns the value of attribute campaign_status.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def campaign_status
  @campaign_status
end

#cta_labelObject

Returns the value of attribute cta_label.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def cta_label
  @cta_label
end

#currency_symbolObject

Returns the value of attribute currency_symbol.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def currency_symbol
  @currency_symbol
end

#end_date_utcObject

Returns the value of attribute end_date_utc.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def end_date_utc
  @end_date_utc
end

#fund_codeObject

Returns the value of attribute fund_code.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def fund_code
  @fund_code
end

#fundraising_activity_typeObject

Returns the value of attribute fundraising_activity_type.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def fundraising_activity_type
  @fundraising_activity_type
end

#goal_periodObject

Returns the value of attribute goal_period.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def goal_period
  @goal_period
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def id
  @id
end

#management_pagesObject

Returns the value of attribute management_pages.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def management_pages
  @management_pages
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def name
  @name
end

#organization_idObject

Returns the value of attribute organization_id.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def organization_id
  @organization_id
end

#organization_nameObject

Returns the value of attribute organization_name.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def organization_name
  @organization_name
end

#primary_currencyObject

Returns the value of attribute primary_currency.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def primary_currency
  @primary_currency
end

#project_idObject

Returns the value of attribute project_id.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def project_id
  @project_id
end

#start_date_utcObject

Returns the value of attribute start_date_utc.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def start_date_utc
  @start_date_utc
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def thumbnail_url
  @thumbnail_url
end

#time_remaining_minutesObject

Returns the value of attribute time_remaining_minutes.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def time_remaining_minutes
  @time_remaining_minutes
end

#timezone_nameObject

Returns the value of attribute timezone_name.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def timezone_name
  @timezone_name
end

#total_supportersObject

Returns the value of attribute total_supporters.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def total_supporters
  @total_supporters
end

#total_viewsObject

Returns the value of attribute total_views.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def total_views
  @total_views
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def url
  @url
end

#utcoffset_minutesObject

Returns the value of attribute utcoffset_minutes.



6
7
8
# File 'lib/rally_up/partner/campaign.rb', line 6

def utcoffset_minutes
  @utcoffset_minutes
end

Class Method Details

.list(organization_id:, start_date: nil, end_date: nil, sort_by: nil, campaign_type: nil, include_donation_pages: nil, status: nil) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rally_up/partner/campaign.rb', line 45

def list(
  organization_id:, # required
  start_date: nil, # optional
  end_date: nil, # optional
  sort_by: nil, # optional
  campaign_type: nil, # optional
  include_donation_pages: nil, # optional
  status: nil # optional
)
  json = RallyUp::Partner.json(:get, '/v1/partnerapi/campaigns', params: {
    organizationID: organization_id,
    endDate: end_date,
    startDate: start_date,
    sortBy: sort_by,
    campaignType: campaign_type,
    includeDonationPages: include_donation_pages,
    status: status
  }.reject { |_k, v| v.nil? })
  RallyUp::ListObject.new(json, self)
end

.retrieve(id) ⇒ Object



66
67
68
69
# File 'lib/rally_up/partner/campaign.rb', line 66

def retrieve(id)
  json = RallyUp::Partner.json(:get, "/v1/partnerapi/campaigns/#{id}")
  new(json[:Result].to_h)
end