shiprocket_api 0.5.0 → 0.5.3
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 +16 -16
- data/lib/shiprocket_api/resources/custom_order.rb +11 -0
- data/lib/shiprocket_api/resources/return_order.rb +13 -0
- data/lib/shiprocket_api/shared/order_helper.rb +13 -22
- data/lib/shiprocket_api/version.rb +1 -1
- data/shiprocket_api.gemspec +1 -1
- metadata +7 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 06254144445b337f4c922aa9e52b5a764b01a69904e50a7b9c284845f5448d56
         | 
| 4 | 
            +
              data.tar.gz: 65b3112a520cde29312a12d664bbaa7b58b8d3685f06118fb21da390c18697a3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f306abd563ad8ed44deec0429b581db0950022ba1a0c4aeebe9ba42ace0fbef5919ddfb3f67e724430b236d9b96c1dc345586a5623fec910f987c7afd80b2978
         | 
| 7 | 
            +
              data.tar.gz: e4ecbdf1e822c6994930670c4d72af4f5899457eb12a2ff3ec72d087647befaab54c054cd0db5be3acdf9b0290e724c1f95e15052249b74c243e277c834f41f3
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                shiprocket_api (0. | 
| 5 | 
            -
                  activeresource ( | 
| 4 | 
            +
                shiprocket_api (0.5.2)
         | 
| 5 | 
            +
                  activeresource (>= 4.1.0)
         | 
| 6 6 | 
             
                  http
         | 
| 7 7 |  | 
| 8 8 | 
             
            GEM
         | 
| 9 9 | 
             
              remote: https://rubygems.org/
         | 
| 10 10 | 
             
              specs:
         | 
| 11 | 
            -
                activemodel (6.1. | 
| 12 | 
            -
                  activesupport (= 6.1. | 
| 11 | 
            +
                activemodel (6.1.5)
         | 
| 12 | 
            +
                  activesupport (= 6.1.5)
         | 
| 13 13 | 
             
                activemodel-serializers-xml (1.0.2)
         | 
| 14 14 | 
             
                  activemodel (> 5.x)
         | 
| 15 15 | 
             
                  activesupport (> 5.x)
         | 
| @@ -18,23 +18,23 @@ GEM | |
| 18 18 | 
             
                  activemodel (>= 5.0, < 7)
         | 
| 19 19 | 
             
                  activemodel-serializers-xml (~> 1.0)
         | 
| 20 20 | 
             
                  activesupport (>= 5.0, < 7)
         | 
| 21 | 
            -
                activesupport (6.1. | 
| 21 | 
            +
                activesupport (6.1.5)
         | 
| 22 22 | 
             
                  concurrent-ruby (~> 1.0, >= 1.0.2)
         | 
| 23 23 | 
             
                  i18n (>= 1.6, < 2)
         | 
| 24 24 | 
             
                  minitest (>= 5.1)
         | 
| 25 25 | 
             
                  tzinfo (~> 2.0)
         | 
| 26 26 | 
             
                  zeitwerk (~> 2.3)
         | 
| 27 | 
            -
                addressable (2. | 
| 27 | 
            +
                addressable (2.8.0)
         | 
| 28 28 | 
             
                  public_suffix (>= 2.0.2, < 5.0)
         | 
| 29 29 | 
             
                builder (3.2.4)
         | 
| 30 30 | 
             
                byebug (11.1.3)
         | 
| 31 31 | 
             
                coderay (1.1.2)
         | 
| 32 | 
            -
                concurrent-ruby (1.1. | 
| 32 | 
            +
                concurrent-ruby (1.1.10)
         | 
| 33 33 | 
             
                diff-lcs (1.3)
         | 
| 34 34 | 
             
                domain_name (0.5.20190701)
         | 
| 35 35 | 
             
                  unf (>= 0.0.5, < 1.0.0)
         | 
| 36 36 | 
             
                dotenv (2.7.6)
         | 
| 37 | 
            -
                ffi (1. | 
| 37 | 
            +
                ffi (1.15.5)
         | 
| 38 38 | 
             
                ffi-compiler (1.0.1)
         | 
| 39 39 | 
             
                  ffi (>= 1.0.0)
         | 
| 40 40 | 
             
                  rake
         | 
| @@ -58,19 +58,19 @@ GEM | |
| 58 58 | 
             
                  http-cookie (~> 1.0)
         | 
| 59 59 | 
             
                  http-form_data (~> 2.2)
         | 
| 60 60 | 
             
                  http-parser (~> 1.2.0)
         | 
| 61 | 
            -
                http-cookie (1.0. | 
| 61 | 
            +
                http-cookie (1.0.4)
         | 
| 62 62 | 
             
                  domain_name (~> 0.5)
         | 
| 63 63 | 
             
                http-form_data (2.3.0)
         | 
| 64 64 | 
             
                http-parser (1.2.3)
         | 
| 65 65 | 
             
                  ffi-compiler (>= 1.0, < 2.0)
         | 
| 66 | 
            -
                i18n (1. | 
| 66 | 
            +
                i18n (1.10.0)
         | 
| 67 67 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 68 | 
            -
                listen (3. | 
| 68 | 
            +
                listen (3.7.1)
         | 
| 69 69 | 
             
                  rb-fsevent (~> 0.10, >= 0.10.3)
         | 
| 70 70 | 
             
                  rb-inotify (~> 0.9, >= 0.9.10)
         | 
| 71 71 | 
             
                lumberjack (1.2.4)
         | 
| 72 72 | 
             
                method_source (1.0.0)
         | 
| 73 | 
            -
                minitest (5. | 
| 73 | 
            +
                minitest (5.15.0)
         | 
| 74 74 | 
             
                nenv (0.3.0)
         | 
| 75 75 | 
             
                notiffany (0.1.3)
         | 
| 76 76 | 
             
                  nenv (~> 0.1)
         | 
| @@ -83,7 +83,7 @@ GEM | |
| 83 83 | 
             
                  pry (~> 0.13.0)
         | 
| 84 84 | 
             
                public_suffix (4.0.6)
         | 
| 85 85 | 
             
                rake (12.3.3)
         | 
| 86 | 
            -
                rb-fsevent (0. | 
| 86 | 
            +
                rb-fsevent (0.11.1)
         | 
| 87 87 | 
             
                rb-inotify (0.10.1)
         | 
| 88 88 | 
             
                  ffi (~> 1.0)
         | 
| 89 89 | 
             
                rspec (3.9.0)
         | 
| @@ -105,8 +105,8 @@ GEM | |
| 105 105 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 106 106 | 
             
                unf (0.1.4)
         | 
| 107 107 | 
             
                  unf_ext
         | 
| 108 | 
            -
                unf_ext (0.0. | 
| 109 | 
            -
                zeitwerk (2.4 | 
| 108 | 
            +
                unf_ext (0.0.8.1)
         | 
| 109 | 
            +
                zeitwerk (2.5.4)
         | 
| 110 110 |  | 
| 111 111 | 
             
            PLATFORMS
         | 
| 112 112 | 
             
              ruby
         | 
| @@ -121,4 +121,4 @@ DEPENDENCIES | |
| 121 121 | 
             
              shiprocket_api!
         | 
| 122 122 |  | 
| 123 123 | 
             
            BUNDLED WITH
         | 
| 124 | 
            -
               2. | 
| 124 | 
            +
               2.3.8
         | 
| @@ -37,5 +37,16 @@ module ShiprocketAPI | |
| 37 37 | 
             
                  height: '',
         | 
| 38 38 | 
             
                  weight: ''
         | 
| 39 39 | 
             
                }
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                def generate_awb(courier_id:)
         | 
| 42 | 
            +
                  return false unless attributes['shipment_id'] && shipment_id != 0
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  self.awb = ::ShiprocketAPI::Awb.new(
         | 
| 45 | 
            +
                    shipment_id: shipment_id,
         | 
| 46 | 
            +
                    courier_id: courier_id,
         | 
| 47 | 
            +
                    is_return: 0
         | 
| 48 | 
            +
                  )
         | 
| 49 | 
            +
                  awb.save
         | 
| 50 | 
            +
                end
         | 
| 40 51 | 
             
              end
         | 
| 41 52 | 
             
            end
         | 
| @@ -5,6 +5,8 @@ module ShiprocketAPI | |
| 5 5 | 
             
                self.prefix += '/orders/create/return'
         | 
| 6 6 | 
             
                self.element_name = ''
         | 
| 7 7 |  | 
| 8 | 
            +
                has_many :order_items, class_name: 'ShiprocketAPI::OrderItem'
         | 
| 9 | 
            +
             | 
| 8 10 | 
             
                DEFAULT_ATTRS = {
         | 
| 9 11 | 
             
                  order_id: '',
         | 
| 10 12 | 
             
                  order_date: '',
         | 
| @@ -62,5 +64,16 @@ module ShiprocketAPI | |
| 62 64 | 
             
                    end
         | 
| 63 65 | 
             
                  end
         | 
| 64 66 | 
             
                end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                def generate_awb(courier_id:)
         | 
| 69 | 
            +
                  return false unless attributes['shipment_id'] && shipment_id != 0
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                  self.awb = ::ShiprocketAPI::Awb.new(
         | 
| 72 | 
            +
                    shipment_id: shipment_id,
         | 
| 73 | 
            +
                    courier_id: courier_id,
         | 
| 74 | 
            +
                    is_return: 1
         | 
| 75 | 
            +
                  )
         | 
| 76 | 
            +
                  awb.save
         | 
| 77 | 
            +
                end
         | 
| 65 78 | 
             
              end
         | 
| 66 79 | 
             
            end
         | 
| @@ -1,28 +1,19 @@ | |
| 1 | 
            -
            module  | 
| 2 | 
            -
              module  | 
| 3 | 
            -
                 | 
| 4 | 
            -
                   | 
| 1 | 
            +
            module ShiprocketAPI
         | 
| 2 | 
            +
              module Shared
         | 
| 3 | 
            +
                module OrderHelper
         | 
| 4 | 
            +
                  def generate_label
         | 
| 5 | 
            +
                    return false unless attributes['shipment_id'] && shipment_id != 0
         | 
| 5 6 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
                     | 
| 8 | 
            -
             | 
| 9 | 
            -
                    is_return: 1
         | 
| 10 | 
            -
                  )
         | 
| 11 | 
            -
                  awb.save
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                def generate_label
         | 
| 15 | 
            -
                  return false unless attributes['shipment_id'] && shipment_id != 0
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  self.label = ::ShiprocketAPI::Label.new(shipment_id: [shipment_id])
         | 
| 18 | 
            -
                  label.save
         | 
| 19 | 
            -
                end
         | 
| 7 | 
            +
                    self.label = ::ShiprocketAPI::Label.new(shipment_id: [shipment_id])
         | 
| 8 | 
            +
                    label.save
         | 
| 9 | 
            +
                  end
         | 
| 20 10 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 11 | 
            +
                  def create_pickup
         | 
| 12 | 
            +
                    return false unless attributes['shipment_id'] && shipment_id != 0
         | 
| 23 13 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 14 | 
            +
                    self.pickup = ::ShiprocketAPI::Pickup.new(shipment_id: [shipment_id])
         | 
| 15 | 
            +
                    pickup.save
         | 
| 16 | 
            +
                  end
         | 
| 26 17 | 
             
                end
         | 
| 27 18 | 
             
              end
         | 
| 28 19 | 
             
            end
         | 
    
        data/shiprocket_api.gemspec
    CHANGED
    
    | @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| | |
| 26 26 | 
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 27 27 | 
             
              spec.require_paths = ["lib"]
         | 
| 28 28 |  | 
| 29 | 
            -
              spec.add_dependency "activeresource", " | 
| 29 | 
            +
              spec.add_dependency "activeresource", ">= 4.1.0"
         | 
| 30 30 | 
             
              spec.add_dependency "http"
         | 
| 31 31 |  | 
| 32 32 | 
             
              spec.add_development_dependency "rspec", "~> 3.2"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,29 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: shiprocket_api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.5. | 
| 4 | 
            +
              version: 0.5.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andy Chong
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-04-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activeresource
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 19 | 
            +
                    version: 4.1.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 24 | 
            +
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version:  | 
| 26 | 
            +
                    version: 4.1.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: http
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 172 172 | 
             
                - !ruby/object:Gem::Version
         | 
| 173 173 | 
             
                  version: '0'
         | 
| 174 174 | 
             
            requirements: []
         | 
| 175 | 
            -
            rubygems_version: 3. | 
| 175 | 
            +
            rubygems_version: 3.2.32
         | 
| 176 176 | 
             
            signing_key:
         | 
| 177 177 | 
             
            specification_version: 4
         | 
| 178 178 | 
             
            summary: Ruby object based Sendle API wrapper.
         |