Skip to content

Representation support#55

Open
Band-Aid wants to merge 5 commits into
cburnette:masterfrom
Band-Aid:Band-Aid-patch-1
Open

Representation support#55
Band-Aid wants to merge 5 commits into
cburnette:masterfrom
Band-Aid:Band-Aid-patch-1

Conversation

@Band-Aid

Copy link
Copy Markdown

No description provided.

@xhocquet xhocquet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Band-Aid I have a small suggestion, and then a couple more things:

  1. A test should be added for this
  2. Bumping the minor version for a new feature

Comment thread lib/boxr/files.rb
def representations(file_id,representation)
file_id = ensure_id(file_id)
uri = "#{FILES_URI}/#{file_id}?fields=representations"
file, response = get(uri, x_rep_hints: "#{representation}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to interpolate the string here? I don't see anything being added to it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest it's been a while since I wrote this and don't remember exactly why I implemented this this way. With that in mind which string value are you referencing?

Also, this method doesn't return the actual representation file, it only returns Representation Info
I've seen other SDK's that return the actual file, should we do the same?

https://github.com/box/box-node-sdk/blob/1d51f676b1323135891a70d470e2c9de97be9437/docs/files.md#get-representation-content

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that

x_rep_hints: "#{representation}"

could just be

x_rep_hints: representation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the representation content, I agree we should add it to the library. It should be a separate action where you have to specify the representation type, and we can use the identifiers Box has for these representations.

As for the method you've already implemented, I think it's still good since there's a separate endpoint to fetch a list of the representations.

If we want to fill out the feature, it seems we'll also want a method to hit the info.url in order to manually generate representations that were not automatically generated.

I'm fine breaking down this feature into multiple smaller parts, however.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... good point. I don't know why I added the additional string. I'll fix the code and also add tests.
We should probable breakdown the method to get the info.url endpoint.

@xhocquet

Copy link
Copy Markdown
Collaborator

Hey @Band-Aid , thanks for the PR. A couple of suggestions and we could get this merged!

modified:   lib/boxr/collaborations.rb
	modified:   lib/boxr/files.rb
	lib/boxr/intergations.rb
@xhocquet

Copy link
Copy Markdown
Collaborator

I was re-reviewing this code in anticipation for wrapping it up and releasing, but I think this implementation isn't quite ready. First off, the relevant docs: https://developer.box.com/en/guides/representations/

TODO:

  • Remove unrelated changes to collaborations
  • Remove app integration additions (can't find docs for this feature either)
  • representation method should be better named, and re-use existing file_from_id instead of re-implementing the same thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants