lifecell_api 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +13 -0
- data/.github/workflows/rubocop.yml +30 -0
- data/.github/workflows/ruby.yml +28 -0
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1 -7
- data/Gemfile +10 -0
- data/README.md +14 -15
- data/examples/get_balance.rb +2 -2
- data/lib/lifecell_api/methods.rb +2 -2
- data/lib/lifecell_api/version.rb +1 -1
- data/lib/lifecell_api.rb +13 -14
- data/lifecell_api.gemspec +1 -1
- data/spec/cassettes/Lifecell_API/sign_in.yml +38 -0
- data/spec/cassettes/Lifecell_API/summary_data.yml +97 -0
- data/spec/lifecell_api/lifecell_api_spec.rb +34 -0
- data/spec/spec_helper.rb +92 -0
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6052e820270074f159f3a1ae02c1aaaae772792a8df361790a28b8501b830754
|
4
|
+
data.tar.gz: 497ccf14008bd9437d8267003d44ab1336d76d946faed3714a6d8aee4a60a062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a7a01ff2ff88688bae6c542babd8218f9875be5a9572b48a0a6e42a65513c5bc58803dfa4043c7746008ec4539f1df0ca59249874219f675574e221ba2da911
|
7
|
+
data.tar.gz: 027d832cfe58082ff84a7120daf4e4446e90ae6b14a6523c70f199751c58197e0af4193ad1bb7b094c9c93b21f55e5dd38c07916da061716004670517a00c3a8
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
3
|
+
# Please see the documentation for all configuration options:
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
5
|
+
|
6
|
+
version: 2
|
7
|
+
updates:
|
8
|
+
|
9
|
+
# Maintain dependencies for GitHub Actions
|
10
|
+
- package-ecosystem: "github-actions"
|
11
|
+
directory: "/"
|
12
|
+
schedule:
|
13
|
+
interval: "weekly"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: "Rubocop"
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "master" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "master" ]
|
8
|
+
schedule:
|
9
|
+
- cron: '20 3 * * 6'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rubocop:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- name: Checkout repository
|
19
|
+
uses: actions/checkout@v4
|
20
|
+
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: 3.0
|
25
|
+
|
26
|
+
- name: Install dependencies
|
27
|
+
run: bundle install
|
28
|
+
|
29
|
+
- name: Rubocop run
|
30
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "master" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "master" ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
matrix:
|
18
|
+
ruby-version: ['3.2']
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v4
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby-version }}
|
26
|
+
bundler-cache: true
|
27
|
+
- name: Run tests
|
28
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# lifecell::API
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/lifecell_api.svg)](https://badge.fury.io/rb/lifecell_api)
|
4
|
+
[![Ruby](https://github.com/mamantoha/lifecell_api/actions/workflows/ruby.yml/badge.svg)](https://github.com/mamantoha/lifecell_api/actions/workflows/ruby.yml)
|
5
|
+
[![Rubocop](https://github.com/mamantoha/lifecell_api/actions/workflows/rubocop.yml/badge.svg)](https://github.com/mamantoha/lifecell_api/actions/workflows/rubocop.yml)
|
6
|
+
|
3
7
|
A Ruby library for interfacing with lifecell's undocumented/unannounced API.
|
4
8
|
|
5
9
|
Formerly known as `life-api`.
|
@@ -36,9 +40,9 @@ require 'lifecell_api'
|
|
36
40
|
|
37
41
|
### Authentication
|
38
42
|
|
39
|
-
You can authenticate with
|
43
|
+
You can authenticate with lifecell in two ways: with password or with token.
|
40
44
|
|
41
|
-
Authentication with password to the
|
45
|
+
Authentication with password to the lifecell API is accomplished using a phone number(`msisdn`) starting with the country code("380"), and SuperPassword(`password`).
|
42
46
|
|
43
47
|
```ruby
|
44
48
|
msisdn = '38063xxxxxxx'
|
@@ -64,16 +68,17 @@ Now you can make requests to the API.
|
|
64
68
|
|
65
69
|
### API Examples
|
66
70
|
|
67
|
-
Below you can see some the methods for working with
|
71
|
+
Below you can see some the methods for working with lifecell data.
|
68
72
|
|
69
73
|
#### Returns advanced information on the current subscriber
|
70
|
-
|
74
|
+
|
75
|
+
```ruby
|
71
76
|
life.summary_data
|
72
77
|
```
|
73
78
|
|
74
79
|
Sample response
|
75
80
|
|
76
|
-
```
|
81
|
+
```ruby
|
77
82
|
{"method"=>"getSummaryData",
|
78
83
|
"responseCode"=>"0",
|
79
84
|
"subscriber"=>
|
@@ -101,13 +106,13 @@ Sample response
|
|
101
106
|
|
102
107
|
#### Returns the balance of the current subscriber
|
103
108
|
|
104
|
-
```
|
109
|
+
```ruby
|
105
110
|
life.balances
|
106
111
|
```
|
107
112
|
|
108
113
|
Sample response
|
109
114
|
|
110
|
-
```
|
115
|
+
```ruby
|
111
116
|
{"method"=>"getBalances",
|
112
117
|
"responseCode"=>"0",
|
113
118
|
"balance"=>
|
@@ -168,13 +173,13 @@ Sample response
|
|
168
173
|
|
169
174
|
#### Returns payments history for calendar month in format 'YYYY-mm'
|
170
175
|
|
171
|
-
```
|
176
|
+
```ruby
|
172
177
|
life.payments_history('2013-03')
|
173
178
|
```
|
174
179
|
|
175
180
|
Sample response
|
176
181
|
|
177
|
-
```
|
182
|
+
```ruby
|
178
183
|
{"method"=>"getPaymentsHistory",
|
179
184
|
"responseCode"=>"0",
|
180
185
|
"payments"=>
|
@@ -190,12 +195,6 @@ Sample response
|
|
190
195
|
"sum"=>"40.00"}]}}
|
191
196
|
```
|
192
197
|
|
193
|
-
## Supported Rubies
|
194
|
-
|
195
|
-
Tested with the following Ruby versions:
|
196
|
-
|
197
|
-
* MRI 2.5.0
|
198
|
-
|
199
198
|
## Contributing
|
200
199
|
|
201
200
|
1. Fork it
|
data/examples/get_balance.rb
CHANGED
@@ -12,7 +12,7 @@ puts Lifecell::API::VERSION
|
|
12
12
|
msisdn = '38xxxxxxxxx'
|
13
13
|
password = 'xxxxxx'
|
14
14
|
|
15
|
-
life = Lifecell::API.new(msisdn
|
15
|
+
life = Lifecell::API.new(msisdn:, password:, lang: 'en')
|
16
16
|
life.log = Logger.new($stderr)
|
17
17
|
life.sign_in
|
18
18
|
|
@@ -38,7 +38,7 @@ puts "Bonus: #{bonus} ₴"
|
|
38
38
|
puts "Dept: #{debt} ₴"
|
39
39
|
|
40
40
|
puts "\nBalances:"
|
41
|
-
balances =
|
41
|
+
balances = life.balances
|
42
42
|
balances['balance'].keep_if { |i| i['amount'].to_i != 0 }.each do |i|
|
43
43
|
puts " * #{i['name']}: #{i['amount']} #{i['measure']}"
|
44
44
|
end
|
data/lib/lifecell_api/methods.rb
CHANGED
@@ -67,9 +67,9 @@ module Lifecell
|
|
67
67
|
def ui_properties(language_id, last_date_update)
|
68
68
|
request(
|
69
69
|
'getUIProperties',
|
70
|
-
accessKeyCode:
|
70
|
+
accessKeyCode: ACCESS_KEY_CODE,
|
71
71
|
languageId: language_id,
|
72
|
-
osType:
|
72
|
+
osType: OS_TYPE,
|
73
73
|
lastDateUpdate: last_date_update
|
74
74
|
)
|
75
75
|
end
|
data/lib/lifecell_api/version.rb
CHANGED
data/lib/lifecell_api.rb
CHANGED
@@ -60,6 +60,11 @@ module Lifecell
|
|
60
60
|
class API
|
61
61
|
attr_accessor :token, :sub_id
|
62
62
|
|
63
|
+
BASE_URL = 'https://api.lifecell.com.ua/mobile/'
|
64
|
+
ACCESS_KEY_CODE = '7'
|
65
|
+
APPLICATION_KEY = 'E6j_$4UnR_)0b'
|
66
|
+
OS_TYPE = 'ANDROID'
|
67
|
+
|
63
68
|
class << self
|
64
69
|
# Default logger for all Lifecell::API instances
|
65
70
|
#
|
@@ -76,18 +81,12 @@ module Lifecell
|
|
76
81
|
# * +:password+ - super password
|
77
82
|
# * +:lang+ - 'uk', 'ru' or 'en'
|
78
83
|
#
|
79
|
-
def initialize(
|
80
|
-
@msisdn =
|
81
|
-
@password =
|
82
|
-
@lang =
|
84
|
+
def initialize(msisdn:, password:, lang: 'uk')
|
85
|
+
@msisdn = msisdn
|
86
|
+
@password = password
|
87
|
+
@lang = lang
|
83
88
|
|
84
89
|
@log = nil
|
85
|
-
|
86
|
-
@os_type = 'ANDROID'
|
87
|
-
|
88
|
-
@api_url = 'https://api.lifecell.com.ua/mobile/'
|
89
|
-
@access_key_code = '7'
|
90
|
-
@application_key = 'E6j_$4UnR_)0b'
|
91
90
|
end
|
92
91
|
|
93
92
|
# The current logger. If no logger has been set Lifecell::API.log is used.
|
@@ -101,7 +100,7 @@ module Lifecell
|
|
101
100
|
attr_writer :log
|
102
101
|
|
103
102
|
def request(method, params = {})
|
104
|
-
params = { accessKeyCode:
|
103
|
+
params = { accessKeyCode: ACCESS_KEY_CODE }.merge(params)
|
105
104
|
url = create_signed_url(method, params)
|
106
105
|
|
107
106
|
log&.debug("[#{method}] request: #{url}")
|
@@ -142,13 +141,13 @@ module Lifecell
|
|
142
141
|
str = "#{method}?#{query}&signature="
|
143
142
|
|
144
143
|
digest = OpenSSL::Digest.new('sha1')
|
145
|
-
hash = OpenSSL::HMAC.digest(digest,
|
144
|
+
hash = OpenSSL::HMAC.digest(digest, APPLICATION_KEY, str)
|
146
145
|
|
147
146
|
hash = Base64.encode64(hash).chomp
|
148
147
|
|
149
148
|
str += urlencode(hash)
|
150
149
|
|
151
|
-
|
150
|
+
BASE_URL + str
|
152
151
|
end
|
153
152
|
|
154
153
|
# Returns a string representation of the receiver suitable for use
|
@@ -169,7 +168,7 @@ module Lifecell
|
|
169
168
|
end
|
170
169
|
|
171
170
|
def base_api_parameters
|
172
|
-
{ msisdn: @msisdn, languageId: @lang, osType:
|
171
|
+
{ msisdn: @msisdn, languageId: @lang, osType: OS_TYPE, token: @token }
|
173
172
|
end
|
174
173
|
end
|
175
174
|
end
|
data/lifecell_api.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
22
22
|
gem.require_paths = ['lib']
|
23
23
|
|
24
|
-
gem.required_ruby_version = '>= 2
|
24
|
+
gem.required_ruby_version = '>= 3.2'
|
25
25
|
gem.add_runtime_dependency('xml-simple', '~> 1.1.2')
|
26
26
|
gem.metadata['rubygems_mfa_required'] = 'true'
|
27
27
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.lifecell.com.ua/mobile/signIn?accessKeyCode=7&msisdn=380630000000&signature=pZqbYXP/F5cxZhNX2lXA/rlzynI=&superPassword=passw0rd
|
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
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Sat, 20 May 2023 13:09:07 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/xml;charset=UTF-8
|
27
|
+
Content-Length:
|
28
|
+
- '242'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Frame-Options:
|
32
|
+
- SAMEORIGIN
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><response method="signIn"><responseCode>0</responseCode><resultText>Successful
|
36
|
+
logic performing or data returning</resultText><token>T0KEN</token><subId>SUB_ID</subId></response>
|
37
|
+
recorded_at: Sat, 20 May 2023 13:09:07 GMT
|
38
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.lifecell.com.ua/mobile/signIn?accessKeyCode=7&msisdn=380630000000&signature=pZqbYXP/F5cxZhNX2lXA/rlzynI=&superPassword=passw0rd
|
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
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Sat, 20 May 2023 13:48:38 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/xml;charset=UTF-8
|
27
|
+
Content-Length:
|
28
|
+
- '242'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Frame-Options:
|
32
|
+
- SAMEORIGIN
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><response method="signIn"><responseCode>0</responseCode><resultText>Successful
|
36
|
+
logic performing or data returning</resultText><token>T0KEN</token><subId>SUB_ID</subId></response>
|
37
|
+
recorded_at: Sat, 20 May 2023 13:48:38 GMT
|
38
|
+
- request:
|
39
|
+
method: get
|
40
|
+
uri: https://api.lifecell.com.ua/mobile/getSummaryData?accessKeyCode=7&languageId=uk&msisdn=380630000000&osType=ANDROID&signature=zeFGal/zqqJzY9%2BST2/RVzdhiwQ=&token=T0KEN
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ''
|
44
|
+
headers:
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- "*/*"
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
Server:
|
57
|
+
- nginx
|
58
|
+
Date:
|
59
|
+
- Sat, 20 May 2023 13:48:40 GMT
|
60
|
+
Content-Type:
|
61
|
+
- application/xml;charset=UTF-8
|
62
|
+
Content-Length:
|
63
|
+
- '2872'
|
64
|
+
Connection:
|
65
|
+
- keep-alive
|
66
|
+
X-Frame-Options:
|
67
|
+
- SAMEORIGIN
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><response method="getSummaryData"><responseCode>0</responseCode><resultText>Successful
|
71
|
+
logic performing or data returning</resultText><subscriber msisdn="380630000000"><attribute
|
72
|
+
name="ICCID">89380062300016907xxx</attribute><attribute name="PUK">25159xxx</attribute><attribute
|
73
|
+
name="PUK2">00036xxx</attribute><attribute name="PIN2">9300</attribute><attribute
|
74
|
+
name="IMSI">25506109310xxxx</attribute><attribute name="PIN">70xx</attribute><attribute
|
75
|
+
name="SIM_TYPE">ESIM</attribute><attribute name="LINE_STATE">ACT/STD</attribute><attribute
|
76
|
+
name="USE_COMMON_MAIN">false</attribute><attribute name="IS_FISHKA">N</attribute><attribute
|
77
|
+
name="NEXT_FEE_CHARGING_DATE">28.05.23</attribute><attribute name="LANGUAGE_ID">ug</attribute><attribute
|
78
|
+
name="LINE_ACTIVATION_DATE">2010-03-02T11:28:07.000+02:00</attribute><attribute
|
79
|
+
name="LINE_SUSPEND_DATE">2024-04-29T00:00:00.000+03:00</attribute><attribute
|
80
|
+
name="DEVICE_LTE_SUPPORT">YES</attribute><balance code="Line_Main" amount="206.95"/><balance
|
81
|
+
code="Line_Bonus" amount="0.00"/><balance code="Line_Debt" amount="0.00"/><tariff><code>IND_PRE_INET_HEAT</code><name>Internet
|
82
|
+
Heat</name><description><ul><li>20GB of Internet</li><li>500
|
83
|
+
min to all numbers within Ukraine (landline and mobile, including lifecell)</li><li>Unlim
|
84
|
+
to Facebook, Instagram, Twitter</li><li>50GB in lifebox storage</li><li>+1GB
|
85
|
+
for every 30 min of outgoing calls from BiP Out</li></ul><br><b>Service
|
86
|
+
package cost for 4 weeks - 200 UAH</b><b><br></b><b><br></b>Tariffs
|
87
|
+
are quoted with all taxes.<br></description><picture_url>https://m.lifecell.ua/uploads/medialibrary/2021/01/4SITE_internetHeat_EN.png</picture_url><webview_url>https://m.lifecell.ua/en/mobile/tariffs/internet-heat/</webview_url><short_description><html><body><p>Hot
|
88
|
+
tariff for the internet</p></body></html></short_description><tariff_price_discount>200</tariff_price_discount><tariff_price_full>200</tariff_price_full><tariff_order_period>4
|
89
|
+
weeks</tariff_order_period></tariff><use_common_main>false</use_common_main></subscriber><applicationAttributes><attribute
|
90
|
+
name="REORDER_A">Yes</attribute><attribute name="REORDER_B">Yes</attribute><attribute
|
91
|
+
name="GIFT_B">Yes</attribute><attribute name="IS_HANDMADE_AVAILABLE">Yes</attribute><attribute
|
92
|
+
name="IS_SHAKE_AND_WIN_AVAILABLE">Yes</attribute><attribute name="SIMAGOTCHI">Yes</attribute><attribute
|
93
|
+
name="IS_GIFTS_POOL_AVAILABLE">Yes</attribute><attribute name="POSSIBILITY_DIYA_IDENTIFICATION">No</attribute><attribute
|
94
|
+
name="POSSIBILITY_DIYA_REGISTRATION">No</attribute><attribute name="IS_SMILE_BONUS_AVAILABLE">No</attribute><attribute
|
95
|
+
name="IS_BAYRAKTAR_AVAILABLE">No</attribute></applicationAttributes></response>
|
96
|
+
recorded_at: Sat, 20 May 2023 13:48:40 GMT
|
97
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'lifecell_api'
|
5
|
+
|
6
|
+
RSpec.describe Lifecell::API do
|
7
|
+
let(:msisdn) { '380630000000' }
|
8
|
+
let(:password) { 'passw0rd' }
|
9
|
+
let(:token) { 'T0KEN' }
|
10
|
+
|
11
|
+
it 'initialize' do
|
12
|
+
lifecell_api = Lifecell::API.new(msisdn: '380xxxxxxxxx', password: 'xxxxxx', lang: 'uk')
|
13
|
+
expect(lifecell_api).to be_a(Lifecell::API)
|
14
|
+
expect(lifecell_api.token).to be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'sign_in', :vcr do
|
18
|
+
lifecell_api = Lifecell::API.new(msisdn:, password:, lang: 'uk')
|
19
|
+
lifecell_api.sign_in
|
20
|
+
|
21
|
+
expect(lifecell_api.token).to eq(token)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'summary_data', :vcr do
|
25
|
+
lifecell_api = Lifecell::API.new(msisdn:, password:, lang: 'uk')
|
26
|
+
lifecell_api.sign_in
|
27
|
+
|
28
|
+
expect(lifecell_api.token).to eq(token)
|
29
|
+
|
30
|
+
summary_data = lifecell_api.summary_data
|
31
|
+
|
32
|
+
expect(summary_data['subscriber']['tariff']['name']).to eq('Internet Heat')
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
require 'simplecov'
|
6
|
+
SimpleCov.start
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.expect_with :rspec do |expectations|
|
10
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
11
|
+
# and `failure_message` of custom matchers include text for helper methods
|
12
|
+
# defined using `chain`, e.g.:
|
13
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
14
|
+
# # => "be bigger than 2 and smaller than 4"
|
15
|
+
# ...rather than:
|
16
|
+
# # => "be bigger than 2"
|
17
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
18
|
+
end
|
19
|
+
|
20
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
21
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
22
|
+
config.mock_with :rspec do |mocks|
|
23
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
24
|
+
# a real object. This is generally recommended, and will default to
|
25
|
+
# `true` in RSpec 4.
|
26
|
+
mocks.verify_partial_doubles = true
|
27
|
+
end
|
28
|
+
|
29
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
30
|
+
# have no way to turn it off -- the option exists only for backwards
|
31
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
32
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
33
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
34
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
35
|
+
|
36
|
+
# The settings below are suggested to provide a good initial experience
|
37
|
+
# with RSpec, but feel free to customize to your heart's content.
|
38
|
+
|
39
|
+
# This allows you to limit a spec run to individual examples or groups
|
40
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
41
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
42
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
43
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
44
|
+
config.filter_run_when_matching :focus
|
45
|
+
|
46
|
+
# Allows RSpec to persist some state between runs in order to support
|
47
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
48
|
+
# you configure your source control system to ignore this file.
|
49
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
52
|
+
# recommended. For more details, see:
|
53
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
54
|
+
config.disable_monkey_patching!
|
55
|
+
|
56
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
57
|
+
# be too noisy due to issues in dependencies.
|
58
|
+
config.warnings = true
|
59
|
+
|
60
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
61
|
+
# file, and it's useful to allow more verbose output when running an
|
62
|
+
# individual spec file.
|
63
|
+
if config.files_to_run.one?
|
64
|
+
# Use the documentation formatter for detailed output,
|
65
|
+
# unless a formatter has already been configured
|
66
|
+
# (e.g. via a command-line flag).
|
67
|
+
config.default_formatter = 'doc'
|
68
|
+
end
|
69
|
+
|
70
|
+
# Print the 10 slowest examples and example groups at the
|
71
|
+
# end of the spec run, to help surface which specs are running
|
72
|
+
# particularly slow.
|
73
|
+
config.profile_examples = 10
|
74
|
+
|
75
|
+
# Run specs in random order to surface order dependencies. If you find an
|
76
|
+
# order dependency and want to debug it, you can fix the order by providing
|
77
|
+
# the seed, which is printed after each run.
|
78
|
+
# --seed 1234
|
79
|
+
config.order = :random
|
80
|
+
|
81
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
82
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
83
|
+
# test failures related to randomization by passing the same `--seed` value
|
84
|
+
# as the one that triggered the failure.
|
85
|
+
Kernel.srand config.seed
|
86
|
+
end
|
87
|
+
|
88
|
+
VCR.configure do |config|
|
89
|
+
config.cassette_library_dir = 'spec/cassettes'
|
90
|
+
config.hook_into :webmock
|
91
|
+
config.configure_rspec_metadata!
|
92
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifecell_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Maminov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xml-simple
|
@@ -31,7 +31,11 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".github/dependabot.yml"
|
35
|
+
- ".github/workflows/rubocop.yml"
|
36
|
+
- ".github/workflows/ruby.yml"
|
34
37
|
- ".gitignore"
|
38
|
+
- ".rspec"
|
35
39
|
- ".rubocop.yml"
|
36
40
|
- Gemfile
|
37
41
|
- LICENSE
|
@@ -42,6 +46,10 @@ files:
|
|
42
46
|
- lib/lifecell_api/methods.rb
|
43
47
|
- lib/lifecell_api/version.rb
|
44
48
|
- lifecell_api.gemspec
|
49
|
+
- spec/cassettes/Lifecell_API/sign_in.yml
|
50
|
+
- spec/cassettes/Lifecell_API/summary_data.yml
|
51
|
+
- spec/lifecell_api/lifecell_api_spec.rb
|
52
|
+
- spec/spec_helper.rb
|
45
53
|
homepage: https://github.com/mamantoha/lifecell_api
|
46
54
|
licenses:
|
47
55
|
- MIT
|
@@ -55,14 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
63
|
requirements:
|
56
64
|
- - ">="
|
57
65
|
- !ruby/object:Gem::Version
|
58
|
-
version: 2
|
66
|
+
version: '3.2'
|
59
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
68
|
requirements:
|
61
69
|
- - ">="
|
62
70
|
- !ruby/object:Gem::Version
|
63
71
|
version: '0'
|
64
72
|
requirements: []
|
65
|
-
rubygems_version: 3.4.
|
73
|
+
rubygems_version: 3.4.14
|
66
74
|
signing_key:
|
67
75
|
specification_version: 4
|
68
76
|
summary: The Lifecell::API library is used for interactions with api.lifecell.com.ua
|