track_try 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa3fc41e49aed57d12788aaa44a4e32e284cf643f9505f95716d3b57cb5cf2d5
4
- data.tar.gz: 13fe0a1eb583e7cdabd45ed46343affab1cd10ffe952f7a891d741f0eb209fda
3
+ metadata.gz: d1dc92ef05eccf862e3a6a72cb6fc75e8958c2cea4b80790bc0a052b0747bca4
4
+ data.tar.gz: b34ae4ac8292d59bdea46b6787226bac1eca853737a6712b2db265613d9e44db
5
5
  SHA512:
6
- metadata.gz: 89dc63228aa3564ec8d07e6c35f1e0e5a841b86d1410a49b61833eef98cfe7795c352093f0aad6a9f530e258f2dcfc2838b42a95f3bf27708bff88becd3c19ec
7
- data.tar.gz: 31f57b6bccc31b0faf377f23c2596e32002d803cc08c871b43e092885ea80d48918f181f3a27a46e915ec730aaee09d467af141966580d363fe7bdb3da477d47
6
+ metadata.gz: 1e023ca6596bfa78bd79e94a2cabd25fff3ea80c8dd0f72cec02d7e594c07cb07d706f99b334b21a27b379464af534f90048214b33d746441d6e38ef50a813da
7
+ data.tar.gz: 58ff99991fc59ff1cc6e7f2f6cfc41839460da3a00b192051f27ab9bd1eed3eda985f840af95da5a8bcf94e5220929a10d1e804e22c9b71cb42e3a698e812172
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- track_try (0.1.0)
4
+ track_try (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,6 +11,7 @@ GEM
11
11
 
12
12
  PLATFORMS
13
13
  x86_64-darwin-18
14
+ x86_64-darwin-20
14
15
 
15
16
  DEPENDENCIES
16
17
  minitest (~> 5.0)
data/README.md CHANGED
@@ -32,23 +32,21 @@ end
32
32
 
33
33
  ```
34
34
  # Get single tracking
35
- TrackTry.get_tracking!(carrier_code, tracking_number)
36
- ```
37
-
38
- ## Development
35
+ response = TrackTry.get_tracking!(carrier_code, tracking_number)
39
36
 
40
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+ # If success
38
+ response.message
39
+ response.code
40
+ response.body
41
41
 
42
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+ # If error
43
+ It will raise TrackTry::Error
44
+ ```
43
45
 
44
46
  ## Contributing
45
47
 
46
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/track_try. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/track_try/blob/main/CODE_OF_CONDUCT.md).
48
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/surender-mallow/track_try.
47
49
 
48
50
  ## License
49
51
 
50
52
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
51
-
52
- ## Code of Conduct
53
-
54
- Everyone interacting in the TrackTry project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/track_try/blob/main/CODE_OF_CONDUCT.md).
@@ -1,4 +1,11 @@
1
1
  module TrackTry
2
2
  class Error < StandardError
3
+ attr_reader :status
4
+
5
+ def initialize(message, status)
6
+ super(message)
7
+
8
+ @status = status
9
+ end
3
10
  end
4
11
  end
@@ -19,7 +19,7 @@ module TrackTry
19
19
  if [200, 201].include?(response.code.to_i)
20
20
  response
21
21
  else
22
- raise TrackTry::Error, response.message
22
+ raise TrackTry::Error.new(response.message, response.code)
23
23
  end
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrackTry
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/track_try.rb CHANGED
@@ -8,10 +8,8 @@ require_relative "track_try/tracker"
8
8
  module TrackTry
9
9
  # Get single tracking
10
10
  def self.get_tracking!(carrier_code, tracking_number)
11
- if carrier_code.to_s.empty?
12
- raise TrackTry::Error, "Carrier code can't be blank"
13
- elsif tracking_number.to_s.empty?
14
- raise TrackTry::Error, "Tracking number can't be blank"
11
+ if carrier_code.to_s.empty? || tracking_number.to_s.empty?
12
+ raise TrackTry::Error.new('Carrier or tracking code does not exist', 404)
15
13
  else
16
14
  base_url = TrackTry.configuration.url
17
15
  headers = TrackTry.configuration.headers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: track_try
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surender Thillainathan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: TrackTry gem to interact with TrackTry API in native Ruby
14
14
  email:
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubygems_version: 3.2.3
54
+ rubygems_version: 3.2.22
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: TrackTry gem