horoshop 0.0.0 → 0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/horoshop.rb +14 -4
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 852f57c5e330fc8c5eb939d8495632438ce00761c78726820051b04b4cfc4939
4
- data.tar.gz: a57e7f6502224da243e0b16c37a35b4620cc582f2f7ff6de41979d4bb3f27589
3
+ metadata.gz: a64a6410feb2bb998f34680aa0768fc75ea6e26c366bd6054912e9d37a3a27ab
4
+ data.tar.gz: 42c5e3a7472d214181d7d728f0a66f3c840e57912272a28424b9e908b4cbd27c
5
5
  SHA512:
6
- metadata.gz: c52d091ee145024bd8da9bdba86a0cb0b79fd6c2b61aec23b140431e32ec9a46101c9711b102fbda495b6afc0d328032405e671587c59387cf46446295145f22
7
- data.tar.gz: c8b3670334ecb8781a83785c9038ecd169c16f1974f32cd9bdd663d85757a962935917cab7b31129252079f32c827ce9964e075ac6a05b113799a8187d822bf9
6
+ metadata.gz: 92bc03964277af1d198374f2850749c06f3b3329608dec8f8cd1df58545599e5c942f18ef0f9c0e544c6b27a00da597ca479fd4211d40b951726126f9e7c18bb
7
+ data.tar.gz: 996143c53d82147bb31375f12b9608644f4e86729994789be94679e3501da0067e549ffc56cea0d9dcdd07ff70b380467b7bd6e373cc452abbd2dd2b688b80e7
data/lib/horoshop.rb CHANGED
@@ -1,16 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'horoshop/authorization'
4
+
3
5
  # Base class used to store data about authentication
4
6
  class Horoshop
5
- def initialize(url:, username:, password:)
7
+ attr_accessor :url, :login, :password, :token, :expiration_timestamp
8
+
9
+ def initialize(url:, login:, password:)
6
10
  @url = url
7
- @username = username
11
+ @login = login
8
12
  @password = password
9
13
  @token = nil
10
14
  @expiration_timestamp = nil
11
15
  end
12
16
 
13
- private
17
+ def token_valid?
18
+ return false if token.nil?
14
19
 
15
- attr_reader :url, :username, :password, :token, :expiration_timestamp
20
+ expiration_timestamp < Time.now
21
+ end
22
+
23
+ def refresh_token!
24
+ Horoshop::Authorization.new(self).authorize
25
+ end
16
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: horoshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denys Krupenov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-02-14 00:00:00.000000000 Z
12
+ date: 2024-02-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Gem for exchangedata with the internet shop constructor
15
15
  email: dkru84@gmail.com
@@ -21,7 +21,8 @@ files:
21
21
  homepage: https://github.com/dkru/horoshop
22
22
  licenses:
23
23
  - MIT
24
- metadata: {}
24
+ metadata:
25
+ rubygems_mfa_required: 'true'
25
26
  post_install_message:
26
27
  rdoc_options: []
27
28
  require_paths: