@@ -40,21 +40,15 @@ def resize_image(url, filename)
4040 HTTParty . post ( api_path ( "images/resize" ) , body : { url : url , target_filename : filename } , headers : http_headers )
4141 end
4242
43- def register ( promo_code , first_name , last_name , email , roles )
44- data = {
45- promo_code : promo_code ,
46- first_name : first_name ,
47- last_name : last_name ,
48- email : email ,
49- password : SecureRandom . hex ( 8 ) ,
50- roles : roles
51- }
43+ def register_with_promo_code ( promo_code , first_name , last_name , email , roles )
44+ register ( { promo_code : promo_code } , first_name , last_name , email , roles )
45+ end
5246
53- response = post_with_auth ( "auth/register" , data )
54- response [ :password ] = data [ :password ]
55- response
47+ def register_with_price_plan ( price_plan , first_name , last_name , email , roles )
48+ register ( { price_plan : price_plan } , first_name , last_name , email , roles )
5649 end
5750
51+
5852 def update_input_feed ( feed_id , user_feed_slug , petitions , last_modified , publish_as_draft = false )
5953 post_with_auth ( "input_feeds/process" , {
6054 feed : {
@@ -95,6 +89,20 @@ def get_with_auth(endpoint, data = nil)
9589
9690 protected
9791
92+ def register ( data , first_name , last_name , email , roles )
93+ data . merge! ( {
94+ first_name : first_name ,
95+ last_name : last_name ,
96+ email : email ,
97+ password : SecureRandom . hex ( 8 ) ,
98+ roles : roles
99+ } )
100+
101+ response = post_with_auth ( "auth/register" , data )
102+ response [ :password ] = data [ :password ]
103+ response
104+ end
105+
98106 def api_path ( endpoint )
99107 "#{ self . url_prefix } /#{ endpoint } "
100108 end
0 commit comments