Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

price:country fails #217

Open sammachin opened 4 years ago

sammachin commented 4 years ago

Steps to reproduce

nexmo price:country US

Expected behavior

Returns a Price for SMS to the US

Actual behavior

Got a 404

It seems somewhere in history the pricing API was updated to support multiple types, sms sms-transit and voice, although nexmo-node seems to have been updated this command in the CLI hasn't. Its still a useful command as price:sms and price:voice require a phone number this allows searching by ISO country code eg US, GB etc.

Nexmo CLI v0.3.14

AlexLakatos commented 4 years ago

Thanks for filing this, I'll look into it.

efiShtain commented 3 years ago

@AlexLakatos Appears that there is a missing parameter in request.js line 41, the call to getPricing from nexmo

  priceCountry(country_code) {
    this.client.instance().number.getPricing(country_code, this.response.priceCountry.bind(this.response));
  }

the call is passing 2 parameters where as

 get(type, country, callback) {
    return this.options.rest.get(
      Pricing.PATH.replace("{endpoint}", "get-pricing").replace("{type}", type),
      { country },
      callback
    );
  }

in the nexmo-code repo is expecting 3 parameters (type is missing) If you can elaborate that I'll open a pull request and fix it (type should be sms I guess)