Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

parse the api outputs into correct Ruby objects + some cleanup #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

snicky
Copy link

@snicky snicky commented Feb 1, 2014

wow much revised pls merge

@tekknolagi
Copy link
Owner

Hmm why this? Why not just a simple wrapper? As it is, it's a good intermediary.

@snicky
Copy link
Author

snicky commented Feb 1, 2014

I agree with the idea of a simply wrapper, although I can't really imagine a situation in which somebody would need outputs like:

> doge_api.get_my_addresses
=> "[\"DJsRoMLeJxZTSxR9p5tJbUTPyajtUjJRYJ\",\"DFWTu9AggP4erazZQe93FRe51Czxz47bQk\",\"D7uHhk8ZHntySNMaaJ63vXh5omhY3EuBS3\",\"DKYhX9rgwcyTiiiX83pvKtkvpWhPNJsgBd\"]"

or:

> doge_api.get_balance
=> "\"0\""

@tekknolagi
Copy link
Owner

That's true, but the only reason it's being escaped is because you're not
printing it out -- just returning it. It'll return a JSON array or simply a
string.

On Sat, Feb 1, 2014 at 10:18 AM, Mariusz [email protected] wrote:

I agree with the idea of a simply wrapper, although I can't really image a
situation in which somebody would really need outputs like:

doge_api.get_my_addresses=> "["DJsRoMLeJxZTSxR9p5tJbUTPyajtUjJRYJ","DFWTu9AggP4erazZQe93FRe51Czxz47bQk","D7uHhk8ZHntySNMaaJ63vXh5omhY3EuBS3","DKYhX9rgwcyTiiiX83pvKtkvpWhPNJsgBd"]"

or:

doge_api.get_balance=> ""0""

Reply to this email directly or view it on GitHubhttps://github.com//pull/1#issuecomment-33879143
.

@snicky
Copy link
Author

snicky commented Feb 2, 2014

You are right, I might misunderstood the intended use of this gem. In my case, I want to call the DogeAPI and get some variables that I could later store (like the list of addresses) or use for processing (account balance, etc.), which means that the outputs I expect need to be integers, floats, strings and arrays. Then I guess I can keep my fork separately and use it when needed, unless maybe you can suggest a better solution for this use case?

@tekknolagi
Copy link
Owner

I think in this case, there could definitely be a flag to parse into Ruby objects.

Alternatively, there could be some route grouping by return type (as you proposed)... though I'm not sure I'm fond of the proposed changes in:

snicky@4135591
snicky@4422601

Questions:

  1. Why CONSTANTS as opposed to @class_variables?
  2. Why spacing changes?
  3. Why quote trimming?
  4. Is there code between chain.rb and api.rb that could be reused?

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

Successfully merging this pull request may close these issues.

2 participants