|
57 | 57 | } |
58 | 58 | end |
59 | 59 |
|
| 60 | +def test_user_dates(email="[email protected]", created_at=1401970114, last_request_at=1401970113) |
| 61 | + { |
| 62 | + "type" =>"user", |
| 63 | + "id" =>"aaaaaaaaaaaaaaaaaaaaaaaa", |
| 64 | + "user_id" => 'id-from-customers-app', |
| 65 | + "email" => email, |
| 66 | + "name" => "Joe Schmoe", |
| 67 | + "avatar" => {"type"=>"avatar", "image_url"=>"https://graph.facebook.com/1/picture?width=24&height=24"}, |
| 68 | + "app_id" => "the-app-id", |
| 69 | + "custom_attributes" => {"a" => "b", "b" => 2}, |
| 70 | + "companies" => |
| 71 | + {"type"=>"company.list", |
| 72 | + "companies"=> |
| 73 | + [{"type"=>"company", |
| 74 | + "company_id"=>"123", |
| 75 | + "id"=>"bbbbbbbbbbbbbbbbbbbbbbbb", |
| 76 | + "app_id"=>"the-app-id", |
| 77 | + "name"=>"Company 1", |
| 78 | + "remote_created_at"=>1390936440, |
| 79 | + "created_at"=>1401970114, |
| 80 | + "updated_at"=>1401970114, |
| 81 | + "last_request_at"=>1401970113, |
| 82 | + "monthly_spend"=>0, |
| 83 | + "session_count"=>0, |
| 84 | + "user_count"=>1, |
| 85 | + "tag_ids"=>[], |
| 86 | + "custom_attributes"=>{"category"=>"Tech"}}]}, |
| 87 | + "session_count" => 123, |
| 88 | + "unsubscribed_from_emails" => true, |
| 89 | + "last_request_at" =>last_request_at, |
| 90 | + "created_at" =>created_at, |
| 91 | + "remote_created_at" =>1393613864, |
| 92 | + "updated_at" =>1401970114, |
| 93 | + "user_agent_data" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11", |
| 94 | + "social_profiles" =>{"type"=>"social_profile.list", |
| 95 | + "social_profiles" => [ |
| 96 | + {"type" => "social_profile", "name" => "twitter", "url" => "http://twitter.com/abc", "username" => "abc", "id" => nil}, |
| 97 | + {"type" => "social_profile", "name" => "twitter", "username" => "abc2", "url" => "http://twitter.com/abc2", "id" => nil}, |
| 98 | + {"type" => "social_profile", "name" => "facebook", "url" => "http://facebook.com/abc", "username" => "abc", "id" => "1234242"}, |
| 99 | + {"type" => "social_profile", "name" => "quora", "url" => "http://facebook.com/abc", "username" => "abc", "id" => "1234242"} |
| 100 | + ]}, |
| 101 | + "location_data"=> |
| 102 | + {"type"=>"location_data", |
| 103 | + "city_name"=> 'Dublin', |
| 104 | + "continent_code"=> 'EU', |
| 105 | + "country_name"=> 'Ireland', |
| 106 | + "latitude"=> '90', |
| 107 | + "longitude"=> '10', |
| 108 | + "postal_code"=> 'IE', |
| 109 | + "region_name"=> 'Europe', |
| 110 | + "timezone"=> '+1000', |
| 111 | + "country_code" => "IRL"} |
| 112 | + } |
| 113 | +end |
| 114 | + |
60 | 115 | def test_admin_list |
61 | 116 | { |
62 | 117 | "type" => "admin.list", |
@@ -161,6 +216,23 @@ def page_of_users(include_next_link= false) |
161 | 216 | } |
162 | 217 | end |
163 | 218 |
|
| 219 | +def users_pagination(include_next_link=false, per_page=0, page=0, total_pages=0, total_count=0, user_list=[]) |
| 220 | + { |
| 221 | + "type"=>"user.list", |
| 222 | + "pages"=> |
| 223 | + { |
| 224 | + "type"=>"pages", |
| 225 | + "next"=> (include_next_link ? "https://api.intercom.io/users?per_page=" \ |
| 226 | + + per_page.to_s + "&page=" + (page+1).to_s : nil), |
| 227 | + "page"=>page, |
| 228 | + "per_page"=>per_page, |
| 229 | + "total_pages"=>total_pages |
| 230 | + }, |
| 231 | + "users"=> user_list, |
| 232 | + "total_count"=>total_count |
| 233 | + } |
| 234 | +end |
| 235 | + |
164 | 236 | def test_conversation |
165 | 237 | { |
166 | 238 | "type" => "conversation", |
|
0 commit comments