Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Undefined method `suggestions' for DuffelAPI::Client in Ruby Gem #90

Open
redareda9 opened this issue Mar 21, 2023 · 2 comments
Open

Undefined method `suggestions' for DuffelAPI::Client in Ruby Gem #90

redareda9 opened this issue Mar 21, 2023 · 2 comments

Comments

@redareda9
Copy link

Issue: Undefined method `suggestions' for DuffelAPI::Client in Ruby Gem

Description

When attempting to use the suggestions.all method for the DuffelAPI Ruby Gem, an error is thrown indicating that the suggestions method is undefined.

Steps to reproduce

  1. Create a new Ruby project
  2. Add the DuffelAPI Ruby Gem as a dependency
  3. Attempt to use the suggestions.all method as per the documentation.

Expected behavior

The suggestions.all method should be defined and return a response from the Duffel API.

Actual behavior

The following error is thrown:
12:48:45 web.1 | NoMethodError (undefined method `suggestions' for #<DuffelAPI::Client:0x0000000117734b88 @api_service=#<DuffelAPI::APIService:0x00000001177347f0 @base_url="https://api.duffel.com", @path_prefix="", @connection=#<Faraday::Connection:0x000000011772f3e0 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v2.7.4"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @manual_proxy=false, @builder=#<Faraday::RackBuilder:0x000000011772e198 @adapter=Faraday::Adapter::NetHttp, @handlers=[DuffelAPI::Middlewares::RateLimiter, DuffelAPI::Middlewares::RaiseDuffelErrors]>, @url_prefix=#<URI::HTTPS https://api.duffel.com/>, @proxy=nil>, @headers={"Duffel-Version"=>"v1", "User-Agent"=>"Duffel/v1 duffel_api_ruby/0.4.0", "Content-Type"=>"application/json", "Authorization"=>"Bearer duffel_test_yDzT_SR004Go8qHAmm3eNG9mj1jl4ngiHxHmHXIB1IX"}>> 12:48:45 web.1 | 12:48:45 web.1 | @places = client.suggestions.all(params: { 12:48:45 web.1 | ^^^^^^^^^^^^): 12:48:45 web.1 | 12:48:45 web.1 | app/controllers/places_controller.rb:5:in `search'

Additional Information

  • The documentation for the Duffel API suggests using the suggestions.all method in Ruby with no issues.
  • The error indicates that the method is undefined for the DuffelAPI::Client class.

Reproducible Demo

require "duffel_api"

duffel = DuffelAPI::Client.new(
  access_token: $YOUR_ACCESS_TOKEN
)

duffel.suggestions.all(params: {
  "query": "heathr"
})

System Information

Ruby version: 3.1.2p20
DuffelAPI Ruby Gem version: "0.4.0"

@ulissesalmeida
Copy link
Contributor

Hi @redareda9 , when you say "suggestions" do you mean the Places suggestions API?

@hoangnguyen1010
Copy link

hoangnguyen1010 commented Dec 16, 2023

@ulissesalmeida I faced the same issue, the cURL worked but not the suggestions method
image

I have a check on the source code and I don't think there is anything related to /paces/suggestion there 👀 . Did I miss something ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants