Class: CampaignMaster::Subscriber
- Inherits:
-
Object
- Object
- CampaignMaster::Subscriber
- Defined in:
- lib/campaign_master/subscriber.rb
Constant Summary collapse
- ImportError =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #import(format, delimeter, subscribers) ⇒ Object
-
#initialize(client) ⇒ Subscriber
constructor
A new instance of Subscriber.
Constructor Details
#initialize(client) ⇒ Subscriber
Returns a new instance of Subscriber.
9 10 11 |
# File 'lib/campaign_master/subscriber.rb', line 9 def initialize(client) self.client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/campaign_master/subscriber.rb', line 7 def client @client end |
Instance Method Details
#import(format, delimeter, subscribers) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/campaign_master/subscriber.rb', line 13 def import(format, delimeter, subscribers) soap_client = CampaignMaster::SoapClient.get_client(self.get_import_headers(delimeter)) response = soap_client.call(:submit_import_job, message_tag: "SubmitJobRequest", message: { FileToImport: Base64.encode64("#{format}\r\n#{subscribers}") }, :attributes => CampaignMaster::SoapClient.attributes ) raise ImportError if !self.valid_response?(response) response.body[:job_submission_result_message][:job_id].to_i end |