-
-
Save noeticpenguin/e02ca436ac555d319911 to your computer and use it in GitHub Desktop.
modules inheriting constants from classes that include them....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_get_request(restriction) | |
@hydra ||= ActiveCrowd::ACRest.new | |
[line 68] request = Typhoeus::Request.new("#{CROWD_URL}/#{SearchResource}#{restriction}", JSONGetOptions) | |
@hydra.queue(request) | |
@hydra.run | |
resp_hash = sanitize_crowd_results(JSON.parse(request.response.body)) | |
resp_hash['users'].to_json | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[6] pry(main)> f | |
=> #<User:0x007ff2a61075c0> | |
[7] pry(main)> User.ancestors | |
=> [User, | |
ActiveCrowd::User, | |
Object, | |
PP::ObjectMixin, | |
RSpec::Core::SharedExampleGroup, | |
JSON::Ext::Generator::GeneratorMethods::Object, | |
Kernel, | |
BasicObject] | |
[8] pry(main)> f.all | |
NameError: uninitialized constant CROWD_URL | |
from /ruby/active_crowd/lib/active_crowd/user.rb:68:in `make_get_request' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_crowd' | |
class User | |
include ActiveCrowd::User | |
############################################################################### | |
# Required Constants # | |
############################################################################### | |
#These can be loaded from a YML thusly: | |
# ConfigHash = YAML.load(File.read(Path/To/Yml/File))[ENV['RAILS_ENV']] | |
CROWD_URL = "http://10.4.0.151:8095/crowd" | |
CROWD_USER = "foo" | |
CROWD_PASS = "fighters" | |
end | |
f = User.new | |
binding.pry | |
ap f.all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment