ince-api 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c33e9c72831380c569c0e436ae521c60de13029b4032079e0e0c3e9c8073415
4
- data.tar.gz: 3152ab4dc73f308f714ec6b746da821d394fe7e29e24735fabee507048d0ac45
3
+ metadata.gz: 296b84cce1213106b1291e9db2313cc7002ef5c6b67a01d3b664e6933384a4c3
4
+ data.tar.gz: 3e1334fafc82cbfbedfcf8e584e6328124051d6a525584626b64f0113f2bf50f
5
5
  SHA512:
6
- metadata.gz: 201ae637e96c1d988cea0aabcf58401ef87517d8f415ffb64e9cab72d9a8f3a42627709c63aad9df1b11028a15c722ca9e95e65b0709d5bb1242d8b5caa092d5
7
- data.tar.gz: 2a8b92921848c087e45c3af210f0d2b03a3479f0d487ae70da7008245af81c1cca4534e32b75930ac37532112091b4c9a54f62c362b27fc704ad1efcbb2ab285
6
+ metadata.gz: fd2b4e8cf09960cf08f6b01b02fe4aeb928d1d7472ca23f78f8d99fee8d10e3e91b429f7dcc7f617ef1f9941d76e8e194120512a8583a6f79790f86657f6e8b2
7
+ data.tar.gz: 55afc4f0f0866d4b999823f0a57d80e06f43847fde6c86d02b9c37c9c95a8f63274c5394e7b3aeeca62a27650ec71ade32ce8762bcd6f917d4e801167e6e44c0
data/Gemfile.lock CHANGED
@@ -1,27 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ince-api (0.1.2)
4
+ ince-api (0.2.0)
5
5
  base64 (~> 0.1)
6
6
  net-http (~> 0.2)
7
7
  openssl
8
- uri (~> 0.11)
8
+ uri (~> 0.13)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  addressable (2.8.0)
14
14
  public_suffix (>= 2.0.2, < 5.0)
15
- base64 (0.1.1)
15
+ base64 (0.2.0)
16
16
  coderay (1.1.3)
17
17
  crack (0.4.5)
18
18
  rexml
19
19
  diff-lcs (1.4.4)
20
20
  hashdiff (1.0.1)
21
21
  method_source (1.0.0)
22
- net-http (0.2.2)
22
+ net-http (0.4.1)
23
23
  uri
24
- openssl (3.0.0)
24
+ openssl (3.2.0)
25
25
  pry (0.14.1)
26
26
  coderay (~> 1.1)
27
27
  method_source (~> 1.0)
@@ -40,7 +40,7 @@ GEM
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
41
  rspec-support (~> 3.10.0)
42
42
  rspec-support (3.10.3)
43
- uri (0.11.0)
43
+ uri (0.13.0)
44
44
  vcr (6.0.0)
45
45
  webmock (3.14.0)
46
46
  addressable (>= 2.8.0)
data/ince-api.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ince-api'
3
- s.version = '0.2.0'
3
+ s.version = '0.3.0'
4
4
  s.summary = "1nce API wrapper"
5
5
  s.description = "A simple wrapper for 1nce API"
6
6
  s.authors = ["Stanislaw Zawadzki"]
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
13
13
  s.require_paths = ['lib']
14
14
  s.license = 'MIT'
15
- s.add_dependency 'uri', '~> 0.11'
15
+ s.add_dependency 'uri', '~> 0.13'
16
16
  s.add_dependency 'net-http', '~> 0.2'
17
17
  s.add_dependency 'openssl'
18
18
  s.add_dependency 'base64', '~> 0.1'
data/lib/ince-api.rb CHANGED
@@ -14,3 +14,4 @@ require_relative 'ince_api/single_sim_configuration'
14
14
  require_relative 'ince_api/multiple_sims_configuration'
15
15
  require_relative 'ince_api/create_sms'
16
16
  require_relative 'ince_api/reset_connectivity'
17
+ require_relative 'ince_api/get_sim_connectivity'
@@ -0,0 +1,36 @@
1
+ module InceApi
2
+ class GetSimConnectivity
3
+ def initialize(access_token:, iccid:)
4
+ @access_token = access_token
5
+ @iccid = iccid
6
+ end
7
+
8
+ def sim
9
+ response = connection.request(request)
10
+ if response.body != ''
11
+ JSON.parse(response.body)
12
+ else
13
+ {'status_code' => 404, 'error_message' => 'SIM with ICCID not found'}
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def url
20
+ @url ||= URI("https://api.1nce.com/management-api/v1/sims/#{@iccid}/connectivity_info")
21
+ end
22
+
23
+ def connection
24
+ @connection ||= Net::HTTP.new(url.host, url.port).tap do |http|
25
+ http.use_ssl = true
26
+ end
27
+ end
28
+
29
+ def request
30
+ Net::HTTP::Get.new(url).tap do |request|
31
+ request["Accept"] = 'application/json'
32
+ request['Authorization'] = "Bearer #{@access_token}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,75 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.1nce.com/management-api/v1/sims/123456789/connectivity_info
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/json
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api.1nce.com
18
+ Authorization:
19
+ - Bearer eyJpZHRva2VuIjoiZXlKcmFXUWlPaUpVWlVkeWVqbExkbEJRWTNKYVdURXljRXBWUXpod2NYVjRVbnAxSzAxRU1HdENlRzh6Ukc1bFlXTkJQU0lzSW1Gc1p5STZJbEpUTWpVMkluMC5leUp6ZFdJaU9pSXdNR0kxTmpFeU5TMDBaVEE0TFRSaVlqQXRPV1ppTmkxa05qZzRZVGd3TkRCaVkyTWlMQ0pqYjJkdWFYUnZPbWR5YjNWd2N5STZXeUpCY0draVhTd2lhWE56SWpvaWFIUjBjSE02WEM5Y0wyTnZaMjVwZEc4dGFXUndMbVYxTFdObGJuUnlZV3d0TVM1aGJXRjZiMjVoZDNNdVkyOXRYQzlsZFMxalpXNTBjbUZzTFRGZlluTXdhbkJPTTFobElpd2lZMjluYm1sMGJ6cDFjMlZ5Ym1GdFpTSTZJalV5TnpNeU56RTFPRFFpTENKd2NtVm1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m05Q21xbzFBMkcyTW9qakliRFRHcDh6ZHdMY2wzVjgxMFUwOVctWnQ3bC1DQ3FmSmJ2eFVCY0NOa3gyeVNQZ3dwLVJkM3ozQUVkaDZTbjRzR0I5WTFHMTAwb3g0S0dpdko4MzNFNUppU1VpVzZvaGl6XzlTQWNvLWtONDFxcF9VQS0xOVFRTkxZT3ZfaEZ6MHNlVExGRGtHemJkMnl6WWRuVmUzMXp2UkdreWtnR1lsNTdQZGZLTXNaWUloMkw4Q1o5MVJIakVJdXJJcmQ4X1JDQnEwYzZ4Um5IN21qVHhZWGFCbndGTVVHamsya0s3Um45VXY1eDU4eC1PWUZUTWVKNTBWZUdQTy1OcGdseHB4cGYwdDh2TmJ3In0=
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - application/json;charset=UTF-8
27
+ Content-Length:
28
+ - '292'
29
+ Connection:
30
+ - keep-alive
31
+ Date:
32
+ - Tue, 04 Jul 2023 12:46:10 GMT
33
+ X-Amzn-Requestid:
34
+ - 9f5d6074-a3cc-4d7d-93be-c4814ffc8e05
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ Strict-Transport-Security:
38
+ - max-age=31536000
39
+ X-Frame-Options:
40
+ - DENY
41
+ X-Amzn-Remapped-Content-Length:
42
+ - '292'
43
+ X-Amzn-Remapped-Connection:
44
+ - close
45
+ Set-Cookie:
46
+ - "!Proxy!ApiProxyServletJSESSIONID=RcKGWejfo61X682ErxKDwcGSmfMaLxxGax1CwW6L.ioprod-jboss2-jboss1;
47
+ Path=/global-api"
48
+ - SERVERID=csc1; path=/; Secure
49
+ X-Amz-Apigw-Id:
50
+ - Higm8F2BFiAFrsA=
51
+ Cache-Control:
52
+ - no-cache, no-store, max-age=0, must-revalidate
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ Expires:
56
+ - '0'
57
+ X-Amzn-Trace-Id:
58
+ - Root=1-64a41492-49d6ec4c1822b00876401434
59
+ Pragma:
60
+ - no-cache
61
+ X-Amzn-Remapped-Date:
62
+ - Tue, 04 Jul 2023 12:46:10 GMT
63
+ X-Cache:
64
+ - Miss from cloudfront
65
+ Via:
66
+ - 1.1 d16428714e022976873ccc980fdc1288.cloudfront.net (CloudFront)
67
+ X-Amz-Cf-Pop:
68
+ - FRA53-C1
69
+ X-Amz-Cf-Id:
70
+ - XA5UcIgo0pXEai8KtUJS7_GZlSraK4AguCB8ABJEmc-1u14jSU3mwQ==
71
+ body:
72
+ encoding: ASCII-8BIT
73
+ string: '{"subscriber_info":{"success":true,"state":"assumed_idle","location":{"current_location_retrieved":false,"age_of_location":1,"cell_global_id":{"mcc":"260","mnc":"3","lac":53113,"cid":46261}}},"request_timestamp":"2023-07-04T12:46:10.728+0000","reply_timestamp":"2023-07-04T12:46:10.930+0000"}'
74
+ recorded_at: Tue, 04 Jul 2023 12:46:10 GMT
75
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe InceApi::GetSimConnectivity do
4
+ it 'get one sim card - idle' do
5
+ VCR.use_cassette('get_sim_connectivity') do
6
+ response = described_class.new(access_token: "VALID TOKEN", iccid: '123456789').sim
7
+ expect(response['subscriber_info']['state']).to eq 'assumed_idle'
8
+ end
9
+ end
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ince-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislaw Zawadzki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.11'
19
+ version: '0.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.11'
26
+ version: '0.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-http
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,7 @@ files:
136
136
  - lib/ince_api/create_access_token.rb
137
137
  - lib/ince_api/create_sms.rb
138
138
  - lib/ince_api/get_sim.rb
139
+ - lib/ince_api/get_sim_connectivity.rb
139
140
  - lib/ince_api/get_sim_data_quota.rb
140
141
  - lib/ince_api/get_sim_sms_quota.rb
141
142
  - lib/ince_api/get_sim_status.rb
@@ -146,6 +147,7 @@ files:
146
147
  - lib/ince_api/single_sim_configuration.rb
147
148
  - spec/fixtures/vcr_cassettes/create_sms.yml
148
149
  - spec/fixtures/vcr_cassettes/get_sim.yml
150
+ - spec/fixtures/vcr_cassettes/get_sim_connectivity.yml
149
151
  - spec/fixtures/vcr_cassettes/get_sim_data_quota.yml
150
152
  - spec/fixtures/vcr_cassettes/get_sim_sms_quota.yml
151
153
  - spec/fixtures/vcr_cassettes/get_sim_status.yml
@@ -166,6 +168,7 @@ files:
166
168
  - spec/fixtures/vcr_cassettes/valid_credentials.yml
167
169
  - spec/ince-api/create_access_token_spec.rb
168
170
  - spec/ince-api/create_sms_spec.rb
171
+ - spec/ince-api/get_sim_connectivity_spec.rb
169
172
  - spec/ince-api/get_sim_data_quota_spec.rb
170
173
  - spec/ince-api/get_sim_sms_quota_spec.rb
171
174
  - spec/ince-api/get_sim_spec.rb
@@ -194,13 +197,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
197
  - !ruby/object:Gem::Version
195
198
  version: '0'
196
199
  requirements: []
197
- rubygems_version: 3.3.5
200
+ rubygems_version: 3.4.10
198
201
  signing_key:
199
202
  specification_version: 4
200
203
  summary: 1nce API wrapper
201
204
  test_files:
202
205
  - spec/fixtures/vcr_cassettes/create_sms.yml
203
206
  - spec/fixtures/vcr_cassettes/get_sim.yml
207
+ - spec/fixtures/vcr_cassettes/get_sim_connectivity.yml
204
208
  - spec/fixtures/vcr_cassettes/get_sim_data_quota.yml
205
209
  - spec/fixtures/vcr_cassettes/get_sim_sms_quota.yml
206
210
  - spec/fixtures/vcr_cassettes/get_sim_status.yml
@@ -221,6 +225,7 @@ test_files:
221
225
  - spec/fixtures/vcr_cassettes/valid_credentials.yml
222
226
  - spec/ince-api/create_access_token_spec.rb
223
227
  - spec/ince-api/create_sms_spec.rb
228
+ - spec/ince-api/get_sim_connectivity_spec.rb
224
229
  - spec/ince-api/get_sim_data_quota_spec.rb
225
230
  - spec/ince-api/get_sim_sms_quota_spec.rb
226
231
  - spec/ince-api/get_sim_spec.rb