janio_api 0.1.7 → 0.1.8

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: f3b9a17c65e6632a7e0d38e7e6e1b78f2cd75469953d0b2c503ff80a38c2f32b
4
- data.tar.gz: 74c422c82b3c6813b6d0f7df8cf0329b19bdb2d28b321a1504d4064a338e19cf
3
+ metadata.gz: 7e3863da6db5ba3acfaf5ac5f2508a55c729723791b0c051e6c36ede51c988a4
4
+ data.tar.gz: f0780ca29fe903b60c9ac77ce61062caa34285c40c0a174e27cd3b738e6c28d2
5
5
  SHA512:
6
- metadata.gz: 61d294083604993f53c534fc57b383b0b67cbe1cbb9ac84f0ccdbfe417397d95c33f5cae1325d9309bfb6f6722681621b81456a1e934975d61d55ca7d4ebe5a0
7
- data.tar.gz: 3a4c7e6af928275c196b185870fafde23ece38c9ee01c9942dcdb608f1eb37a4659a0f6f51544c6ed532a9b1745cdae449db624415c52f6be26f69c9154203d2
6
+ metadata.gz: 3c2f6d87514d19841f504f15026584c80af0f7c46a25b4baa0538fcf8c715b36708c5bf665ca99f5e1244f44f076365fb9835bd52fefd9d101673643cd918fa1
7
+ data.tar.gz: e2b2ec97b861bb883bb1a5ffb8fdaf7e599564f4e7e25262ee287c6b63a1ec5f0e8bc7f4e8860037f79acbf7a3af11c90f4cacdd3fcdf811ed3e8dee01c9eef6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- janio_api (0.1.7)
4
+ janio_api (0.1.8)
5
5
  activeresource
6
6
  zeitwerk
7
7
 
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
- class Error < StandardError; end
20
- # Your code goes here...
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 :check_api_token
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 check_api_token
148
- errors.add(:base, "Please set the api_token in the initializer file") if JanioAPI.config.api_token.blank?
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
@@ -1,3 +1,3 @@
1
1
  module JanioAPI
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -4,9 +4,9 @@ loader = Zeitwerk::Loader.for_gem
4
4
  loader.inflector.inflect(
5
5
  "janio_api" => "JanioAPI"
6
6
  )
7
- loader.push_dir("lib")
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.7
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
@@ -1,5 +0,0 @@
1
- module JanioAPI
2
- class Configuration
3
- attr_accessor :api_host, :api_token
4
- end
5
- end