dice-ruby 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/dice-ruby.rb +3 -0
- data/lib/dice/client.rb +33 -0
- data/lib/dice/result.rb +13 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 62b553fc28d04827c2a3a83680bc6a4e3a74040c
|
4
|
+
data.tar.gz: d3827942eadd52ac25a3c49490a693936df8be1b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aeccaaaa2939c9128e393a1511ea168b9e9775f2de3505d034c8152d81900cadfe25e20121c4f3f1abfcd5f1736384af4f068cd5df5f2dcc0996c0a4dc0aeaf1
|
7
|
+
data.tar.gz: 2cdd65f261d2d4201cdfe172dcdf1c1503707c16883326baab3d22754903d86a07b40cd17fe45e83ffe650da4c10e9584607706a596bb8bfd60a3a66d558e00c
|
data/lib/dice-ruby.rb
ADDED
data/lib/dice/client.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'dice/result'
|
3
|
+
|
4
|
+
module Dice
|
5
|
+
class Client
|
6
|
+
include HTTParty
|
7
|
+
base_uri 'http://service.dice.com/api/rest/jobsearch/v1/simple.json'
|
8
|
+
#attr_reader :uri, :options
|
9
|
+
|
10
|
+
attr_accessor :text, :area_coode, :country, :state, :skill, :city, :text, :page
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
self.text = options[:text] || ''
|
14
|
+
self.area_coode = options[:area_coode] || ''
|
15
|
+
self.country = options[:country] || ''
|
16
|
+
self.state = options[:state] || ''
|
17
|
+
self.skill = options[:skill] || ''
|
18
|
+
self.city = options[:city] || ''
|
19
|
+
self.text = options[:text] || ''
|
20
|
+
self.page = options[:page] || ''
|
21
|
+
end
|
22
|
+
|
23
|
+
def search
|
24
|
+
results = []
|
25
|
+
self.class.get(encoded_uri)['resultItemList'].map { |data| results << Dice::Result.new(data: data) }
|
26
|
+
results
|
27
|
+
end
|
28
|
+
|
29
|
+
def encoded_uri
|
30
|
+
URI.encode("?text=#{self.text}&areacode=#{self.area_coode}&country=#{self.country}&state=#{self.state}&skill=#{self.skill}&city=#{self.city}&page=#{self.page}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/dice/result.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dice
|
2
|
+
class Result
|
3
|
+
attr_accessor :url, :title, :company, :location, :date
|
4
|
+
|
5
|
+
def initialize(attrs = {})
|
6
|
+
self.url = attrs[:data]['detailUrl']
|
7
|
+
self.title = attrs[:data]['jobTitle']
|
8
|
+
self.company = attrs[:data]['company']
|
9
|
+
self.location = attrs[:data]['location']
|
10
|
+
self.date = attrs[:data]['date']
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dice-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Fellows
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: An easy way to parse jobs on Dice.com
|
14
|
+
email: michael@broadwaylab.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/dice-ruby.rb
|
20
|
+
- lib/dice/client.rb
|
21
|
+
- lib/dice/result.rb
|
22
|
+
homepage: http://github.com/broadwaylab/dice-ruby
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.4.6
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: A gem for parsing jobs on Dice.com
|
46
|
+
test_files: []
|