vodacom 0.0.8 → 0.0.9

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: 1c492749a9ae27cca192bb56dc09047b49112a5d9c3f8d69baae0f8cd3a5b1eb
4
- data.tar.gz: 5426956fed41830f3ea3be0a7773a93361a310886f81491ce87a6beaf5fb804a
3
+ metadata.gz: c5f8da25824b23f1eaac84d77d6154dcc230201c6c82c8cd214439e695c4422c
4
+ data.tar.gz: d6aedddad91081d59da0cf6b6ecf94ac664fc2e0d922953c4d6b8e8deb9a60e4
5
5
  SHA512:
6
- metadata.gz: 81c7419a2fc2e76a748cfc6c9cdb17612e85ef7802e154daf398f7e1b27b7c02e21d795fb568faae83d63893c069d128471f7a997ddbe746094a81c856af8ff1
7
- data.tar.gz: 0a4084f151eb9ca875f06ad717b06dba2267631226f66b65789e0cdb40e4b38a3f1011d4e2a663abace54cb3ad3d97f099361e211beecc0c6b811e37c1da2b09
6
+ metadata.gz: ccbfed4a58728d5f463399b6d98dab60a961ffc60d7bf488979094073f9ecb00e27671b7ce260304d998301636436673dbe86a55f23eab1d9338c71c0ebd1acd
7
+ data.tar.gz: 9fd80003b8050fcbc5ae7a58571688e7df3da63ea695ad6b9026c40e3ddeb91fd574d2c8d5e3c9d4be8d60d9b951ff9bb5443b6ef82abf0535093c01aa0cbd27
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vodacom (0.0.8)
4
+ vodacom (0.0.9)
5
5
  active_attr (~> 0.16.0)
6
6
  httparty (~> 0.21.0)
7
- nokogiri (~> 1.16.0)
7
+ nokogiri (~> 1.16.3)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -33,17 +33,19 @@ GEM
33
33
  i18n (>= 1.6, < 2)
34
34
  minitest (>= 5.1)
35
35
  tzinfo (~> 2.0)
36
- addressable (2.8.5)
36
+ addressable (2.8.6)
37
37
  public_suffix (>= 2.0.2, < 6.0)
38
38
  ansi (1.5.0)
39
+ bigdecimal (3.1.7)
39
40
  builder (3.2.4)
40
41
  coderay (1.1.3)
41
42
  concurrent-ruby (1.1.10)
42
- crack (0.4.5)
43
+ crack (1.0.0)
44
+ bigdecimal
43
45
  rexml
44
46
  crass (1.0.6)
45
47
  erubi (1.12.0)
46
- hashdiff (1.0.1)
48
+ hashdiff (1.1.0)
47
49
  httparty (0.21.0)
48
50
  mini_mime (>= 1.0.0)
49
51
  multi_xml (>= 0.5.2)
@@ -54,7 +56,7 @@ GEM
54
56
  nokogiri (>= 1.5.9)
55
57
  method_source (1.0.0)
56
58
  mini_mime (1.1.2)
57
- minitest (5.21.2)
59
+ minitest (5.22.3)
58
60
  minitest-focus (1.4.0)
59
61
  minitest (>= 4, < 6)
60
62
  minitest-reporters (1.6.1)
@@ -65,12 +67,12 @@ GEM
65
67
  mocha (2.1.0)
66
68
  ruby2_keywords (>= 0.0.5)
67
69
  multi_xml (0.6.0)
68
- nokogiri (1.16.0-arm64-darwin)
70
+ nokogiri (1.16.3-arm64-darwin)
69
71
  racc (~> 1.4)
70
72
  pry (0.14.2)
71
73
  coderay (~> 1.1)
72
74
  method_source (~> 1.0)
73
- public_suffix (5.0.3)
75
+ public_suffix (5.0.4)
74
76
  racc (1.6.2)
75
77
  rack (2.2.5)
76
78
  rack-test (2.0.2)
@@ -87,7 +89,7 @@ GEM
87
89
  timecop (0.9.8)
88
90
  tzinfo (2.0.5)
89
91
  concurrent-ruby (~> 1.0)
90
- webmock (3.19.1)
92
+ webmock (3.23.0)
91
93
  addressable (>= 2.8.0)
92
94
  crack (>= 0.3.2)
93
95
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -97,7 +99,7 @@ PLATFORMS
97
99
  arm64-darwin-23
98
100
 
99
101
  DEPENDENCIES
100
- minitest (~> 5.21.2)
102
+ minitest (~> 5.22.3)
101
103
  minitest-focus (~> 1.4.0)
102
104
  minitest-reporters (~> 1.6.1)
103
105
  mocha (~> 2.1.0)
@@ -105,7 +107,7 @@ DEPENDENCIES
105
107
  rake (~> 13.1.0)
106
108
  timecop (~> 0.9.8)
107
109
  vodacom!
108
- webmock (~> 3.19.1)
110
+ webmock (~> 3.23.0)
109
111
 
110
112
  BUNDLED WITH
111
113
  2.5.5
data/README.md CHANGED
@@ -23,10 +23,12 @@ Or install it yourself as:
23
23
 
24
24
  ```ruby
25
25
  require 'vodacom'
26
- client = Vodacom::Client.new(username: 'your key', password: 'your password from vodacom website')
26
+ client = Vodacom::Client.new(username: 'your key', password: 'your password from vodacom website', use_v4: true)
27
27
 
28
28
  phone_number = "27...."
29
29
  client.balance(phone_number)
30
+
31
+ # use_v4 determines which API version is used
30
32
  ```
31
33
 
32
34
  ### Endpoints
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
@@ -4,6 +4,7 @@ module Vodacom
4
4
 
5
5
  LOGIN_PATH = 'https://www.vodacom.co.za/cloud/login/v3/login'
6
6
  BALANCE_PATH = 'https://www.vodacom.co.za/cloud/rest/balances/v3/bundle/balances/'
7
+ BALANCE_V4_PATH = 'https://www.vodacom.co.za/cloud/rest/balances/v3/bundle/balances/'
7
8
 
8
9
  attr_reader :username,
9
10
  :password,
@@ -11,31 +12,39 @@ module Vodacom
11
12
  :port,
12
13
  :login_response,
13
14
  :raw_cookie,
14
- :expiry
15
+ :expiry,
16
+ :use_v4
15
17
 
16
- def initialize(username:, password:, base_path: 'https://www.vodacom.co.za/cloud', port: 80)
18
+ def initialize(username:, password:, base_path: 'https://www.vodacom.co.za/cloud', port: 80, use_v4: false)
17
19
  @username = username
18
20
  @password = password
19
21
  @base_path = base_path
20
22
  @port = port
23
+ @use_v4 = use_v4
21
24
  end
22
25
 
23
26
  def self.compatible_api_version
24
- 'v3'
27
+ 'v4'
25
28
  end
26
29
 
27
30
  # This is the version of the API docs this client was built off-of
28
31
  def self.api_version
29
- 'v3 2021-03-13'
32
+ 'v4 2024-03-26'
30
33
  end
31
34
 
32
35
  def balance(phone_number)
33
36
  start_time = get_micro_second_time
34
37
 
38
+ if use_v4
39
+ balance_path = "#{BALANCE_V4_PATH}#{phone_number}"
40
+ else
41
+ balance_path = "#{BALANCE_PATH}#{phone_number}"
42
+ end
43
+
35
44
  login unless (raw_cookie && (expiry.to_i > Time.now.to_i))
36
45
  response = HTTParty.send(
37
46
  :get,
38
- "#{BALANCE_PATH}#{phone_number}",
47
+ balance_path,
39
48
  headers: {
40
49
  'Content-Type': 'application/json',
41
50
  'Accept': '*/*',
@@ -1,3 +1,3 @@
1
1
  module Vodacom
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/vodacom.gemspec CHANGED
@@ -24,15 +24,15 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_dependency "httparty", "~> 0.21.0"
26
26
  spec.add_dependency "active_attr", "~> 0.16.0"
27
- spec.add_dependency "nokogiri", "~> 1.16.0"
27
+ spec.add_dependency "nokogiri", "~> 1.16.3"
28
28
 
29
29
  # Development dependancies
30
30
  spec.add_development_dependency "rake", "~> 13.1.0"
31
- spec.add_development_dependency "minitest", "~> 5.21.2"
31
+ spec.add_development_dependency "minitest", "~> 5.22.3"
32
32
  spec.add_development_dependency "minitest-focus", "~> 1.4.0"
33
33
  spec.add_development_dependency "minitest-reporters", "~> 1.6.1"
34
34
  spec.add_development_dependency "timecop", "~> 0.9.8"
35
35
  spec.add_development_dependency "mocha", "~> 2.1.0"
36
36
  spec.add_development_dependency "pry", "~> 0.14.2"
37
- spec.add_development_dependency "webmock", "~> 3.19.1"
37
+ spec.add_development_dependency "webmock", "~> 3.23.0"
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vodacom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.16.0
47
+ version: 1.16.3
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: 1.16.0
54
+ version: 1.16.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 5.21.2
75
+ version: 5.22.3
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 5.21.2
82
+ version: 5.22.3
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest-focus
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 3.19.1
159
+ version: 3.23.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 3.19.1
166
+ version: 3.23.0
167
167
  description: A client for using the Vodacom API in Ruby. This is an unofficial project.
168
168
  email:
169
169
  - contact@jasonchalom.com