Skip to content
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

Dropping inventory items #5

Closed
coalwater opened this issue Jul 25, 2016 · 6 comments
Closed

Dropping inventory items #5

coalwater opened this issue Jul 25, 2016 · 6 comments

Comments

@coalwater
Copy link

I'm trying to do an api call that drops items from the inventory, I've used get_inventory and then filtered the items that I want to drop, then I created a call like this

client.recycle_inventory_item(201, 10)
client.call

but then I get this error

Poke::API::Errors::UnknownProtoFault: An unknown proto fault has occured => [uninitialized constant RpcSub::RecycleInventoryItemRequest @ /[gem_path]/gems/poke-api-0.0.2/lib/poke-api/request_builder.rb:87:in `fetch_proto_request_class']

Is this because the RpcSub needs to map all requests, or am I doing something wrong?

@nabeelamjad
Copy link
Owner

nabeelamjad commented Jul 26, 2016

It seems like neither RecycleInventoryItemRequest nor response is in rpc_sub.rb. I suspect the Proto files need to be updated, I'll need to have a look at this some point upcoming weekend (they all need updating to the new structure).

However, If you really want to get this working I've published a branch with this call working for you: https://github.com/nabeelamjad/poke-api/tree/RecycleInventory (you can run gem build poke-api.gemspec && gem install poke-api-0.0.2.gem to override your gem once you checkout/download that git branch, alternatively point Bundler at the branch instead).

The way you would invoke this is client.recycle_inventory_item(item_id: 201, count: 10) followed with client.call.

@coalwater
Copy link
Author

Ok thank you very much, will test and update you.
if you need help with your api I could give you some of my time, the problem is that I don't really understand how this protos part works, maybe if you could guide me to something to give me the basics to start.

@nabeelamjad
Copy link
Owner

nabeelamjad commented Jul 26, 2016

Have a look at this link: https://github.com/AeonLucid/POGOProtos/search?utf8=%E2%9C%93&q=recycle. I've gotten the proto files from there and simply added them to the existing structure (not too difficult, have a look at my commit). To generate proto files all you need to do is run the protoc command targeting the .proto files/directory. https://developers.google.com/protocol-buffers/docs/reference/ruby-generated goes into more detail about it, from there on you can simply use them by requiring the files and invoking the classes.

You will need to have protoc installed, instructions here: https://github.com/google/protobuf/blob/master/src/README.md.

@Icehawk78
Copy link

Is there a reason you don't/can't just compile the entirety of the POGOProtos and drop them in here?

Would the existing structure support doing that, or would that be a very large change, given that the proto files seem to be somewhat regularly being updated?

@nabeelamjad
Copy link
Owner

Compiling the protos is quite straight forward, I would need to make sure the existing structure still works with the new protos (it'll be a case of making sure all the class names match, etc)

@nabeelamjad
Copy link
Owner

@Icehawk78 @coalwater - New protobufs are now up and running, let me know if there are any issues.

I've tagged it as 0.0.3, if something does not work then revert to 0.0.2 and let me know. I've had to use b2c48b17b560dc3d259d50a8afa1ef4199170bc4 @ POGOProtos while also adding a missing import on GetIncensePokemonResponse.proto. I will use the very latest protobufs once that repository has been fixed (there's quite some stuff broken now apparently). We're only a couple commits behind however, so everything should be good.

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

No branches or pull requests

3 participants