-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GlobalStorage API support #4
base: master
Are you sure you want to change the base?
Conversation
…e_code Add GlobalStorage API and update code style
This update has a breaking change - the Monday::Client API requests are now returning hashes instead of strings (so we don't need to do |
.rspec_status
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need the file in repo?
MONDAY_API_URL = "#{MONDAY_PROTOCOL}://api.#{MONDAY_DOMAIN}/v2".freeze | ||
MONDAY_OAUTH_URL = "#{MONDAY_PROTOCOL}://auth.#{MONDAY_DOMAIN}/oauth2/authorize".freeze | ||
MONDAY_OAUTH_TOKEN_URL = "#{MONDAY_PROTOCOL}://auth.#{MONDAY_DOMAIN}/oauth2/token".freeze | ||
MONDAY_STORAGE_URL = "#{MONDAY_PROTOCOL}://apps-storage.#{MONDAY_DOMAIN}/app_storage_api/v2".freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the new API endpoint
# | ||
# @param token [String] The users access token (permanent or short-lived) used for API requests. | ||
# @param connection [Faraday::Connection] An existing Faraday connection to be used for the requests. | ||
def initialize(token: nil, api: nil, conn: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialization designed to be the same as for Monday::Client
full_url = "#{api_domain}/#{URI.encode_www_form_component(key)}" | ||
return full_url unless shared | ||
|
||
"#{full_url}?shareGlobally=true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query string came from the original JS library
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should resolve the documentation issue
|
||
client.response :raise_error | ||
client.response :json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should parse JSON in the middleware, to avoid doing this by ourselves
|
||
def api_request(url, conn, data, token) | ||
res = conn.post(url, data, 'Authorization' => token, 'Content-Type' => 'application/json') | ||
res.body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we have a valid ruby hash, we do not need to convert it to JSON string again
…_value [feature] add #get_parsed_value method for storage
[feature] add ability to pass API version to monday
Bump Gem Version
In order to add new GlobalStorage API support there are such updates:
2.x
)