janio_api 0.1.7 → 0.1.8
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/janio_api.rb +4 -6
- data/lib/janio_api/resources/base.rb +1 -6
- data/lib/janio_api/resources/order.rb +4 -3
- data/lib/janio_api/version.rb +1 -1
- data/lib/zeitwerk_loader.rb +2 -2
- metadata +1 -2
- data/lib/janio_api/configuration.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3863da6db5ba3acfaf5ac5f2508a55c729723791b0c051e6c36ede51c988a4
|
4
|
+
data.tar.gz: f0780ca29fe903b60c9ac77ce61062caa34285c40c0a174e27cd3b738e6c28d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c2f6d87514d19841f504f15026584c80af0f7c46a25b4baa0538fcf8c715b36708c5bf665ca99f5e1244f44f076365fb9835bd52fefd9d101673643cd918fa1
|
7
|
+
data.tar.gz: e2b2ec97b861bb883bb1a5ffb8fdaf7e599564f4e7e25262ee287c6b63a1ec5f0e8bc7f4e8860037f79acbf7a3af11c90f4cacdd3fcdf811ed3e8dee01c9eef6
|
data/Gemfile.lock
CHANGED
data/lib/janio_api.rb
CHANGED
@@ -3,9 +3,6 @@ require "active_resource"
|
|
3
3
|
require "dotenv/load"
|
4
4
|
require_relative "zeitwerk_loader"
|
5
5
|
|
6
|
-
# if || (defined?(Rails) && Rails::VERSION::MAJOR >= 6)
|
7
|
-
# end
|
8
|
-
|
9
6
|
module JanioAPI
|
10
7
|
class << self
|
11
8
|
attr_accessor :config
|
@@ -14,8 +11,9 @@ module JanioAPI
|
|
14
11
|
self.config ||= Configuration.new
|
15
12
|
yield(config)
|
16
13
|
end
|
17
|
-
end
|
18
14
|
|
19
|
-
|
20
|
-
|
15
|
+
class Configuration
|
16
|
+
attr_accessor :api_host, :api_token
|
17
|
+
end
|
18
|
+
end
|
21
19
|
end
|
@@ -3,11 +3,6 @@ module JanioAPI
|
|
3
3
|
self.include_root_in_json = false
|
4
4
|
self.include_format_in_path = false
|
5
5
|
self.connection_class = JanioAPI::Connection
|
6
|
-
|
7
|
-
if JanioAPI.config&.api_host
|
8
|
-
self.site = JanioAPI.config.api_host
|
9
|
-
else
|
10
|
-
raise ArgumentError, "Please set the api_host in the initializer file"
|
11
|
-
end
|
6
|
+
self.site = JanioAPI.config&.api_host
|
12
7
|
end
|
13
8
|
end
|
@@ -38,7 +38,7 @@ module JanioAPI
|
|
38
38
|
validates :cod_amount_to_collect, presence: true, if: -> { payment_type == "cod" }
|
39
39
|
validates :items, length: {minimum: 1, message: "are required. Please add at least one."}
|
40
40
|
|
41
|
-
validate :
|
41
|
+
validate :check_credentials
|
42
42
|
validate :items_validation
|
43
43
|
|
44
44
|
class << self
|
@@ -144,8 +144,9 @@ module JanioAPI
|
|
144
144
|
|
145
145
|
private
|
146
146
|
|
147
|
-
def
|
148
|
-
errors.add(:base, "Please set the api_token in the initializer file") if JanioAPI.config
|
147
|
+
def check_credentials
|
148
|
+
errors.add(:base, "Please set the api_token in the initializer file") if JanioAPI.config&.api_token&.blank?
|
149
|
+
errors.add(:base, "Please set the api_host in the initializer file") if JanioAPI.config&.api_host&.blank?
|
149
150
|
end
|
150
151
|
|
151
152
|
def items_validation
|
data/lib/janio_api/version.rb
CHANGED
data/lib/zeitwerk_loader.rb
CHANGED
@@ -4,9 +4,9 @@ loader = Zeitwerk::Loader.for_gem
|
|
4
4
|
loader.inflector.inflect(
|
5
5
|
"janio_api" => "JanioAPI"
|
6
6
|
)
|
7
|
-
loader.
|
8
|
-
loader.collapse("lib/janio_api/resources")
|
7
|
+
loader.collapse("./lib/janio_api/resources")
|
9
8
|
loader.enable_reloading
|
9
|
+
loader.tag = "janio_api_gem"
|
10
10
|
# loader.log!
|
11
11
|
loader.setup
|
12
12
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: janio_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Chong
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- bin/setup
|
115
115
|
- janio_api.gemspec
|
116
116
|
- lib/janio_api.rb
|
117
|
-
- lib/janio_api/configuration.rb
|
118
117
|
- lib/janio_api/connection.rb
|
119
118
|
- lib/janio_api/redirect_fetcher.rb
|
120
119
|
- lib/janio_api/resources/base.rb
|