Class: Kentaa::Api::Resources::Segment
- Defined in:
- lib/kentaa/api/resources/segment.rb
Instance Attribute Summary
Attributes inherited from Resource
Attributes inherited from Base
#config, #endpoint_path, #options, #resource_class
Instance Method Summary collapse
- #actions ⇒ Object
- #activities ⇒ Object
- #banners ⇒ Object
- #description ⇒ Object
- #donate_url ⇒ Object
- #donations ⇒ Object
- #end_date ⇒ Object
- #external_reference ⇒ Object
- #manual_donations ⇒ Object
- #name ⇒ Object
- #newsletter_subscriptions ⇒ Object
- #object_key ⇒ Object
- #parent ⇒ Object
- #projects ⇒ Object
- #site ⇒ Object
- #site_id ⇒ Object
- #subdomain ⇒ Object
- #target_amount ⇒ Object
- #teams ⇒ Object
- #title ⇒ Object
- #total_amount ⇒ Object
- #total_donations ⇒ Object
- #url ⇒ Object
Methods inherited from Resource
#create, #created_at, #delete, #initialize, #load, #save, #updated_at
Methods inherited from Base
attribute_key, #initialize, #load, #loaded?
Constructor Details
This class inherits a constructor from Kentaa::Api::Resources::Resource
Instance Method Details
#actions ⇒ Object
84 85 86 |
# File 'lib/kentaa/api/resources/segment.rb', line 84 def actions @actions ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Action, endpoint_path: "/segments/#{id}/actions") end |
#activities ⇒ Object
108 109 110 |
# File 'lib/kentaa/api/resources/segment.rb', line 108 def activities @activities ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Activity, endpoint_path: "/segments/#{id}/activities") end |
#banners ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/kentaa/api/resources/segment.rb', line 66 def @banners ||= begin = [] if data[:banners] data[:banners].each do || << Kentaa::Api::Resources::Banner.new() end end end end |
#description ⇒ Object
38 39 40 |
# File 'lib/kentaa/api/resources/segment.rb', line 38 def description data[:description] end |
#donate_url ⇒ Object
62 63 64 |
# File 'lib/kentaa/api/resources/segment.rb', line 62 def donate_url data[:donate_url] end |
#donations ⇒ Object
96 97 98 |
# File 'lib/kentaa/api/resources/segment.rb', line 96 def donations @donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Donation, endpoint_path: "/segments/#{id}/donations") end |
#end_date ⇒ Object
54 55 56 |
# File 'lib/kentaa/api/resources/segment.rb', line 54 def end_date Time.parse(data[:end_date]) if data[:end_date] end |
#external_reference ⇒ Object
80 81 82 |
# File 'lib/kentaa/api/resources/segment.rb', line 80 def external_reference data[:external_reference] end |
#manual_donations ⇒ Object
100 101 102 |
# File 'lib/kentaa/api/resources/segment.rb', line 100 def manual_donations @manual_donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::ManualDonation, endpoint_path: "/segments/#{id}/manual-donations") end |
#name ⇒ Object
30 31 32 |
# File 'lib/kentaa/api/resources/segment.rb', line 30 def name data[:name] end |
#newsletter_subscriptions ⇒ Object
104 105 106 |
# File 'lib/kentaa/api/resources/segment.rb', line 104 def @newsletter_subscriptions ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::NewsletterSubscription, endpoint_path: "/segments/#{id}/newsletter-subscriptions") end |
#object_key ⇒ Object
10 11 12 |
# File 'lib/kentaa/api/resources/segment.rb', line 10 def object_key "Segment_#{id}" end |
#parent ⇒ Object
14 15 16 |
# File 'lib/kentaa/api/resources/segment.rb', line 14 def parent site end |
#projects ⇒ Object
92 93 94 |
# File 'lib/kentaa/api/resources/segment.rb', line 92 def projects @projects ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Project, endpoint_path: "/segments/#{id}/projects") end |
#site ⇒ Object
18 19 20 |
# File 'lib/kentaa/api/resources/segment.rb', line 18 def site Kentaa::Api::Resources::Site.new(config, id: site_id, options: ) end |
#site_id ⇒ Object
22 23 24 |
# File 'lib/kentaa/api/resources/segment.rb', line 22 def site_id data[:site_id] end |
#subdomain ⇒ Object
26 27 28 |
# File 'lib/kentaa/api/resources/segment.rb', line 26 def subdomain data[:subdomain] end |
#target_amount ⇒ Object
42 43 44 |
# File 'lib/kentaa/api/resources/segment.rb', line 42 def target_amount data[:target_amount] end |
#teams ⇒ Object
88 89 90 |
# File 'lib/kentaa/api/resources/segment.rb', line 88 def teams @teams ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Team, endpoint_path: "/segments/#{id}/teams") end |
#title ⇒ Object
34 35 36 |
# File 'lib/kentaa/api/resources/segment.rb', line 34 def title data[:title] end |
#total_amount ⇒ Object
46 47 48 |
# File 'lib/kentaa/api/resources/segment.rb', line 46 def total_amount BigDecimal(data[:total_amount]) end |
#total_donations ⇒ Object
50 51 52 |
# File 'lib/kentaa/api/resources/segment.rb', line 50 def total_donations data[:total_donations] end |
#url ⇒ Object
58 59 60 |
# File 'lib/kentaa/api/resources/segment.rb', line 58 def url data[:url] end |