Closed brentdodell closed 6 years ago
We don't provide settings for the case out of the box.
As a simple solution, you can put a bunch of get params to kind of value object:
class BaseParams
def self.call
'?api_action=list_add&api_key=heres-my-key&other=query¶ms=go-here'
end
end
And merge it with ApiStruct::Client endpoint:
class Root < ApiStruct::Client
admin_api('api.php' + BaseParams.call)
end
I was reading about ApiStruct here and came across this description of it. And I had a question.
I am working on building a gem for an API in which v3 of the API is RESTful (but not fully built out yet, and still in beta), but v2 of the API is not RESTful at all. For the time being we're going with v2 until v3 is complete, but v2 requires an API key to be passed as a query param for ~each~ most requests. Is there a way to setup default params in the config that get merged in, rather than having to specify it in each Client file?
Also, the action must be specified as a query param. How best would I defined that? (i.e.
/admin/api.php?api_action=list_add&api_key=heres-my-key&other=query¶ms=go-here
).Thanks!