authentic_jobs 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -28,6 +28,13 @@ Find your next gig from the console! This is a Ruby wrapper for the [AuthenticJo
28
28
 
29
29
  categories = client.categories
30
30
 
31
+
32
+ The categories, types, and locations methods are all cached after the first call. To refresh, simply add a bang:
33
+
34
+ client.categories!
35
+ client.types!
36
+ client.locations!
37
+
31
38
  All calls return a [Hashie::Mash](http://github.com/intridea/hashie) and support dot-notation.
32
39
 
33
40
  ## Note on Patches/Pull Requests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -0,0 +1,78 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{authentic_jobs}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Wynn Netherland"]
12
+ s.date = %q{2009-12-20}
13
+ s.description = %q{Ruby wrapper for the Authentic Jobs API}
14
+ s.email = %q{wynn.netherland@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.markdown",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "authentic_jobs.gemspec",
27
+ "changelog.markdown",
28
+ "examples/search.rb",
29
+ "lib/authentic_jobs.rb",
30
+ "test/fixtures/categories.json",
31
+ "test/fixtures/companies.json",
32
+ "test/fixtures/error.json",
33
+ "test/fixtures/locations.json",
34
+ "test/fixtures/search.json",
35
+ "test/fixtures/types.json",
36
+ "test/helper.rb",
37
+ "test/test_authentic_jobs.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/pengwynn/authentic_jobs}
40
+ s.rdoc_options = ["--charset=UTF-8"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.3.5}
43
+ s.summary = %q{Ruby wrapper for the Authenic Jobs API}
44
+ s.test_files = [
45
+ "test/helper.rb",
46
+ "test/test_authentic_jobs.rb",
47
+ "examples/search.rb"
48
+ ]
49
+
50
+ if s.respond_to? :specification_version then
51
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<hashie>, ["~> 0.1.3"])
56
+ s.add_runtime_dependency(%q<httparty>, ["~> 0.4.5"])
57
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.1"])
58
+ s.add_development_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
59
+ s.add_development_dependency(%q<mocha>, ["= 0.9.4"])
60
+ s.add_development_dependency(%q<fakeweb>, [">= 1.2.5"])
61
+ else
62
+ s.add_dependency(%q<hashie>, ["~> 0.1.3"])
63
+ s.add_dependency(%q<httparty>, ["~> 0.4.5"])
64
+ s.add_dependency(%q<shoulda>, [">= 2.10.1"])
65
+ s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
66
+ s.add_dependency(%q<mocha>, ["= 0.9.4"])
67
+ s.add_dependency(%q<fakeweb>, [">= 1.2.5"])
68
+ end
69
+ else
70
+ s.add_dependency(%q<hashie>, ["~> 0.1.3"])
71
+ s.add_dependency(%q<httparty>, ["~> 0.4.5"])
72
+ s.add_dependency(%q<shoulda>, [">= 2.10.1"])
73
+ s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
74
+ s.add_dependency(%q<mocha>, ["= 0.9.4"])
75
+ s.add_dependency(%q<fakeweb>, [">= 1.2.5"])
76
+ end
77
+ end
78
+
@@ -30,14 +30,23 @@ class AuthenticJobs
30
30
  self.api_key = api_key
31
31
  end
32
32
 
33
- def companies
33
+ def companies!
34
34
  mashup(self.class.get("/", :query => method_params('aj.jobs.getCompanies'))).companies.company
35
35
  end
36
36
 
37
- def locations
37
+ def companies
38
+ @companies ||= companies!
39
+ end
40
+
41
+ def locations!
38
42
  mashup(self.class.get("/", :query => method_params('aj.jobs.getLocations'))).locations.location
39
43
  end
40
44
 
45
+ def locations
46
+ @locations ||= locations!
47
+ end
48
+
49
+
41
50
  # category: The id of a job category to limit to. See aj.categories.getList
42
51
  # type: The id of a job type to limit to. See aj.types.getList
43
52
  # sort: Accepted values are: date-posted-desc (the default) and date-posted-asc
@@ -50,13 +59,21 @@ class AuthenticJobs
50
59
  mashup(self.class.get("/", :query => method_params('aj.jobs.search', options))).listings.listing
51
60
  end
52
61
 
53
- def types
62
+ def types!
54
63
  mashup(self.class.get("/", :query => method_params('aj.types.getList'))).types['type']
55
64
  end
56
65
 
57
- def categories
66
+ def types
67
+ @types ||= types!
68
+ end
69
+
70
+ def categories!
58
71
  mashup(self.class.get("/", :query => method_params('aj.categories.getList'))).categories.category
59
72
  end
73
+
74
+ def categories
75
+ @categories ||= categories!
76
+ end
60
77
 
61
78
 
62
79
  private
@@ -10,40 +10,40 @@ class TestAuthenticJobs < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  should "return a list of companies" do
13
- stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.jobs.getCompanies", "companies.json")
13
+ stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.jobs.getCompanies&format=json", "companies.json")
14
14
  companies = @client.companies
15
15
  companies.first.name.should == 'Adura Technologies, Inc.'
16
16
  companies.first.location.state.should == 'CA'
17
17
  end
18
18
 
19
19
  should "return a list of locations" do
20
- stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.jobs.getLocations", "locations.json")
20
+ stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.jobs.getLocations&format=json", "locations.json")
21
21
  locations = @client.locations
22
22
  locations.first.name.should == 'Anywhere in USA'
23
23
  locations.first.id.should == 'anywhereinusa'
24
24
  end
25
25
 
26
26
  should "return a listings via search" do
27
- stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.jobs.search", "search.json")
27
+ stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.jobs.search&format=json", "search.json")
28
28
  listings = @client.search
29
29
  listings.first.title.should == 'Interactive Art Designer'
30
30
  listings.first.company.name.should == 'Bazaarvoice'
31
31
  end
32
32
 
33
33
  should "return a list of job types" do
34
- stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.types.getList", "types.json")
34
+ stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.types.getList&format=json", "types.json")
35
35
  types = @client.types
36
36
  types.last.name.should == 'Freelance'
37
37
  end
38
38
 
39
39
  should "return a list of job categories" do
40
- stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.categories.getList", "categories.json")
40
+ stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.categories.getList&format=json", "categories.json")
41
41
  categories = @client.categories
42
42
  categories.first.name.should == 'Design'
43
43
  end
44
44
 
45
45
  should "handle error codes" do
46
- stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.categories.getList", "error.json")
46
+ stub_get("http://www.authenticjobs.com/api/?api_key=OU812&method=aj.categories.getList&format=json", "error.json")
47
47
  lambda {@client.categories}.should raise_error(AuthenticJobsError)
48
48
  end
49
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentic_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-19 00:00:00 -06:00
12
+ date: 2009-12-20 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -88,6 +88,7 @@ files:
88
88
  - README.markdown
89
89
  - Rakefile
90
90
  - VERSION
91
+ - authentic_jobs.gemspec
91
92
  - changelog.markdown
92
93
  - examples/search.rb
93
94
  - lib/authentic_jobs.rb