ince-api 0.0.6 → 0.2.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: abcdb5b26135ec182b22cf1956873c243c629662effd4a4bdab08b276694a09a
4
- data.tar.gz: 377ceb1ce19d02c9ffd71488c0fbc9b15d83af165d4d0b6213a58cd2611e7e5b
3
+ metadata.gz: 3c33e9c72831380c569c0e436ae521c60de13029b4032079e0e0c3e9c8073415
4
+ data.tar.gz: 3152ab4dc73f308f714ec6b746da821d394fe7e29e24735fabee507048d0ac45
5
5
  SHA512:
6
- metadata.gz: a62d18dfb5d4e4ffafe305e126a047b878adc33fd2291c7b50f7cedd48d3cc80c7c3484254b85cfc78a653e2a56d391092fc8318ce84824b0dd67c9621b63212
7
- data.tar.gz: fae9f66854afaa3cf34643f14cca899ae306a38dd6d6ed6d7ec91a5bb12e173a9436579fb245e6c4298093de6dafc56c9284af3333b1fab208570a7f5581601c
6
+ metadata.gz: 201ae637e96c1d988cea0aabcf58401ef87517d8f415ffb64e9cab72d9a8f3a42627709c63aad9df1b11028a15c722ca9e95e65b0709d5bb1242d8b5caa092d5
7
+ data.tar.gz: 2a8b92921848c087e45c3af210f0d2b03a3479f0d487ae70da7008245af81c1cca4534e32b75930ac37532112091b4c9a54f62c362b27fc704ad1efcbb2ab285
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ince-api (0.0.6)
4
+ ince-api (0.1.2)
5
5
  base64 (~> 0.1)
6
6
  net-http (~> 0.2)
7
- openssl (~> 2.2)
7
+ openssl
8
8
  uri (~> 0.11)
9
9
 
10
10
  GEM
@@ -18,17 +18,10 @@ GEM
18
18
  rexml
19
19
  diff-lcs (1.4.4)
20
20
  hashdiff (1.0.1)
21
- io-wait (0.1.0)
22
- ipaddr (1.2.3)
23
21
  method_source (1.0.0)
24
- net-http (0.2.0)
25
- net-protocol
22
+ net-http (0.2.2)
26
23
  uri
27
- net-protocol (0.1.2)
28
- io-wait
29
- timeout
30
- openssl (2.2.1)
31
- ipaddr
24
+ openssl (3.0.0)
32
25
  pry (0.14.1)
33
26
  coderay (~> 1.1)
34
27
  method_source (~> 1.0)
@@ -47,7 +40,6 @@ GEM
47
40
  diff-lcs (>= 1.2.0, < 2.0)
48
41
  rspec-support (~> 3.10.0)
49
42
  rspec-support (3.10.3)
50
- timeout (0.2.0)
51
43
  uri (0.11.0)
52
44
  vcr (6.0.0)
53
45
  webmock (3.14.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.0.6'
3
+ s.version = '0.2.0'
4
4
  s.summary = "1nce API wrapper"
5
5
  s.description = "A simple wrapper for 1nce API"
6
6
  s.authors = ["Stanislaw Zawadzki"]
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.license = 'MIT'
15
15
  s.add_dependency 'uri', '~> 0.11'
16
16
  s.add_dependency 'net-http', '~> 0.2'
17
- s.add_dependency 'openssl', '~> 2.2'
17
+ s.add_dependency 'openssl'
18
18
  s.add_dependency 'base64', '~> 0.1'
19
19
  s.add_development_dependency 'pry', '~> 0.13'
20
20
  s.add_development_dependency 'rspec', '~> 3.9'
data/lib/ince-api.rb CHANGED
@@ -13,3 +13,4 @@ require_relative 'ince_api/get_sim_usage'
13
13
  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
+ require_relative 'ince_api/reset_connectivity'
@@ -0,0 +1,36 @@
1
+ module InceApi
2
+ class ResetConnectivity
3
+ def initialize(access_token:, iccid:)
4
+ @access_token = access_token
5
+ @iccid = iccid
6
+ end
7
+
8
+ def reset
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}/reset")
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::Post.new(url).tap do |request|
31
+ request["Accept"] = 'application/json'
32
+ request['Authorization'] = "Bearer #{@access_token}"
33
+ end
34
+ end
35
+ end
36
+ 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.0.6
4
+ version: 0.2.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: 2021-11-16 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: openssl
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2.2'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2.2'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: base64
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +142,7 @@ files:
142
142
  - lib/ince_api/get_sim_usage.rb
143
143
  - lib/ince_api/get_sims.rb
144
144
  - lib/ince_api/multiple_sims_configuration.rb
145
+ - lib/ince_api/reset_connectivity.rb
145
146
  - lib/ince_api/single_sim_configuration.rb
146
147
  - spec/fixtures/vcr_cassettes/create_sms.yml
147
148
  - spec/fixtures/vcr_cassettes/get_sim.yml
@@ -193,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  - !ruby/object:Gem::Version
194
195
  version: '0'
195
196
  requirements: []
196
- rubygems_version: 3.1.4
197
+ rubygems_version: 3.3.5
197
198
  signing_key:
198
199
  specification_version: 4
199
200
  summary: 1nce API wrapper