[{"data":1,"prerenderedAt":743},["ShallowReactive",2],{"navigation":3,"\u002Fuser":43,"\u002Fuser-surround":738},[4,8,13,18,23,28,33,38],{"title":5,"path":6,"stem":7},"Getting started","\u002F","index",{"title":9,"path":10,"stem":11,"order":12},"Numbers","\u002Fnumbers","numbers",1,{"title":14,"path":15,"stem":16,"order":17},"Rent","\u002Frent","rent",2,{"title":19,"path":20,"stem":21,"order":22},"User","\u002Fuser","user",3,{"title":24,"path":25,"stem":26,"order":27},"Free numbers","\u002Ffree","free",4,{"title":29,"path":30,"stem":31,"order":32},"Webhooks","\u002Fwebhooks","webhooks",5,{"title":34,"path":35,"stem":36,"order":37},"Testing","\u002Ftesting","testing",6,{"title":39,"path":40,"stem":41,"order":42},"Changelog","\u002Fchangelog","changelog",7,{"id":44,"title":19,"body":45,"description":732,"extension":733,"meta":734,"navigation":735,"path":20,"seo":736,"stem":21,"__hash__":737},"docs\u002Fuser.md",{"type":46,"value":47,"toc":724},"minimark",[48,52,56,78,95,177,197,200,203,216,222,293,296,299,324,357,453,456,462,481,510,522,525,528,541,559,562,565,587,621,720],[49,50,51],"h2",{"id":51},"balance",[53,54,55],"p",{},"Balance in USD.",[57,58,63],"pre",{"className":59,"code":60,"language":61,"meta":62,"style":62},"language-ruby shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","balance # => {\"balance\" => Float, \"zbalance\" => Float, \"income\" => Float (when sent)}\n","ruby","",[64,65,66],"code",{"__ignoreMap":62},[67,68,70,74],"span",{"class":69,"line":12},"line",[67,71,73],{"class":72},"sTEyZ","balance ",[67,75,77],{"class":76},"sHwdD","# => {\"balance\" => Float, \"zbalance\" => Float, \"income\" => Float (when sent)}\n",[53,79,80,82,83,86,87,90,91,94],{},[64,81,51],{}," includes the sum frozen by numbers and unconfirmed rents in progress (",[64,84,85],{},"zbalance",", which may be negative): available = ",[64,88,89],{},"balance − max(zbalance, 0)",". ",[64,92,93],{},"income"," is the partner income. The server caches the answer for 60 s.",[57,96,98],{"className":59,"code":97,"language":61,"meta":62,"style":62},"b = client.user.balance\navailable = b[\"balance\"] - [b[\"zbalance\"], 0].max\n",[64,99,100,123],{"__ignoreMap":62},[67,101,102,105,109,112,115,118,120],{"class":69,"line":12},[67,103,104],{"class":72},"b ",[67,106,108],{"class":107},"sMK4o","=",[67,110,111],{"class":72}," client",[67,113,114],{"class":107},".",[67,116,21],{"class":117},"s2Zo4",[67,119,114],{"class":107},[67,121,122],{"class":117},"balance\n",[67,124,125,128,130,133,136,139,142,144,147,150,153,156,158,160,162,164,167,171,174],{"class":69,"line":17},[67,126,127],{"class":72},"available ",[67,129,108],{"class":107},[67,131,132],{"class":72}," b",[67,134,135],{"class":107},"[",[67,137,138],{"class":107},"\"",[67,140,51],{"class":141},"sfazB",[67,143,138],{"class":107},[67,145,146],{"class":107},"]",[67,148,149],{"class":107}," -",[67,151,152],{"class":107}," [",[67,154,155],{"class":72},"b",[67,157,135],{"class":107},[67,159,138],{"class":107},[67,161,85],{"class":141},[67,163,138],{"class":107},[67,165,166],{"class":107},"],",[67,168,170],{"class":169},"sbssI"," 0",[67,172,173],{"class":107},"].",[67,175,176],{"class":117},"max\n",[53,178,179,180,183,184,187,188,187,191,187,194,114],{},"Errors: ",[64,181,182],{},"ApiError"," ",[64,185,186],{},"ERROR_WRONG_KEY",", ",[64,189,190],{},"ACCOUNT_BLOCKED",[64,192,193],{},"API_ACCESS_DISABLED",[64,195,196],{},"API_ACCESS_IP",[49,198,199],{"id":199},"profile",[53,201,202],{},"The account profile.",[57,204,206],{"className":59,"code":205,"language":61,"meta":62,"style":62},"profile # => Hash\n",[64,207,208],{"__ignoreMap":62},[67,209,210,213],{"class":69,"line":12},[67,211,212],{"class":72},"profile ",[67,214,215],{"class":76},"# => Hash\n",[53,217,218,219,114],{},"Profile: ",[64,220,221],{},"{\"id\", \"name\", \"username\", \"email\", \"locale\", \"currency\", \"number_country\", \"number_reject\", \"webhook_url\", \"api_access\", …}",[57,223,225],{"className":59,"code":224,"language":61,"meta":62,"style":62},"profile = client.user.profile\nputs profile.values_at(\"email\", \"webhook_url\").join(\" \")\n",[64,226,227,244],{"__ignoreMap":62},[67,228,229,231,233,235,237,239,241],{"class":69,"line":12},[67,230,212],{"class":72},[67,232,108],{"class":107},[67,234,111],{"class":72},[67,236,114],{"class":107},[67,238,21],{"class":117},[67,240,114],{"class":107},[67,242,243],{"class":117},"profile\n",[67,245,246,249,252,254,257,260,262,265,267,270,273,276,278,281,284,286,288,290],{"class":69,"line":17},[67,247,248],{"class":117},"puts",[67,250,251],{"class":72}," profile",[67,253,114],{"class":107},[67,255,256],{"class":117},"values_at",[67,258,259],{"class":107},"(",[67,261,138],{"class":107},[67,263,264],{"class":141},"email",[67,266,138],{"class":107},[67,268,269],{"class":107},",",[67,271,272],{"class":107}," \"",[67,274,275],{"class":141},"webhook_url",[67,277,138],{"class":107},[67,279,280],{"class":107},").",[67,282,283],{"class":117},"join",[67,285,259],{"class":107},[67,287,138],{"class":107},[67,289,272],{"class":107},[67,291,292],{"class":107},")\n",[49,294,295],{"id":295},"payment_history",[53,297,298],{},"Top-up orders (paginated, newest first) and the available payment methods.",[57,300,302],{"className":59,"code":301,"language":61,"meta":62,"style":62},"payment_history(page = 1) # => Hash\n",[64,303,304],{"__ignoreMap":62},[67,305,306,308,310,313,315,318,321],{"class":69,"line":12},[67,307,295],{"class":117},[67,309,259],{"class":107},[67,311,312],{"class":72},"page ",[67,314,108],{"class":107},[67,316,317],{"class":169}," 1",[67,319,320],{"class":107},")",[67,322,323],{"class":76}," # => Hash\n",[53,325,326,329,330,333,334,337,338,341,342,345,346,90,349,352,353,356],{},[64,327,328],{},"{\"orders\" => paginator, \"paylist\", \"domains\"?, \"forms\"?, \"currency\"?, \"buttons\"?}",". An order's ",[64,331,332],{},"sum"," stays a decimal string (",[64,335,336],{},"\"89.00\"","); ",[64,339,340],{},"currency"," and ",[64,343,344],{},"form_text"," may be ",[64,347,348],{},"nil",[64,350,351],{},"paylist"," maps a group id to its payment methods, or is an ",[64,354,355],{},"Array"," when the ids are 0, 1, 2… (the server sends a JSON array then).",[57,358,360],{"className":59,"code":359,"language":61,"meta":62,"style":62},"orders = client.user.payment_history[\"orders\"]\nputs \"#{orders['total']} orders, page #{orders['current_page']}\u002F#{orders['last_page']}\"\n",[64,361,362,391],{"__ignoreMap":62},[67,363,364,367,369,371,373,375,377,379,381,383,386,388],{"class":69,"line":12},[67,365,366],{"class":72},"orders ",[67,368,108],{"class":107},[67,370,111],{"class":72},[67,372,114],{"class":107},[67,374,21],{"class":117},[67,376,114],{"class":107},[67,378,295],{"class":117},[67,380,135],{"class":107},[67,382,138],{"class":107},[67,384,385],{"class":141},"orders",[67,387,138],{"class":107},[67,389,390],{"class":107},"]\n",[67,392,393,395,397,400,402,404,407,410,412,415,418,420,422,424,426,429,431,433,435,437,439,441,443,446,448,450],{"class":69,"line":17},[67,394,248],{"class":117},[67,396,272],{"class":107},[67,398,399],{"class":107},"#{",[67,401,385],{"class":72},[67,403,135],{"class":107},[67,405,406],{"class":107},"'",[67,408,409],{"class":141},"total",[67,411,406],{"class":107},[67,413,414],{"class":107},"]}",[67,416,417],{"class":141}," orders, page ",[67,419,399],{"class":107},[67,421,385],{"class":72},[67,423,135],{"class":107},[67,425,406],{"class":107},[67,427,428],{"class":141},"current_page",[67,430,406],{"class":107},[67,432,414],{"class":107},[67,434,6],{"class":141},[67,436,399],{"class":107},[67,438,385],{"class":72},[67,440,135],{"class":107},[67,442,406],{"class":107},[67,444,445],{"class":141},"last_page",[67,447,406],{"class":107},[67,449,414],{"class":107},[67,451,452],{"class":107},"\"\n",[49,454,455],{"id":455},"set_webhook_url",[53,457,458,459,280],{},"Set the URL that receives SMS webhooks (see ",[460,461,29],"a",{"href":30},[57,463,465],{"className":59,"code":464,"language":61,"meta":62,"style":62},"set_webhook_url(url) # => true\n",[64,466,467],{"__ignoreMap":62},[67,468,469,471,473,476,478],{"class":69,"line":12},[67,470,455],{"class":117},[67,472,259],{"class":107},[67,474,475],{"class":72},"url",[67,477,320],{"class":107},[67,479,480],{"class":76}," # => true\n",[57,482,484],{"className":59,"code":483,"language":61,"meta":62,"style":62},"client.user.set_webhook_url(\"https:\u002F\u002Fexample.com\u002Fonlinesim-hook\")\n",[64,485,486],{"__ignoreMap":62},[67,487,488,491,493,495,497,499,501,503,506,508],{"class":69,"line":12},[67,489,490],{"class":72},"client",[67,492,114],{"class":107},[67,494,21],{"class":117},[67,496,114],{"class":107},[67,498,455],{"class":117},[67,500,259],{"class":107},[67,502,138],{"class":107},[67,504,505],{"class":141},"https:\u002F\u002Fexample.com\u002Fonlinesim-hook",[67,507,138],{"class":107},[67,509,292],{"class":107},[53,511,179,512,183,514,517,518,521],{},[64,513,182],{},[64,515,516],{},"VALIDATION_ERROR"," for an invalid URL; ",[64,519,520],{},"message"," holds the server's field messages.",[49,523,524],{"id":524},"clear_webhook_url",[53,526,527],{},"Remove the webhook URL, also from operations in progress.",[57,529,531],{"className":59,"code":530,"language":61,"meta":62,"style":62},"clear_webhook_url # => true\n",[64,532,533],{"__ignoreMap":62},[67,534,535,538],{"class":69,"line":12},[67,536,537],{"class":72},"clear_webhook_url ",[67,539,540],{"class":76},"# => true\n",[57,542,544],{"className":59,"code":543,"language":61,"meta":62,"style":62},"client.user.clear_webhook_url\n",[64,545,546],{"__ignoreMap":62},[67,547,548,550,552,554,556],{"class":69,"line":12},[67,549,490],{"class":72},[67,551,114],{"class":107},[67,553,21],{"class":117},[67,555,114],{"class":107},[67,557,558],{"class":117},"clear_webhook_url\n",[49,560,561],{"id":561},"webhook_logs",[53,563,564],{},"Webhook delivery log, newest first, 10 per page.",[57,566,568],{"className":59,"code":567,"language":61,"meta":62,"style":62},"webhook_logs(page = 1) # => paginator Hash\n",[64,569,570],{"__ignoreMap":62},[67,571,572,574,576,578,580,582,584],{"class":69,"line":12},[67,573,561],{"class":117},[67,575,259],{"class":107},[67,577,312],{"class":72},[67,579,108],{"class":107},[67,581,317],{"class":169},[67,583,320],{"class":107},[67,585,586],{"class":76}," # => paginator Hash\n",[53,588,589,590,593,594,597,598,601,602,187,605,597,608,187,611,601,614,187,617,620],{},"A log entry: ",[64,591,592],{},"{\"id\", \"user_id\", \"webhook_url\", \"type\", \"params\", \"status\", \"error\", \"created_at\", \"updated_at\"}"," — ",[64,595,596],{},"type"," is ",[64,599,600],{},"receiving_sms"," or ",[64,603,604],{},"rent_sms",[64,606,607],{},"status",[64,609,610],{},"success",[64,612,613],{},"fail",[64,615,616],{},"pending",[64,618,619],{},"params"," the payload that was sent.",[57,622,624],{"className":59,"code":623,"language":61,"meta":62,"style":62},"client.user.webhook_logs[\"data\"].each do |log|\n  puts log.values_at(\"created_at\", \"status\", \"error\").join(\" \")\nend\n",[64,625,626,665,715],{"__ignoreMap":62},[67,627,628,630,632,634,636,638,640,642,645,647,649,652,656,659,662],{"class":69,"line":12},[67,629,490],{"class":72},[67,631,114],{"class":107},[67,633,21],{"class":117},[67,635,114],{"class":107},[67,637,561],{"class":117},[67,639,135],{"class":107},[67,641,138],{"class":107},[67,643,644],{"class":141},"data",[67,646,138],{"class":107},[67,648,173],{"class":107},[67,650,651],{"class":117},"each",[67,653,655],{"class":654},"s7zQu"," do",[67,657,658],{"class":107}," |",[67,660,661],{"class":72},"log",[67,663,664],{"class":107},"|\n",[67,666,667,670,673,675,677,679,681,684,686,688,690,692,694,696,698,701,703,705,707,709,711,713],{"class":69,"line":17},[67,668,669],{"class":117},"  puts",[67,671,672],{"class":72}," log",[67,674,114],{"class":107},[67,676,256],{"class":117},[67,678,259],{"class":107},[67,680,138],{"class":107},[67,682,683],{"class":141},"created_at",[67,685,138],{"class":107},[67,687,269],{"class":107},[67,689,272],{"class":107},[67,691,607],{"class":141},[67,693,138],{"class":107},[67,695,269],{"class":107},[67,697,272],{"class":107},[67,699,700],{"class":141},"error",[67,702,138],{"class":107},[67,704,280],{"class":107},[67,706,283],{"class":117},[67,708,259],{"class":107},[67,710,138],{"class":107},[67,712,272],{"class":107},[67,714,292],{"class":107},[67,716,717],{"class":69,"line":22},[67,718,719],{"class":654},"end\n",[721,722,723],"style",{},"html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}",{"title":62,"searchDepth":17,"depth":17,"links":725},[726,727,728,729,730,731],{"id":51,"depth":17,"text":51},{"id":199,"depth":17,"text":199},{"id":295,"depth":17,"text":295},{"id":455,"depth":17,"text":455},{"id":524,"depth":17,"text":524},{"id":561,"depth":17,"text":561},"Balance, profile, payments and the webhook URL — client.user.","md",{},{"order":22},{"title":19,"description":732},"lKXlYgF6ovAkyuARrChyS9UlPg_eQXtnah_iUDud2EI",[739,741],{"title":34,"path":35,"stem":36,"description":740,"order":37},"Test your integration offline with MockOnlineSim — no network, key or money.",{"title":29,"path":30,"stem":31,"description":742,"order":32},"Receive SMS as HTTP callbacks and parse them with OnlineSim.parse_webhook.",1795163990845]