Sha256: c7c0af8f714df722567ee587b9ae22547cddb25a7f239c0c9b32f348b2c5abb4

Contents?: true

Size: 637 Bytes

Versions: 5

Compression:

Stored size: 637 Bytes

Contents

require "gorails"
require "net/http"
require "json"

module Gorails
  module Commands
    class Jobs < Gorails::Command
      def call(_args, _name)
        jobs = JSON.parse Net::HTTP.get(URI("https://jobs.gorails.com/jobs.json"))

        CLI::UI::Frame.open("Ruby on Rails jobs") do
          jobs.each do |job|
            puts CLI::UI.fmt "{{green:#{job["title"]}}} at {{blue:#{job.dig("company", "name")}}}"
            puts job["url"]
            puts
          end
        end
      end

      def self.help
        "View the latest Ruby on Rails jobs.\nUsage: {{command:#{Gorails::TOOL_NAME} jobs}}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gorails-0.1.5 lib/gorails/commands/jobs.rb
gorails-0.1.4 lib/gorails/commands/jobs.rb
gorails-0.1.3 lib/gorails/commands/jobs.rb
gorails-0.1.2 lib/gorails/commands/jobs.rb
gorails-0.1.1 lib/gorails/commands/jobs.rb