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

Do not use global variables, use constants #10

Open
greyblake opened this issue Oct 13, 2015 · 0 comments
Open

Do not use global variables, use constants #10

greyblake opened this issue Oct 13, 2015 · 0 comments

Comments

@greyblake
Copy link

In general it's a bad practise.

require 'figo'

$api_endpoint
 => "api.figo.me" 

$valid_fingerprints
 => ["3A:62:54:4D:86:B4:34:38:EA:34:64:4E:95:10:A9:FF:37:27:69:C0", "CF:C1:BC:7F:6A:16:09:2B:10:83:8A:B0:22:4F:3A:65:D2:70:D7:3E"]

Also the names are not prefixed, some potentially some other libary can introduce $api_endpoint variable, what can result into errors.

It's better to use constants:

module Figo
  API_ENDPOINT = "api.figo.me".freeze
  VALID_FINGERPRINTS = [
    "3A:62:54:4D:86:B4:34:38:EA:34:64:4E:95:10:A9:FF:37:27:69:C0",
    "CF:C1:BC:7F:6A:16:09:2B:10:83:8A:B0:22:4F:3A:65:D2:70:D7:3E"
  ].freeze
end
emaserafini pushed a commit that referenced this issue Sep 6, 2019
* Write payments endpoints

* Fix tipo test

* Add endpoint to retreive payment initiation status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant