GithubHelp home page GithubHelp logo

easypost-swift's People

Contributors

sachinvas avatar tomwfox avatar welbesw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

easypost-swift's Issues

Swift 4

Are you planning to update this to Swift 4? I may be able to update it and submit a pull request if you are unable to but I am by no means a Swift expert. Thanks ๐Ÿ˜ƒ

Customs

Hi @welbesw,

I have submitted a pull request to include the Customs information when creating the shipment request for international shipments. Can you please review and merge?

Rates returning nil on both Production & Test API Keys

Hi There!

Been using this awesome framework for the last couple of weeks in testing. When I first set it up, everything worked great, rates were returning & I was able to but shipments no problem. Now, a few weeks later, the rates are always returning nil. All the rest seems to be uploading properly... Any idea why the change? Here's my code:

func createShipment(addressFrom : addressStruct, addressTo : addressStruct, productToShip : packageInfoStruct, completion : @escaping (_ result : NSError?) -> ()) {
        let apiToken = "XXXXXXXXXXXXXX"
        EasyPostApi.sharedInstance.setCredentials(apiToken, baseUrl: "https://api.easypost.com/v2/")
        EasyPostApi.sharedInstance.postShipment(EasyPostAddress.init(jsonDictionary: addressTo.convertToAnyObject()!), fromAddress: EasyPostAddress.init(jsonDictionary: addressFrom.convertToAnyObject()!), parcel: EasyPostParcel.init(jsonDictionary: productToShip.convertToAnyObject()!)) { (shipment) in
            DispatchQueue.main.async {
                switch(shipment) {
                case .success(let shipment):
                    
                    print("Successfully posted shipment.")
                    
                    if let id = shipment.id {
                        print(shipment.rates)
                        EasyPostApi.sharedInstance.buyShipment(id, rateId: (shipment.rates.first?.id)!, completion: { (response) in
                            print(response)
                        })
                    }
                    
                case .failure(let error):
                    print("Error posting shipment: \((error as NSError).localizedDescription)")
                }
            }
        }
    }

I put a print statement in your code to figure out what the JSON it's returning looks like :

...
"rates": <__NSArray0 0x1c400fe40>(

)
...

Any help would be greatly appreciated! This doesn't seem to be an issue with your code, more of an issue with something with EasyPost or myself, but I'd love some help if you can. Thanks! :]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.