[{"data":1,"prerenderedAt":1749},["ShallowReactive",2],{"navigation":3,"\u002Ftesting":43,"\u002Ftesting-surround":1744},[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":34,"body":45,"description":1738,"extension":1739,"meta":1740,"navigation":1741,"path":35,"seo":1742,"stem":36,"__hash__":1743},"docs\u002Ftesting.md",{"type":46,"value":47,"toc":1730},"minimark",[48,60,65,156,214,334,361,422,426,444,790,815,819,847,1058,1120,1124,1153,1361,1365,1540,1544,1726],[49,50,51,55,56,59],"p",{},[52,53,54],"code",{},"OnlineSim::MockOnlineSim"," is an in-process fake of the OnlineSim API that ships with the gem. It is a transport that answers like the real backend — same shapes, same error codes, HTTP 456 for a wrong key — and keeps a balance, operations and rents. Your code talks to a normal ",[52,57,58],{},"OnlineSim::Client",", so nothing in it changes for tests. It is deterministic: no randomness, no clock, numbers and ids come from a counter.",[61,62,64],"h2",{"id":63},"setup","Setup",[66,67,72],"pre",{"className":68,"code":69,"language":70,"meta":71,"style":71},"language-ruby shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","require \"onlinesim\" # MockOnlineSim is autoloaded on first use; `require \"onlinesim\u002Fmock\"` works too\n\nmock = OnlineSim::MockOnlineSim.new(balance: 10)\nclient = mock.client # an OnlineSim::Client wired to the mock\n","ruby","",[52,73,74,97,103,137],{"__ignoreMap":71},[75,76,78,82,86,90,93],"span",{"class":77,"line":12},"line",[75,79,81],{"class":80},"sbssI","require",[75,83,85],{"class":84},"sMK4o"," \"",[75,87,89],{"class":88},"sfazB","onlinesim",[75,91,92],{"class":84},"\"",[75,94,96],{"class":95},"sHwdD"," # MockOnlineSim is autoloaded on first use; `require \"onlinesim\u002Fmock\"` works too\n",[75,98,99],{"class":77,"line":17},[75,100,102],{"emptyLinePlaceholder":101},true,"\n",[75,104,105,109,112,116,119,122,125,128,131,134],{"class":77,"line":22},[75,106,108],{"class":107},"sTEyZ","mock ",[75,110,111],{"class":84},"=",[75,113,115],{"class":114},"sBMFI"," OnlineSim",[75,117,118],{"class":84},"::",[75,120,121],{"class":114},"MockOnlineSim",[75,123,124],{"class":84},".",[75,126,127],{"class":80},"new",[75,129,130],{"class":84},"(balance:",[75,132,133],{"class":80}," 10",[75,135,136],{"class":84},")\n",[75,138,139,142,144,147,149,153],{"class":77,"line":27},[75,140,141],{"class":107},"client ",[75,143,111],{"class":84},[75,145,146],{"class":107}," mock",[75,148,124],{"class":84},[75,150,152],{"class":151},"s2Zo4","client",[75,154,155],{"class":95}," # an OnlineSim::Client wired to the mock\n",[66,157,159],{"className":68,"code":158,"language":70,"meta":71,"style":71},"OnlineSim::MockOnlineSim.new(api_key: \"mock-key\", balance: 100, prices: nil, rent_tariffs: nil, guard_interval: 0)\n",[52,160,161],{"__ignoreMap":71},[75,162,163,166,168,170,172,174,177,179,182,184,187,190,193,195,198,201,204,206,209,212],{"class":77,"line":12},[75,164,165],{"class":114},"OnlineSim",[75,167,118],{"class":84},[75,169,121],{"class":114},[75,171,124],{"class":84},[75,173,127],{"class":80},[75,175,176],{"class":84},"(api_key:",[75,178,85],{"class":84},[75,180,181],{"class":88},"mock-key",[75,183,92],{"class":84},[75,185,186],{"class":84},",",[75,188,189],{"class":84}," balance:",[75,191,192],{"class":80}," 100",[75,194,186],{"class":84},[75,196,197],{"class":84}," prices:",[75,199,200],{"class":84}," nil,",[75,202,203],{"class":84}," rent_tariffs:",[75,205,200],{"class":84},[75,207,208],{"class":84}," guard_interval:",[75,210,211],{"class":80}," 0",[75,213,136],{"class":84},[215,216,217,233],"table",{},[218,219,220],"thead",{},[221,222,223,227,230],"tr",{},[224,225,226],"th",{},"Option",[224,228,229],{},"Default",[224,231,232],{},"Description",[234,235,236,260,275,293,312],"tbody",{},[221,237,238,244,249],{},[239,240,241],"td",{},[52,242,243],{},"api_key",[239,245,246],{},[52,247,248],{},"\"mock-key\"",[239,250,251,252,255,256,259],{},"Key the mock accepts. ",[52,253,254],{},"mock.client"," uses it; ",[52,257,258],{},"mock.client(api_key: \"x\")"," tests a wrong key.",[221,261,262,267,272],{},[239,263,264],{},[52,265,266],{},"balance",[239,268,269],{},[52,270,271],{},"100",[239,273,274],{},"Starting balance, USD.",[221,276,277,282,287],{},[239,278,279],{},[52,280,281],{},"prices",[239,283,284],{},[52,285,286],{},"{ 7 => { \"vkcom\" => 0.5, \"telegram\" => 1.2, \"google\" => 0.3 }, 44 => { \"google\" => 0.2, \"vkcom\" => 0.36 } }",[239,288,289,290,124],{},"Number prices, country code → service slug → USD; replaces the defaults. Also feeds ",[52,291,292],{},"numbers.tariffs",[221,294,295,300,305],{},[239,296,297],{},[52,298,299],{},"rent_tariffs",[239,301,302],{},[52,303,304],{},"{ 7 => { days: { 1 => 1.0, 3 => 2.5, 7 => 5.0 }, extend: 1 } }",[239,306,307,308,311],{},"Rent prices; ",[52,309,310],{},"extend: 0"," makes rents of that country non-extendable.",[221,313,314,319,324],{},[239,315,316],{},[52,317,318],{},"guard_interval",[239,320,321],{},[52,322,323],{},"0",[239,325,326,329,330,333],{},[52,327,328],{},"> 0",": an operation without SMS, or an unconfirmed rent without any SMS, cannot be closed (",[52,331,332],{},"NO_COMPLETE_TZID",").",[49,335,336,339,340,345,346,349,350,353,354,356,357,360],{},[52,337,338],{},"mock.client(**options)"," takes the usual ",[341,342,344],"a",{"href":343},"\u002F#client-options","client options"," except ",[52,347,348],{},"transport:",". To build the client yourself, pass ",[52,351,352],{},"mock.transport"," (the mock itself) as ",[52,355,348],{},"; any ",[52,358,359],{},"base_url"," works:",[66,362,364],{"className":68,"code":363,"language":70,"meta":71,"style":71},"mock = OnlineSim::MockOnlineSim.new\nclient = OnlineSim::Client.new(api_key: \"mock-key\", transport: mock.transport)\n",[52,365,366,383],{"__ignoreMap":71},[75,367,368,370,372,374,376,378,380],{"class":77,"line":12},[75,369,108],{"class":107},[75,371,111],{"class":84},[75,373,115],{"class":114},[75,375,118],{"class":84},[75,377,121],{"class":114},[75,379,124],{"class":84},[75,381,382],{"class":80},"new\n",[75,384,385,387,389,391,393,396,398,400,402,404,406,408,410,413,415,417,420],{"class":77,"line":17},[75,386,141],{"class":107},[75,388,111],{"class":84},[75,390,115],{"class":114},[75,392,118],{"class":84},[75,394,395],{"class":114},"Client",[75,397,124],{"class":84},[75,399,127],{"class":80},[75,401,176],{"class":84},[75,403,85],{"class":84},[75,405,181],{"class":88},[75,407,92],{"class":84},[75,409,186],{"class":84},[75,411,412],{"class":84}," transport:",[75,414,146],{"class":107},[75,416,124],{"class":84},[75,418,419],{"class":151},"transport",[75,421,136],{"class":84},[61,423,425],{"id":424},"a-full-example","A full example",[49,427,428,429,432,433,436,437,439,440,443],{},"Order a number, let an SMS arrive while ",[52,430,431],{},"wait_code"," polls, check the code and the money. ",[52,434,435],{},"add_sms_after"," delivers the SMS after a number of polls instead of after some time, so ",[52,438,431],{}," runs with ",[52,441,442],{},"interval: 0"," and the test takes milliseconds.",[66,445,447],{"className":68,"code":446,"language":70,"meta":71,"style":71},"require \"minitest\u002Fautorun\"\nrequire \"onlinesim\"\n\nclass ReceiveCodeTest \u003C Minitest::Test\n  def test_receives_the_code\n    mock = OnlineSim::MockOnlineSim.new(balance: 10)\n    client = mock.client\n\n    order = client.numbers.get_with_number(\"google\", 44)\n    assert_equal \"+44900000001\", order[\"number\"]\n\n    mock.add_sms_after(order[\"tzid\"], \"Your Google code: 123-456\", 2) # the third poll sees it\n    code = client.numbers.wait_code(order[\"tzid\"], interval: 0)\n\n    assert_equal \"123456\", code\n    assert_equal \"TZ_OVER_OK\", mock.operations.first.status # wait_code closed it\n    assert_in_delta 9.8, mock.balance # the price is spent once an SMS arrived\n  end\nend\n",[52,448,449,461,471,475,495,503,526,540,545,582,613,618,663,702,707,724,758,778,784],{"__ignoreMap":71},[75,450,451,453,455,458],{"class":77,"line":12},[75,452,81],{"class":80},[75,454,85],{"class":84},[75,456,457],{"class":88},"minitest\u002Fautorun",[75,459,460],{"class":84},"\"\n",[75,462,463,465,467,469],{"class":77,"line":17},[75,464,81],{"class":80},[75,466,85],{"class":84},[75,468,89],{"class":88},[75,470,460],{"class":84},[75,472,473],{"class":77,"line":22},[75,474,102],{"emptyLinePlaceholder":101},[75,476,477,481,484,487,490,492],{"class":77,"line":27},[75,478,480],{"class":479},"s7zQu","class",[75,482,483],{"class":114}," ReceiveCodeTest",[75,485,486],{"class":84}," \u003C",[75,488,489],{"class":114}," Minitest",[75,491,118],{"class":84},[75,493,494],{"class":114},"Test\n",[75,496,497,500],{"class":77,"line":32},[75,498,499],{"class":479},"  def",[75,501,502],{"class":151}," test_receives_the_code\n",[75,504,505,508,510,512,514,516,518,520,522,524],{"class":77,"line":37},[75,506,507],{"class":107},"    mock ",[75,509,111],{"class":84},[75,511,115],{"class":114},[75,513,118],{"class":84},[75,515,121],{"class":114},[75,517,124],{"class":84},[75,519,127],{"class":80},[75,521,130],{"class":84},[75,523,133],{"class":80},[75,525,136],{"class":84},[75,527,528,531,533,535,537],{"class":77,"line":42},[75,529,530],{"class":107},"    client ",[75,532,111],{"class":84},[75,534,146],{"class":107},[75,536,124],{"class":84},[75,538,539],{"class":151},"client\n",[75,541,543],{"class":77,"line":542},8,[75,544,102],{"emptyLinePlaceholder":101},[75,546,548,551,553,556,558,560,562,565,568,570,573,575,577,580],{"class":77,"line":547},9,[75,549,550],{"class":107},"    order ",[75,552,111],{"class":84},[75,554,555],{"class":107}," client",[75,557,124],{"class":84},[75,559,11],{"class":151},[75,561,124],{"class":84},[75,563,564],{"class":151},"get_with_number",[75,566,567],{"class":84},"(",[75,569,92],{"class":84},[75,571,572],{"class":88},"google",[75,574,92],{"class":84},[75,576,186],{"class":84},[75,578,579],{"class":80}," 44",[75,581,136],{"class":84},[75,583,585,588,590,593,595,597,600,603,605,608,610],{"class":77,"line":584},10,[75,586,587],{"class":107},"    assert_equal ",[75,589,92],{"class":84},[75,591,592],{"class":88},"+44900000001",[75,594,92],{"class":84},[75,596,186],{"class":84},[75,598,599],{"class":107}," order",[75,601,602],{"class":84},"[",[75,604,92],{"class":84},[75,606,607],{"class":88},"number",[75,609,92],{"class":84},[75,611,612],{"class":84},"]\n",[75,614,616],{"class":77,"line":615},11,[75,617,102],{"emptyLinePlaceholder":101},[75,619,621,624,626,628,630,633,635,637,640,642,645,647,650,652,654,657,660],{"class":77,"line":620},12,[75,622,623],{"class":107},"    mock",[75,625,124],{"class":84},[75,627,435],{"class":151},[75,629,567],{"class":84},[75,631,632],{"class":107},"order",[75,634,602],{"class":84},[75,636,92],{"class":84},[75,638,639],{"class":88},"tzid",[75,641,92],{"class":84},[75,643,644],{"class":84},"],",[75,646,85],{"class":84},[75,648,649],{"class":88},"Your Google code: 123-456",[75,651,92],{"class":84},[75,653,186],{"class":84},[75,655,656],{"class":80}," 2",[75,658,659],{"class":84},")",[75,661,662],{"class":95}," # the third poll sees it\n",[75,664,666,669,671,673,675,677,679,681,683,685,687,689,691,693,695,698,700],{"class":77,"line":665},13,[75,667,668],{"class":107},"    code ",[75,670,111],{"class":84},[75,672,555],{"class":107},[75,674,124],{"class":84},[75,676,11],{"class":151},[75,678,124],{"class":84},[75,680,431],{"class":151},[75,682,567],{"class":84},[75,684,632],{"class":107},[75,686,602],{"class":84},[75,688,92],{"class":84},[75,690,639],{"class":88},[75,692,92],{"class":84},[75,694,644],{"class":84},[75,696,697],{"class":84}," interval:",[75,699,211],{"class":80},[75,701,136],{"class":84},[75,703,705],{"class":77,"line":704},14,[75,706,102],{"emptyLinePlaceholder":101},[75,708,710,712,714,717,719,721],{"class":77,"line":709},15,[75,711,587],{"class":107},[75,713,92],{"class":84},[75,715,716],{"class":88},"123456",[75,718,92],{"class":84},[75,720,186],{"class":84},[75,722,723],{"class":107}," code\n",[75,725,727,729,731,734,736,738,740,742,745,747,750,752,755],{"class":77,"line":726},16,[75,728,587],{"class":107},[75,730,92],{"class":84},[75,732,733],{"class":88},"TZ_OVER_OK",[75,735,92],{"class":84},[75,737,186],{"class":84},[75,739,146],{"class":107},[75,741,124],{"class":84},[75,743,744],{"class":151},"operations",[75,746,124],{"class":84},[75,748,749],{"class":151},"first",[75,751,124],{"class":84},[75,753,754],{"class":151},"status",[75,756,757],{"class":95}," # wait_code closed it\n",[75,759,761,764,767,769,771,773,775],{"class":77,"line":760},17,[75,762,763],{"class":107},"    assert_in_delta ",[75,765,766],{"class":80},"9.8",[75,768,186],{"class":84},[75,770,146],{"class":107},[75,772,124],{"class":84},[75,774,266],{"class":151},[75,776,777],{"class":95}," # the price is spent once an SMS arrived\n",[75,779,781],{"class":77,"line":780},18,[75,782,783],{"class":479},"  end\n",[75,785,787],{"class":77,"line":786},19,[75,788,789],{"class":479},"end\n",[49,791,792,793,796,797,800,801,803,804,807,808,811,812,814],{},"The ",[52,794,795],{},"msg"," of an operation is the code by default: the first run of 4–8 digits, with spaces and dashes between digits removed (",[52,798,799],{},"123-456"," → ",[52,802,716],{},"); a text without such a run comes back whole. ",[52,805,806],{},"message_to_code: false"," (or ",[52,809,810],{},"full_message: true"," in ",[52,813,431],{},") gives the full text.",[61,816,818],{"id":817},"errors","Errors",[49,820,821,824,825,828,829,807,832,835,836,839,840,843,844,333],{},[52,822,823],{},"fail_next(code)"," makes the next request answer ",[52,826,827],{},"{\"response\": code}"," — the client turns it into ",[52,830,831],{},"ApiError",[52,833,834],{},"NoNumberError",") exactly as for the real server. Pass ",[52,837,838],{},"endpoint:"," to fail only that endpoint. ",[52,841,842],{},"fail_next_transport"," makes the next request fail with a non-JSON HTTP 502 (",[52,845,846],{},"TransportError",[66,848,850],{"className":68,"code":849,"language":70,"meta":71,"style":71},"def test_handles_a_missing_number_and_a_network_hiccup\n  mock = OnlineSim::MockOnlineSim.new\n  client = mock.client\n\n  mock.fail_next(\"NO_NUMBER\", endpoint: \"getNum.php\")\n  assert_raises(OnlineSim::NoNumberError) { client.numbers.get(\"google\") }\n\n  mock.fail_next_transport(status: 503)\n  assert_raises(OnlineSim::TransportError) { client.user.balance }\n\n  assert_in_delta 100, client.user.balance[\"balance\"] # one-shot\nend\n",[52,851,852,860,877,890,894,927,969,973,989,1017,1021,1054],{"__ignoreMap":71},[75,853,854,857],{"class":77,"line":12},[75,855,856],{"class":479},"def",[75,858,859],{"class":151}," test_handles_a_missing_number_and_a_network_hiccup\n",[75,861,862,865,867,869,871,873,875],{"class":77,"line":17},[75,863,864],{"class":107},"  mock ",[75,866,111],{"class":84},[75,868,115],{"class":114},[75,870,118],{"class":84},[75,872,121],{"class":114},[75,874,124],{"class":84},[75,876,382],{"class":80},[75,878,879,882,884,886,888],{"class":77,"line":22},[75,880,881],{"class":107},"  client ",[75,883,111],{"class":84},[75,885,146],{"class":107},[75,887,124],{"class":84},[75,889,539],{"class":151},[75,891,892],{"class":77,"line":27},[75,893,102],{"emptyLinePlaceholder":101},[75,895,896,899,901,904,906,908,911,913,915,918,920,923,925],{"class":77,"line":32},[75,897,898],{"class":107},"  mock",[75,900,124],{"class":84},[75,902,903],{"class":151},"fail_next",[75,905,567],{"class":84},[75,907,92],{"class":84},[75,909,910],{"class":88},"NO_NUMBER",[75,912,92],{"class":84},[75,914,186],{"class":84},[75,916,917],{"class":84}," endpoint:",[75,919,85],{"class":84},[75,921,922],{"class":88},"getNum.php",[75,924,92],{"class":84},[75,926,136],{"class":84},[75,928,929,932,934,936,938,940,942,945,947,949,951,953,956,958,960,962,964,966],{"class":77,"line":37},[75,930,931],{"class":151},"  assert_raises",[75,933,567],{"class":84},[75,935,165],{"class":114},[75,937,118],{"class":84},[75,939,834],{"class":107},[75,941,659],{"class":84},[75,943,944],{"class":84}," {",[75,946,555],{"class":107},[75,948,124],{"class":84},[75,950,11],{"class":151},[75,952,124],{"class":84},[75,954,955],{"class":151},"get",[75,957,567],{"class":84},[75,959,92],{"class":84},[75,961,572],{"class":88},[75,963,92],{"class":84},[75,965,659],{"class":84},[75,967,968],{"class":84}," }\n",[75,970,971],{"class":77,"line":42},[75,972,102],{"emptyLinePlaceholder":101},[75,974,975,977,979,981,984,987],{"class":77,"line":542},[75,976,898],{"class":107},[75,978,124],{"class":84},[75,980,842],{"class":151},[75,982,983],{"class":84},"(status:",[75,985,986],{"class":80}," 503",[75,988,136],{"class":84},[75,990,991,993,995,997,999,1001,1003,1005,1007,1009,1011,1013,1015],{"class":77,"line":547},[75,992,931],{"class":151},[75,994,567],{"class":84},[75,996,165],{"class":114},[75,998,118],{"class":84},[75,1000,846],{"class":107},[75,1002,659],{"class":84},[75,1004,944],{"class":84},[75,1006,555],{"class":107},[75,1008,124],{"class":84},[75,1010,21],{"class":151},[75,1012,124],{"class":84},[75,1014,266],{"class":151},[75,1016,968],{"class":84},[75,1018,1019],{"class":77,"line":584},[75,1020,102],{"emptyLinePlaceholder":101},[75,1022,1023,1026,1028,1030,1032,1034,1036,1038,1040,1042,1044,1046,1048,1051],{"class":77,"line":615},[75,1024,1025],{"class":107},"  assert_in_delta ",[75,1027,271],{"class":80},[75,1029,186],{"class":84},[75,1031,555],{"class":107},[75,1033,124],{"class":84},[75,1035,21],{"class":151},[75,1037,124],{"class":84},[75,1039,266],{"class":151},[75,1041,602],{"class":84},[75,1043,92],{"class":84},[75,1045,266],{"class":88},[75,1047,92],{"class":84},[75,1049,1050],{"class":84},"]",[75,1052,1053],{"class":95}," # one-shot\n",[75,1055,1056],{"class":77,"line":620},[75,1057,789],{"class":479},[49,1059,1060,1061,1064,1065,1067,1068,1071,1072,1075,1076,1079,1080,1083,1084,1087,1088,1091,1092,1094,1095,1075,1097,1100,1101,1104,1105,1108,1109,1112,1113,1108,1116,1119],{},"The state itself produces the real error codes too: ",[52,1062,1063],{},"WARNING_LOW_BALANCE"," when the balance is short, ",[52,1066,910],{}," when ",[52,1069,1070],{},"reject"," matches the next number, ",[52,1073,1074],{},"UNDEFINED_COUNTRY"," \u002F ",[52,1077,1078],{},"ERROR_NO_SERVICE"," for unknown prices, ",[52,1081,1082],{},"ERROR_WRONG_TZID"," for an unknown or closed operation (",[52,1085,1086],{},"next"," too; ",[52,1089,1090],{},"ERROR_NO_TZID"," for tzid ",[52,1093,323],{},"), ",[52,1096,1074],{},[52,1098,1099],{},"UNDEFINED_DAYS"," for an unknown rent country or period, ",[52,1102,1103],{},"TRY_AGAIN_LATER"," for every refused ",[52,1106,1107],{},"rent.extend",", ",[52,1110,1111],{},"ERROR_NO_OPERATIONS"," for an unknown rent in ",[52,1114,1115],{},"rent.close",[52,1117,1118],{},"ERROR_WRONG_KEY"," for a wrong key (HTTP 456) or no key (HTTP 200).",[61,1121,1123],{"id":1122},"inspecting-requests","Inspecting requests",[49,1125,1126,1129,1130,1133,1134,1137,1138,1108,1141,1144,1145,1148,1149,1152],{},[52,1127,1128],{},"mock.requests"," lists every request received as ",[52,1131,1132],{},"{ method:, path:, query:, body: }",": ",[52,1135,1136],{},"path"," relative to ",[52,1139,1140],{},"\u002Fapi\u002F",[52,1142,1143],{},"query"," with String keys and values, ",[52,1146,1147],{},"body"," the parsed JSON of a POST (",[52,1150,1151],{},"nil"," for GET).",[66,1154,1156],{"className":68,"code":1155,"language":70,"meta":71,"style":71},"def test_sends_reject_as_a_comma_list\n  mock = OnlineSim::MockOnlineSim.new\n  mock.client.numbers.get(\"google\", 44, reject: %w[4470 4471])\n\n  assert_equal [{ method: \"GET\", path: \"getNum.php\",\n                  query: { \"service\" => \"google\", \"country\" => \"44\", \"reject\" => \"4470,4471\", \"lang\" => \"en\" },\n                  body: nil }], mock.requests\nend\n",[52,1157,1158,1165,1181,1224,1228,1260,1339,1357],{"__ignoreMap":71},[75,1159,1160,1162],{"class":77,"line":12},[75,1161,856],{"class":479},[75,1163,1164],{"class":151}," test_sends_reject_as_a_comma_list\n",[75,1166,1167,1169,1171,1173,1175,1177,1179],{"class":77,"line":17},[75,1168,864],{"class":107},[75,1170,111],{"class":84},[75,1172,115],{"class":114},[75,1174,118],{"class":84},[75,1176,121],{"class":114},[75,1178,124],{"class":84},[75,1180,382],{"class":80},[75,1182,1183,1185,1187,1189,1191,1193,1195,1197,1199,1201,1203,1205,1207,1209,1211,1214,1217,1220,1222],{"class":77,"line":22},[75,1184,898],{"class":107},[75,1186,124],{"class":84},[75,1188,152],{"class":151},[75,1190,124],{"class":84},[75,1192,11],{"class":151},[75,1194,124],{"class":84},[75,1196,955],{"class":151},[75,1198,567],{"class":84},[75,1200,92],{"class":84},[75,1202,572],{"class":88},[75,1204,92],{"class":84},[75,1206,186],{"class":84},[75,1208,579],{"class":80},[75,1210,186],{"class":84},[75,1212,1213],{"class":84}," reject:",[75,1215,1216],{"class":84}," %w[",[75,1218,1219],{"class":88},"4470 4471",[75,1221,1050],{"class":84},[75,1223,136],{"class":84},[75,1225,1226],{"class":77,"line":27},[75,1227,102],{"emptyLinePlaceholder":101},[75,1229,1230,1233,1236,1239,1241,1244,1246,1248,1251,1253,1255,1257],{"class":77,"line":32},[75,1231,1232],{"class":107},"  assert_equal ",[75,1234,1235],{"class":84},"[{",[75,1237,1238],{"class":84}," method:",[75,1240,85],{"class":84},[75,1242,1243],{"class":88},"GET",[75,1245,92],{"class":84},[75,1247,186],{"class":84},[75,1249,1250],{"class":84}," path:",[75,1252,85],{"class":84},[75,1254,922],{"class":88},[75,1256,92],{"class":84},[75,1258,1259],{"class":84},",\n",[75,1261,1262,1265,1267,1269,1272,1274,1277,1279,1281,1283,1285,1287,1290,1292,1294,1296,1299,1301,1303,1305,1307,1309,1311,1313,1316,1318,1320,1322,1325,1327,1329,1331,1334,1336],{"class":77,"line":37},[75,1263,1264],{"class":84},"                  query:",[75,1266,944],{"class":84},[75,1268,85],{"class":84},[75,1270,1271],{"class":88},"service",[75,1273,92],{"class":84},[75,1275,1276],{"class":84}," =>",[75,1278,85],{"class":84},[75,1280,572],{"class":88},[75,1282,92],{"class":84},[75,1284,186],{"class":84},[75,1286,85],{"class":84},[75,1288,1289],{"class":88},"country",[75,1291,92],{"class":84},[75,1293,1276],{"class":84},[75,1295,85],{"class":84},[75,1297,1298],{"class":88},"44",[75,1300,92],{"class":84},[75,1302,186],{"class":84},[75,1304,85],{"class":84},[75,1306,1070],{"class":88},[75,1308,92],{"class":84},[75,1310,1276],{"class":84},[75,1312,85],{"class":84},[75,1314,1315],{"class":88},"4470,4471",[75,1317,92],{"class":84},[75,1319,186],{"class":84},[75,1321,85],{"class":84},[75,1323,1324],{"class":88},"lang",[75,1326,92],{"class":84},[75,1328,1276],{"class":84},[75,1330,85],{"class":84},[75,1332,1333],{"class":88},"en",[75,1335,92],{"class":84},[75,1337,1338],{"class":84}," },\n",[75,1340,1341,1344,1347,1350,1352,1354],{"class":77,"line":42},[75,1342,1343],{"class":84},"                  body:",[75,1345,1346],{"class":84}," nil",[75,1348,1349],{"class":84}," }],",[75,1351,146],{"class":107},[75,1353,124],{"class":84},[75,1355,1356],{"class":151},"requests\n",[75,1358,1359],{"class":77,"line":542},[75,1360,789],{"class":479},[61,1362,1364],{"id":1363},"control-api","Control API",[215,1366,1367,1376],{},[218,1368,1369],{},[221,1370,1371,1374],{},[224,1372,1373],{},"Member",[224,1375,232],{},[234,1377,1378,1391,1403,1420,1448,1468,1480,1496,1520,1530],{},[221,1379,1380,1385],{},[239,1381,1382],{},[52,1383,1384],{},"client(**options)",[239,1386,1387,1388,1390],{},"A normal ",[52,1389,58],{}," wired to the mock.",[221,1392,1393,1397],{},[239,1394,1395],{},[52,1396,419],{},[239,1398,1399,1400,333],{},"The mock itself (it implements ",[52,1401,1402],{},"call(method, url, headers, body, timeout)",[221,1404,1405,1410],{},[239,1406,1407],{},[52,1408,1409],{},"add_sms(tzid, text, service: nil)",[239,1411,1412,1413,1415,1416,1419],{},"An SMS arrives now at a number operation or a rent (detected by ",[52,1414,639],{},"). Raises ",[52,1417,1418],{},"ArgumentError"," for an unknown or closed one.",[221,1421,1422,1427],{},[239,1423,1424],{},[52,1425,1426],{},"add_sms_after(tzid, text, polls, service: nil)",[239,1428,1429,1430,1433,1434,1436,1437,6,1440,1108,1443,6,1446,333],{},"The SMS arrives after ",[52,1431,1432],{},"polls"," state requests for ",[52,1435,639],{}," (",[52,1438,1439],{},"numbers.state",[52,1441,1442],{},"state_one",[52,1444,1445],{},"rent.state",[52,1447,1442],{},[221,1449,1450,1455],{},[239,1451,1452],{},[52,1453,1454],{},"fail_next(code, endpoint: nil)",[239,1456,1457,1458,1461,1462,1465,1466,124],{},"The next request (to ",[52,1459,1460],{},"endpoint"," only, e.g. ",[52,1463,1464],{},"\"getNum.php\"",") answers ",[52,1467,827],{},[221,1469,1470,1475],{},[239,1471,1472],{},[52,1473,1474],{},"fail_next_transport(status: 502, endpoint: nil)",[239,1476,1477,1478,124],{},"The next request fails with a non-JSON body and HTTP ",[52,1479,754],{},[221,1481,1482,1489],{},[239,1483,1484,1075,1487],{},[52,1485,1486],{},"set_balance(usd)",[52,1488,266],{},[239,1490,1491,1492,1495],{},"Set \u002F read the total balance, USD (it includes the part frozen by open operations and unconfirmed rents, as ",[52,1493,1494],{},"user.balance"," reports it).",[221,1497,1498,1505],{},[239,1499,1500,1075,1502],{},[52,1501,744],{},[52,1503,1504],{},"rents",[239,1506,1507,1508,1511,1512,1108,1514,1108,1516,1519],{},"Copies of the current number operations \u002F open rents (",[52,1509,1510],{},"Struct","s: ",[52,1513,639],{},[52,1515,754],{},[52,1517,1518],{},"messages",", …), for assertions.",[221,1521,1522,1527],{},[239,1523,1524],{},[52,1525,1526],{},"requests",[239,1528,1529],{},"Log of the requests received (a copy).",[221,1531,1532,1537],{},[239,1533,1534],{},[52,1535,1536],{},"reset",[239,1538,1539],{},"Back to the constructor's state.",[61,1541,1543],{"id":1542},"what-the-mock-does","What the mock does",[1545,1546,1547,1582,1647,1700,1709],"ul",{},[1548,1549,1550,1133,1553,1555,1556,1559,1560,1562,1563,1566,1567,1570,1571,1574,1575,1577,1578,1581],"li",{},[1551,1552,9],"strong",{},[52,1554,955],{}," freezes the price; ",[52,1557,1558],{},"close"," after an SMS spends it, ",[52,1561,1558],{}," without one refunds it; ",[52,1564,1565],{},"ban"," after an SMS answers ",[52,1568,1569],{},"\"0\"",", like the server. Numbers are ",[52,1572,1573],{},"+\u003Ccountry>9000000NN",", ids count from 1. ",[52,1576,1086],{}," switches to the following SMS. The operation's ",[52,1579,1580],{},"time"," stays at 1200 s — there is no clock.",[1548,1583,1584,1133,1586,1588,1589,1591,1592,1108,1594,1591,1597,1600,1601,1604,1605,1608,1609,1591,1611,1614,1615,1618,1619,1591,1621,1623,1624,1627,1628,1630,1631,1634,1635,6,1637,1639,1640,1643,1644,1646],{},[1551,1585,14],{},[52,1587,955],{}," reserves the price (",[52,1590,754],{}," ",[52,1593,323],{},[52,1595,1596],{},"checked",[52,1598,1599],{},"false",") and keeps the ",[52,1602,1603],{},"extension"," flag; the first SMS that is not ",[52,1606,1607],{},"notify"," confirms the rent (",[52,1610,754],{},[52,1612,1613],{},"1",") and charges it — ",[52,1616,1617],{},"add_sms(tzid, text, service: \"notify\")"," adds a notice with ",[52,1620,52],{},[52,1622,323],{}," that confirms nothing. ",[52,1625,1626],{},"extend"," works on a confirmed rent and charges at once. ",[52,1629,1558],{}," releases the reservation of an unconfirmed rent and gives no refund for a confirmed one. ",[52,1632,1633],{},"sum"," is a number in ",[52,1636,955],{},[52,1638,1626],{}," and a decimal string on the wire of ",[52,1641,1642],{},"state",", like the server. SMS appear in ",[52,1645,1518],{},", newest first.",[1548,1648,1649,1133,1651,1653,1654,1657,1658,1661,1662,1665,1666,1669,1670,1674,1675,1678,1679,1591,1681,1684,1685,1687,1688,1691,1692,1695,1696,1699],{},[1551,1650,19],{},[52,1652,266],{}," (frozen part included), a fixed profile, ",[52,1655,1656],{},"set_webhook_url"," accepts any ",[52,1659,1660],{},"scheme:\u002F\u002F…"," URL (",[52,1663,1664],{},"VALIDATION_ERROR"," otherwise), ",[52,1667,1668],{},"webhook_logs"," lists the deliveries the mock ",[1671,1672,1673],"em",{},"recorded"," when an SMS arrived while a webhook URL was set — it makes no HTTP call; their ",[52,1676,1677],{},"params"," follow the real payload (",[52,1680,52],{},[52,1682,1683],{},"\"\""," without a code, rent ",[52,1686,607],{}," in digits without ",[52,1689,1690],{},"+",", rent ",[52,1693,1694],{},"time_left"," in minutes). ",[52,1697,1698],{},"payment_history"," has no orders.",[1548,1701,1702,1133,1705,1708],{},[1551,1703,1704],{},"Free",[52,1706,1707],{},"free.list"," returns two fixed countries (44 first) with one number and a few SMS each.",[1548,1710,1711,1712,1436,1715,1718,1719,1721,1722,1725],{},"Not imitated: anything that needs real time — the 5 s lock after ",[52,1713,1714],{},"setOperationOk",[52,1716,1717],{},"INTERVAL_CONCURRENT_REQUESTS_ERROR","), the 10 s lock of ",[52,1720,1107],{},", the 120 s before an unconfirmed rent may be closed and its 20-minute wait for the first SMS. ",[52,1723,1724],{},"guard_interval > 0"," stands in for \"too early to close\".",[1727,1728,1729],"style",{},"html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}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 .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":71,"searchDepth":17,"depth":17,"links":1731},[1732,1733,1734,1735,1736,1737],{"id":63,"depth":17,"text":64},{"id":424,"depth":17,"text":425},{"id":817,"depth":17,"text":818},{"id":1122,"depth":17,"text":1123},{"id":1363,"depth":17,"text":1364},{"id":1542,"depth":17,"text":1543},"Test your integration offline with MockOnlineSim — no network, key or money.","md",{},{"order":37},{"title":34,"description":1738},"pX1Drs1JOvhTxzVck_jhhQ3V3fl5Qd-uzMOFPTHJnZ0",[1745,1747],{"title":14,"path":15,"stem":16,"description":1746,"order":17},"Rent a number for days and receive every SMS sent to it — client.rent.",{"title":19,"path":20,"stem":21,"description":1748,"order":22},"Balance, profile, payments and the webhook URL — client.user.",1795163990846]