Class: MarketingServiceWrapper::Company

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/marketing_service_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#channelsObject



32
33
34
35
36
37
38
# File 'lib/marketing_service_wrapper.rb', line 32

def channels
  channels = Net::HTTP.get_response(URI.join(MarketingServiceWrapper::Base.site, '/channels', "?company_id=#{self.id}"))
  body = JSON.parse(channels.body)
  body["channels"].map do |b|
    Channel.new(name: b["name"], id: b["id"])
  end
end

#opt_insObject



40
41
42
43
44
45
46
# File 'lib/marketing_service_wrapper.rb', line 40

def opt_ins
  opt_ins = Net::HTTP.get_response(URI.join(MarketingServiceWrapper::Base.site, '/opt_ins', "?company_id=#{self.id}"))
  body = JSON.parse(opt_ins.body)
  body["opt_ins"].map do |b|
    OptIn.new(b)
  end
end