Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7952931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:00:43+00:00 2026-06-04T03:00:43+00:00

I am trying to work in IRB to get an understanding for some code

  • 0

I am trying to work in IRB to get an understanding for some code that I found online.

I am able to require a file which eventually imports this file:

module LinkedIn
  module Api

    logger.debug "....7"

    module QueryMethods

      logger.debug "....6"

      def profile(options={})
        logger.debug "....1"
        path = person_path(options)
        simple_query(path, options)
      end

      def connections(options={})
        path = "#{person_path(options)}/connections"
        simple_query(path, options)
      end

      def network_updates(options={})
        path = "#{person_path(options)}/network/updates"
        simple_query(path, options)
      end

      def company(options = {})
        path   = company_path(options)
        simple_query(path, options)
      end

      def test(options = {})
         logger.debug "helllllooooo"
      end

      private
      logger.debug "....2"
        def simple_query(path, options={})
          logger.debug "....3"
          fields = options.delete(:fields) || LinkedIn.default_profile_fields

          if options.delete(:public)
            path +=":public"
          elsif fields
            path +=":(#{fields.map{ |f| f.to_s.gsub("_","-") }.join(',')})"
          end

          headers = options.delete(:headers) || {}
          params  = options.map { |k,v| "#{k}=#{v}" }.join("&")
          path   += "?#{params}" if not params.empty?

          Mash.from_json(get(path, headers))
        end

        def person_path(options)
          logger.debug "....4"
          path = "/people/"
          if id = options.delete(:id)
            path += "id=#{id}"
          elsif url = options.delete(:url)
            path += "url=#{CGI.escape(url)}"
          else
            path += "~"
          end
        end

        def company_path(options)
          path = "/companies/"
          if id = options.delete(:id)
            path += "id=#{id}"
          elsif url = options.delete(:url)
            path += "url=#{CGI.escape(url)}"
          elsif name = options.delete(:name)
            path += "universal-name=#{CGI.escape(name)}"
          elsif domain = options.delete(:domain)
            path += "email-domain=#{CGI.escape(domain)}"
          else
            path += "~"
          end
        end

    end

  end
end

This code is a wrapper for LinkedIn and I found it here: https://github.com/pengwynn/linkedin/blob/master/lib/linked_in/api/query_methods.rb

It is mostly off the shelf, but this test bit is mine:

  def test(options = {})
     logger.debug "helllllooooo"
  end

I copied these files locally, and in IRB I can perform some commands, but I can not for some reason do something like client.test whereas I can do something like client.profile.

Also none of the debug statements show up in IRB. Do I have to start IRB with some sort of a flag to see the debug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:00:45+00:00Added an answer on June 4, 2026 at 3:00 am

    logger is part of rails

    irb is just a ruby command line interpreter

    use ‘rails console’ to get a command line interface with the rails infrastructure running.

    use puts as a substitute for logger while using irb

    EDIT

    You’ll never get anywhere trying to run that code in irb, instead, copy your file to yourapp/lib, then do a

    rails console

    Now RAILS is booted up, but with a command line interface, then try

    include LinkedIn::Api::QueryMethods

    test

    now you can also use logger.debug

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get some gems working on a web-host which supports ruby and
I'm trying to work out some regex that will eliminate all of the special
I've been trying to get a ruby file to require another ruby file and
I'm trying to include a source code file when I run irb but irb
Trying to work with groupby so that I can group together files that were
Im trying to work out how to get the value from one setting in
I am trying to work through some questions and im not sure how to
just trying to work my way around using Redemption; I've got the following code
I'm trying work with time data regarding the duration of several experiments. That data
Trying to work out a map reduce on mongo that would use field value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.