Module: ElephantDrive::MessageBuilder

Included in:
BaseService
Defined in:
lib/elephant-drive-service/message_builder.rb

Instance Method Summary collapse

Instance Method Details

#add_customer_message(customer, campaign_id) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/elephant-drive-service/message_builder.rb', line 5

def add_customer_message customer, campaign_id
  {
    'strIP' => '127.0.0.1',
    'iCampID' => campaign_id,
    'strCompany' => '',
    'strEmail' => customer.email,
    'strDisplayName' => '',
    'strPswd' => '123inicial',
    'iSubType' => customer.plan.subscription_type_id,
    'strOrderId' => '',
    'strCustomTrack' => ''
  }
end

#base_user_message(provisioning) ⇒ Object



76
77
78
79
80
# File 'lib/elephant-drive-service/message_builder.rb', line 76

def base_user_message provisioning
  {
    'gUserID' => provisioning.installed_user_id,
  }
end

#check_username_availability_message(email) ⇒ Object



54
55
56
57
58
59
# File 'lib/elephant-drive-service/message_builder.rb', line 54

def check_username_availability_message email
  {
    'user' => email,
    'iType' => 1
  }
end

#customer_list_message(params) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/elephant-drive-service/message_builder.rb', line 61

def customer_list_message params
  {
    'iPartnerID' => params[:partner_id],
    'dtStartReg' => params[:starting_registration_date],
    'dtEndReg' => params[:ending_registration_date],
    'iMaxRow' => params[:max_rows],
    'zSendEmail' => params[:send_email],
    'strEmail' => params[:email_to_send],
    'rf' => "csv",
    'iCampIDs' => {
      'int' => params[:campaign_id]
    }
  }
end

#deactivate_customer_message(installed_user_id) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/elephant-drive-service/message_builder.rb', line 27

def deactivate_customer_message installed_user_id
  {
    'strIP' => '127.0.0.1',
    'gUserID' => installed_user_id,
    'asAcctState' => 'SuspendedbyAccountAdministrator',
    'strDesc' => ''
  }
end

#get_customer_list_by_reg_date_message(partner_id, end_date) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/elephant-drive-service/message_builder.rb', line 89

def get_customer_list_by_reg_date_message partner_id, end_date
  {
    'iPartnerID' => partner_id,
    'dtStartReg' => Time.utc(1970,1,01,0,0,0).iso8601,
    'dtEndReg' => end_date.iso8601,
    'iMaxRow' => -1,
    'zSendEmail' => false,
    'strEmail' => '',
    'rf' => 'csv',
    'iCampIDs' => { 'int' => 1010 }
  }
end

#modify_subscription_message(provisioning, new_plan) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/elephant-drive-service/message_builder.rb', line 19

def modify_subscription_message provisioning, new_plan
  {
    'strIP' => '127.0.0.1',
    'gUserID' => provisioning.installed_user_id,
    'iSubType' => new_plan.subscription_type_id
  }
end

#reactivate_customer_message(provisioning) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/elephant-drive-service/message_builder.rb', line 36

def reactivate_customer_message provisioning
  {
    'gUserID' => provisioning.installed_user_id,
    'strEmail' => '',
    'strDisplayName' => '',
    'strIP' => '',
    'strDesc' => ''
  }
end

#reset_password_message(installed_user_id) ⇒ Object



82
83
84
85
86
87
# File 'lib/elephant-drive-service/message_builder.rb', line 82

def reset_password_message installed_user_id
  {
    'gUserID' => installed_user_id,
    'strIP' => '127.0.0.1'
  }
end

#search_customer_message(email) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/elephant-drive-service/message_builder.rb', line 46

def search_customer_message email
  {
    'strSearchText' => email,
    'scrCriterion' => 'Exact',
    'scCategory' => 'Email',
  }
end