onlinesim 1.0.12 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -0
- data/README.md +30 -18
- data/lib/onlinesim/client.rb +119 -0
- data/lib/onlinesim/errors.rb +67 -0
- data/lib/onlinesim/free.rb +17 -0
- data/lib/onlinesim/mock/handlers.rb +359 -0
- data/lib/onlinesim/mock/state.rb +163 -0
- data/lib/onlinesim/mock.rb +137 -0
- data/lib/onlinesim/normalize.rb +26 -0
- data/lib/onlinesim/numbers.rb +85 -0
- data/lib/onlinesim/rent.rb +69 -0
- data/lib/onlinesim/transport.rb +32 -0
- data/lib/onlinesim/user.rb +48 -0
- data/lib/onlinesim/version.rb +4 -2
- data/lib/onlinesim/wait.rb +38 -0
- data/lib/onlinesim/webhook.rb +45 -0
- data/lib/onlinesim.rb +17 -38
- metadata +28 -87
- data/.gitignore +0 -9
- data/.travis.yml +0 -7
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -44
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/onlinesim/GetForward.rb +0 -41
- data/lib/onlinesim/GetFree.rb +0 -17
- data/lib/onlinesim/GetNumbers.rb +0 -90
- data/lib/onlinesim/GetProxy.rb +0 -29
- data/lib/onlinesim/GetRent.rb +0 -33
- data/lib/onlinesim/GetUser.rb +0 -13
- data/lib/onlinesim/base.rb +0 -66
- data/lib/onlinesim/cli.rb +0 -7
- data/lib/onlinesim/error.rb +0 -12
- data/onlinesim.gemspec +0 -25
- data/tester.rb +0 -18
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnlineSim
|
|
4
|
+
# Client-side normalisation of server quirks, shared by the sections and `parse_webhook`.
|
|
5
|
+
module Normalize
|
|
6
|
+
module_function
|
|
7
|
+
|
|
8
|
+
# PHP sends an empty map as `[]`: return `{}` for it (and for anything that is not a Hash).
|
|
9
|
+
def map(value)
|
|
10
|
+
value.is_a?(Hash) ? value : {}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Number from a number or a numeric string ("1442.330"); nil when missing or not numeric.
|
|
14
|
+
def num(value)
|
|
15
|
+
case value
|
|
16
|
+
when Integer then value
|
|
17
|
+
when Float then value.finite? ? value : nil
|
|
18
|
+
when String
|
|
19
|
+
text = value.strip
|
|
20
|
+
return nil if text.empty?
|
|
21
|
+
|
|
22
|
+
Integer(text, exception: false) || Float(text, exception: false)&.then { |f| f.finite? ? f : nil }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnlineSim
|
|
4
|
+
# Numbers for receiving SMS: `client.numbers`. Results are Hashes with the server's (string) keys.
|
|
5
|
+
class Numbers
|
|
6
|
+
def initialize(request)
|
|
7
|
+
@request = request
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Price (USD) of one number of `service` in `country`; nil when the country has no price for it.
|
|
11
|
+
def price(service, country = 7)
|
|
12
|
+
@request.call("getPrice.php", query: { service: service, country: country })["price"]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Order a number. Returns the operation id (tzid).
|
|
16
|
+
def get(service, country = 7, reject: nil)
|
|
17
|
+
@request.call("getNum.php", query: { service: service, country: country, reject: reject })["tzid"]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Order a number and get it right away: {"tzid", "number", "country", "time", "service", ...}.
|
|
21
|
+
def get_with_number(service, country = 7, reject: nil)
|
|
22
|
+
# `number` is a presence flag on getNum: sent here only.
|
|
23
|
+
@request.call("getNum.php", query: { service: service, country: country, reject: reject, number: 1 })
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# All operations of the account; [] when there are none.
|
|
27
|
+
def state(message_to_code: true, order_by: "asc", msg_list: false)
|
|
28
|
+
@request.call("getState.php", query: {
|
|
29
|
+
message_to_code: message_to_code, orderby: order_by, msg_list: msg_list, number: 1
|
|
30
|
+
})
|
|
31
|
+
rescue ApiError => e
|
|
32
|
+
raise unless e.code == "ERROR_NO_OPERATIONS"
|
|
33
|
+
|
|
34
|
+
[]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# One operation. Raises ApiError ERROR_NO_OPERATIONS when it does not exist (any more).
|
|
38
|
+
def state_one(tzid, message_to_code: true, msg_list: false)
|
|
39
|
+
list = @request.call("getState.php", query: {
|
|
40
|
+
tzid: tzid, message_to_code: message_to_code, msg_list: msg_list, number: 1
|
|
41
|
+
})
|
|
42
|
+
list.first || raise(ApiError, "ERROR_NO_OPERATIONS")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Switch the operation to its next SMS and keep it open.
|
|
46
|
+
def next(tzid)
|
|
47
|
+
@request.call("setOperationRevise.php", query: { tzid: tzid })
|
|
48
|
+
true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Finish the operation.
|
|
52
|
+
def close(tzid)
|
|
53
|
+
@request.call("setOperationOk.php", query: { tzid: tzid })
|
|
54
|
+
true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Finish the operation and report the number as bad (only before any SMS arrived).
|
|
58
|
+
def ban(tzid)
|
|
59
|
+
@request.call("setOperationOk.php", query: { tzid: tzid, ban: true })
|
|
60
|
+
true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Services, prices and stock of every country, keyed by country code. No key needed.
|
|
64
|
+
def tariffs
|
|
65
|
+
Normalize.map(@request.call("getNumbersStats.php", query: { country: "all" }))
|
|
66
|
+
.transform_values { |c| country(c) }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Services, prices and stock of one country. No key needed.
|
|
70
|
+
def tariffs_one(code = 7)
|
|
71
|
+
country(@request.call("getNumbersStats.php", query: { country: code }))
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Poll the operation until an SMS code arrives, then close it (or `next` with keep_open). See OnlineSim.wait_code.
|
|
75
|
+
def wait_code(tzid, **options)
|
|
76
|
+
OnlineSim.wait_code(self, tzid, **options)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
def country(stat)
|
|
82
|
+
stat.merge("services" => Normalize.map(stat["services"]))
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnlineSim
|
|
4
|
+
# Rented numbers: `client.rent`.
|
|
5
|
+
class Rent
|
|
6
|
+
# Always sent: flat `messages` list and `time_seconds`.
|
|
7
|
+
DETAIL = { pagination: 0, number: 1 }.freeze
|
|
8
|
+
|
|
9
|
+
def initialize(request)
|
|
10
|
+
@request = request
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Rent a number for `days` days. `extension: false` makes the rent non-extendable for good.
|
|
14
|
+
def get(country = 7, days = 1, extension: true)
|
|
15
|
+
res = @request.call("rent/getRentNum.php", query: { country: country, days: days, extension: extension, **DETAIL })
|
|
16
|
+
item(res["item"])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# All rents of the account.
|
|
20
|
+
def state
|
|
21
|
+
@request.call("rent/getRentState.php", query: DETAIL)["list"].map { |raw| item(raw) }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# One rent. Raises ApiError ERROR_NO_OPERATIONS when it does not exist.
|
|
25
|
+
def state_one(tzid)
|
|
26
|
+
raw = @request.call("rent/getRentState.php", query: { tzid: tzid, **DETAIL })["list"].first
|
|
27
|
+
raise ApiError, "ERROR_NO_OPERATIONS" unless raw
|
|
28
|
+
|
|
29
|
+
item(raw)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Extend a rent by `days` days (only rents created with `extension: true`).
|
|
33
|
+
# Overrides Object#extend on this section object on purpose: the name is the API's.
|
|
34
|
+
def extend(tzid, days = 1)
|
|
35
|
+
item(@request.call("rent/extendRentState.php", query: { tzid: tzid, days: days, **DETAIL })["item"])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Rent prices of every country, keyed by country code. No key needed.
|
|
39
|
+
def tariffs
|
|
40
|
+
Normalize.map(@request.call("rent/tariffsRent.php"))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Rent prices of one country. Raises ApiError NO_COUNTRY for a country without rent. No key needed.
|
|
44
|
+
def tariffs_one(country = 7)
|
|
45
|
+
res = @request.call("rent/tariffsRent.php", query: { country: country })
|
|
46
|
+
# An unknown country answers `[]`.
|
|
47
|
+
raise ApiError, "NO_COUNTRY" unless res.is_a?(Hash) && res.key?("code")
|
|
48
|
+
|
|
49
|
+
res
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Return the number before the rent period ends.
|
|
53
|
+
def close(tzid)
|
|
54
|
+
@request.call("rent/closeRentNum.php", query: { tzid: tzid })
|
|
55
|
+
true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
# `sum` is a decimal string, `extend` may be `[]`.
|
|
61
|
+
def item(raw)
|
|
62
|
+
raw.merge(
|
|
63
|
+
"sum" => (Normalize.num(raw["sum"]) || 0).to_f,
|
|
64
|
+
"extend" => Normalize.map(raw["extend"]),
|
|
65
|
+
"messages" => raw["messages"].is_a?(Array) ? raw["messages"] : []
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "uri"
|
|
5
|
+
|
|
6
|
+
module OnlineSim
|
|
7
|
+
# Default transport on stdlib Net::HTTP. Any object with the same `call` works (a fake in tests, a proxy setup).
|
|
8
|
+
#
|
|
9
|
+
# `call(method, url, headers, body, timeout)` returns `[status, body_string]` and raises on network errors
|
|
10
|
+
# (`Timeout::Error` for a timeout). `timeout` (seconds) applies to connect, read and write separately.
|
|
11
|
+
class NetHttpTransport
|
|
12
|
+
# `start_options` go to `Net::HTTP.start`, e.g. `ca_file:`, `cert:`, `key:`. TLS is verified by default.
|
|
13
|
+
def initialize(**start_options)
|
|
14
|
+
@start_options = start_options
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def call(method, url, headers, body, timeout)
|
|
18
|
+
uri = URI(url)
|
|
19
|
+
options = {
|
|
20
|
+
use_ssl: uri.scheme == "https",
|
|
21
|
+
open_timeout: timeout, read_timeout: timeout, write_timeout: timeout
|
|
22
|
+
}.merge(@start_options)
|
|
23
|
+
# Proxy from the environment (http_proxy / https_proxy / no_proxy), as Net::HTTP does by default.
|
|
24
|
+
Net::HTTP.start(uri.host, uri.port, options) do |http|
|
|
25
|
+
request = (method == "POST" ? Net::HTTP::Post : Net::HTTP::Get).new(uri, headers)
|
|
26
|
+
request.body = body if body
|
|
27
|
+
response = http.request(request)
|
|
28
|
+
[response.code.to_i, String.new(response.body.to_s, encoding: Encoding::UTF_8)]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnlineSim
|
|
4
|
+
# Account: `client.user`.
|
|
5
|
+
class User
|
|
6
|
+
def initialize(request)
|
|
7
|
+
@request = request
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Balance in USD: {"balance" => Float, "zbalance" => Float, "income" => Float (when sent)}.
|
|
11
|
+
# `balance` includes the frozen `zbalance`: available = balance - zbalance.
|
|
12
|
+
def balance
|
|
13
|
+
res = @request.call("getBalance.php", query: { income: 1 })
|
|
14
|
+
out = { "balance" => (Normalize.num(res["balance"]) || 0).to_f, "zbalance" => (Normalize.num(res["zbalance"]) || 0).to_f }
|
|
15
|
+
income = Normalize.num(res["income"])
|
|
16
|
+
out["income"] = income.to_f unless income.nil?
|
|
17
|
+
out
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Account profile.
|
|
21
|
+
def profile
|
|
22
|
+
@request.call("getProfile.php")["profile"]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Top-up orders (paginated, newest first) and the available payment methods.
|
|
26
|
+
def payment_history(page = 1)
|
|
27
|
+
res = @request.call("getPaymentHistory.php", query: { page: page })
|
|
28
|
+
res.merge("paylist" => Normalize.map(res["paylist"]))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Set the URL that receives SMS webhooks. Raises ApiError VALIDATION_ERROR for an invalid URL.
|
|
32
|
+
def set_webhook_url(url) # rubocop:disable Naming/AccessorMethodName -- API method name
|
|
33
|
+
@request.call("profile.php", body: { profile: { webhook_url: url } })
|
|
34
|
+
true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Remove the webhook URL (also from operations in progress).
|
|
38
|
+
def clear_webhook_url
|
|
39
|
+
@request.call("profile.php", body: { profile: { webhook_url: nil } })
|
|
40
|
+
true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Webhook delivery log, newest first, 10 per page (a Laravel paginator Hash).
|
|
44
|
+
def webhook_logs(page = 1)
|
|
45
|
+
@request.call("webhook-logs", query: { page: page })["data"]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/onlinesim/version.rb
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Ruby client for the OnlineSim API. Entry point: OnlineSim::Client.
|
|
4
|
+
module OnlineSim
|
|
5
|
+
MONOTONIC = -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }
|
|
6
|
+
private_constant :MONOTONIC
|
|
7
|
+
|
|
8
|
+
# Poll `numbers.state_one(tzid)` every `interval` seconds until a code different from `since` arrives, then
|
|
9
|
+
# `close` (or `next` with `keep_open`) and return it. A finished operation (TZ_OVER_OK, ERROR_NO_ITEMS) without a
|
|
10
|
+
# new code raises ApiError with that state as the code; running out of `timeout` seconds raises TimeoutError.
|
|
11
|
+
# TransportError is retried until the timeout; any ApiError is raised at once.
|
|
12
|
+
# `sleep` (seconds -> any) and `now` (-> seconds) are injectable for tests.
|
|
13
|
+
def self.wait_code(numbers, tzid, interval: 5, timeout: 600, keep_open: false, full_message: false, since: nil,
|
|
14
|
+
sleep: Kernel.method(:sleep), now: MONOTONIC)
|
|
15
|
+
deadline = now.call + timeout
|
|
16
|
+
loop do
|
|
17
|
+
op = begin
|
|
18
|
+
numbers.state_one(tzid, message_to_code: !full_message)
|
|
19
|
+
rescue TransportError
|
|
20
|
+
nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if op
|
|
24
|
+
msg = op["msg"]
|
|
25
|
+
if msg.is_a?(String) && !msg.empty? && msg != since
|
|
26
|
+
keep_open ? numbers.next(tzid) : numbers.close(tzid)
|
|
27
|
+
return msg
|
|
28
|
+
end
|
|
29
|
+
raise ApiError, op["response"] if %w[TZ_OVER_OK ERROR_NO_ITEMS].include?(op["response"])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
left = deadline - now.call
|
|
33
|
+
raise TimeoutError, "No code for operation #{tzid} within #{timeout} s" if left <= 0
|
|
34
|
+
|
|
35
|
+
sleep.call([interval, left].min)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
# Ruby client for the OnlineSim API. Entry point: OnlineSim::Client.
|
|
6
|
+
module OnlineSim
|
|
7
|
+
WEBHOOK_TYPES = %w[receiving_sms rent_sms].freeze
|
|
8
|
+
|
|
9
|
+
# Parse an inbound webhook body (`receiving_sms` or `rent_sms`) from a JSON string or an already parsed Hash.
|
|
10
|
+
# Lenient: numeric fields may arrive as strings, missing or malformed fields become nil, unknown fields are dropped.
|
|
11
|
+
# Raises OnlineSim::Error only when the input is not a JSON object at all.
|
|
12
|
+
def self.parse_webhook(payload)
|
|
13
|
+
data = payload
|
|
14
|
+
if payload.is_a?(String)
|
|
15
|
+
begin
|
|
16
|
+
data = JSON.parse(payload)
|
|
17
|
+
rescue JSON::ParserError
|
|
18
|
+
raise Error, "Webhook payload is not valid JSON"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
raise Error, "Webhook payload is not a JSON object" unless data.is_a?(Hash)
|
|
22
|
+
|
|
23
|
+
data = data.transform_keys(&:to_s)
|
|
24
|
+
{
|
|
25
|
+
"webhook_type" => WEBHOOK_TYPES.include?(data["webhook_type"]) ? data["webhook_type"] : nil,
|
|
26
|
+
"operation_id" => Normalize.num(data["operation_id"]),
|
|
27
|
+
"user_id" => Normalize.num(data["user_id"]),
|
|
28
|
+
"country_code" => Normalize.num(data["country_code"]),
|
|
29
|
+
"number" => webhook_str(data["number"]),
|
|
30
|
+
"sender" => webhook_str(data["sender"]),
|
|
31
|
+
"message" => webhook_str(data["message"]),
|
|
32
|
+
"code" => webhook_str(data["code"]),
|
|
33
|
+
"time_start" => webhook_str(data["time_start"]),
|
|
34
|
+
"time_left" => Normalize.num(data["time_left"])
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.webhook_str(value)
|
|
39
|
+
case value
|
|
40
|
+
when String then value
|
|
41
|
+
when Numeric then value.to_s
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
private_class_method :webhook_str
|
|
45
|
+
end
|
data/lib/onlinesim.rb
CHANGED
|
@@ -1,40 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
require 'onlinesim/GetForward'
|
|
3
|
-
require 'onlinesim/GetNumbers'
|
|
4
|
-
require 'onlinesim/GetProxy'
|
|
5
|
-
require 'onlinesim/GetRent'
|
|
6
|
-
require 'onlinesim/GetUser'
|
|
1
|
+
# frozen_string_literal: true
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def forward
|
|
21
|
-
OnlineSim::GetForward.new(:apikey => @apikey, :lang => @lang, :dev_id => @dev_id)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def free
|
|
25
|
-
OnlineSim::GetFree.new(:apikey => @apikey, :lang => @lang, :dev_id => @dev_id)
|
|
26
|
-
end
|
|
3
|
+
require_relative "onlinesim/version"
|
|
4
|
+
require_relative "onlinesim/errors"
|
|
5
|
+
require_relative "onlinesim/normalize"
|
|
6
|
+
require_relative "onlinesim/transport"
|
|
7
|
+
require_relative "onlinesim/numbers"
|
|
8
|
+
require_relative "onlinesim/rent"
|
|
9
|
+
require_relative "onlinesim/user"
|
|
10
|
+
require_relative "onlinesim/free"
|
|
11
|
+
require_relative "onlinesim/wait"
|
|
12
|
+
require_relative "onlinesim/webhook"
|
|
13
|
+
require_relative "onlinesim/client"
|
|
27
14
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
OnlineSim::GetRent.new(:apikey => @apikey, :lang => @lang, :dev_id => @dev_id)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def user
|
|
37
|
-
OnlineSim::GetUser.new(:apikey => @apikey, :lang => @lang, :dev_id => @dev_id)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
15
|
+
# Ruby client for the OnlineSim API. Entry point: OnlineSim::Client.
|
|
16
|
+
module OnlineSim
|
|
17
|
+
# Offline fake of the API for tests (lib/onlinesim/mock.rb). Loaded on first use, so it costs nothing otherwise.
|
|
18
|
+
autoload :MockOnlineSim, File.expand_path("onlinesim/mock", __dir__)
|
|
19
|
+
end
|
metadata
CHANGED
|
@@ -1,107 +1,49 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onlinesim
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- s00d
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.0'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: oj
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '3.10'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '3.10'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: thor
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :runtime
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: bundler
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: 2.2.27
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: 2.2.27
|
|
69
|
-
description:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Zero-dependency Ruby client for the OnlineSim API (Net::HTTP + JSON from
|
|
13
|
+
the standard library).
|
|
70
14
|
email:
|
|
71
15
|
- support@onlinesim.ru
|
|
72
16
|
executables: []
|
|
73
17
|
extensions: []
|
|
74
18
|
extra_rdoc_files: []
|
|
75
19
|
files:
|
|
76
|
-
- ".gitignore"
|
|
77
|
-
- ".travis.yml"
|
|
78
20
|
- CHANGELOG.md
|
|
79
|
-
- CODE_OF_CONDUCT.md
|
|
80
|
-
- Gemfile
|
|
81
|
-
- Gemfile.lock
|
|
82
21
|
- LICENSE
|
|
83
22
|
- README.md
|
|
84
|
-
- Rakefile
|
|
85
|
-
- bin/console
|
|
86
|
-
- bin/setup
|
|
87
23
|
- lib/onlinesim.rb
|
|
88
|
-
- lib/onlinesim/
|
|
89
|
-
- lib/onlinesim/
|
|
90
|
-
- lib/onlinesim/
|
|
91
|
-
- lib/onlinesim/
|
|
92
|
-
- lib/onlinesim/
|
|
93
|
-
- lib/onlinesim/
|
|
94
|
-
- lib/onlinesim/
|
|
95
|
-
- lib/onlinesim/
|
|
96
|
-
- lib/onlinesim/
|
|
24
|
+
- lib/onlinesim/client.rb
|
|
25
|
+
- lib/onlinesim/errors.rb
|
|
26
|
+
- lib/onlinesim/free.rb
|
|
27
|
+
- lib/onlinesim/mock.rb
|
|
28
|
+
- lib/onlinesim/mock/handlers.rb
|
|
29
|
+
- lib/onlinesim/mock/state.rb
|
|
30
|
+
- lib/onlinesim/normalize.rb
|
|
31
|
+
- lib/onlinesim/numbers.rb
|
|
32
|
+
- lib/onlinesim/rent.rb
|
|
33
|
+
- lib/onlinesim/transport.rb
|
|
34
|
+
- lib/onlinesim/user.rb
|
|
97
35
|
- lib/onlinesim/version.rb
|
|
98
|
-
- onlinesim.
|
|
99
|
-
-
|
|
36
|
+
- lib/onlinesim/wait.rb
|
|
37
|
+
- lib/onlinesim/webhook.rb
|
|
100
38
|
homepage: https://github.com/s00d/onlinesim-ruby-api
|
|
101
39
|
licenses:
|
|
102
|
-
-
|
|
103
|
-
metadata:
|
|
104
|
-
|
|
40
|
+
- Apache-2.0
|
|
41
|
+
metadata:
|
|
42
|
+
source_code_uri: https://github.com/s00d/onlinesim-ruby-api/tree/2.1.0
|
|
43
|
+
documentation_uri: https://s00d.github.io/onlinesim-ruby-api/
|
|
44
|
+
changelog_uri: https://github.com/s00d/onlinesim-ruby-api/blob/master/CHANGELOG.md
|
|
45
|
+
bug_tracker_uri: https://github.com/s00d/onlinesim-ruby-api/issues
|
|
46
|
+
rubygems_mfa_required: 'true'
|
|
105
47
|
rdoc_options: []
|
|
106
48
|
require_paths:
|
|
107
49
|
- lib
|
|
@@ -109,15 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
109
51
|
requirements:
|
|
110
52
|
- - ">="
|
|
111
53
|
- !ruby/object:Gem::Version
|
|
112
|
-
version: '0'
|
|
54
|
+
version: '3.0'
|
|
113
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
56
|
requirements:
|
|
115
57
|
- - ">="
|
|
116
58
|
- !ruby/object:Gem::Version
|
|
117
59
|
version: '0'
|
|
118
60
|
requirements: []
|
|
119
|
-
rubygems_version:
|
|
120
|
-
signing_key:
|
|
61
|
+
rubygems_version: 4.0.20
|
|
121
62
|
specification_version: 4
|
|
122
|
-
summary:
|
|
63
|
+
summary: 'Ruby client for the OnlineSim API: SMS numbers, rent, account and free numbers.'
|
|
123
64
|
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
-
orientation.
|
|
11
|
-
|
|
12
|
-
## Our Standards
|
|
13
|
-
|
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
|
15
|
-
include:
|
|
16
|
-
|
|
17
|
-
* Using welcoming and inclusive language
|
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
|
19
|
-
* Gracefully accepting constructive criticism
|
|
20
|
-
* Focusing on what is best for the community
|
|
21
|
-
* Showing empathy towards other community members
|
|
22
|
-
|
|
23
|
-
Examples of unacceptable behavior by participants include:
|
|
24
|
-
|
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
-
advances
|
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
-
* Public or private harassment
|
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
|
30
|
-
address, without explicit permission
|
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
-
professional setting
|
|
33
|
-
|
|
34
|
-
## Our Responsibilities
|
|
35
|
-
|
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
-
response to any instances of unacceptable behavior.
|
|
39
|
-
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
-
threatening, offensive, or harmful.
|
|
45
|
-
|
|
46
|
-
## Scope
|
|
47
|
-
|
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
-
when an individual is representing the project or its community. Examples of
|
|
50
|
-
representing a project or community include using an official project e-mail
|
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
|
53
|
-
further defined and clarified by project maintainers.
|
|
54
|
-
|
|
55
|
-
## Enforcement
|
|
56
|
-
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at Virus191288@gmail.com. All
|
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
|
63
|
-
|
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
-
members of the project's leadership.
|
|
67
|
-
|
|
68
|
-
## Attribution
|
|
69
|
-
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
-
|
|
73
|
-
[homepage]: http://contributor-covenant.org
|
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|