lonely_coder 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe "pagination" do
4
4
  before(:each) do
5
- VCR.use_cassette('paginate_search_results', :erb => {:username => ENV['OKC_USERNAME'], :password => ENV['OKC_PASSWORD']}) do
6
- @search = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD']).search({
5
+ VCR.use_cassette('paginate_search_results_by_10', :erb => {:username => ENV['OKC_USERNAME'], :password => ENV['OKC_PASSWORD']}) do
6
+ okc = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD'])
7
+
8
+ @search = okc.search({
7
9
  gentation: 'girls who like guys'
8
10
  })
9
11
  @search.results
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Paginator" do
4
+ before(:each) do
5
+ @page = OKCupid::Paginator.new({
6
+ page: 1,
7
+ per_page: 5
8
+ })
9
+ end
10
+
11
+ it "paramiterizes itself" do
12
+ @page.to_param.should == "low=1&count=5"
13
+ end
14
+
15
+ it "stores the current page" do
16
+ @page.page.should == 1
17
+ end
18
+
19
+ it "stores the per page value" do
20
+ @page.per_page.should == 5
21
+ end
22
+
23
+ it "low is lowest item number for the current page" do
24
+ @page.low.should == 1
25
+ end
26
+
27
+ describe "incrementing" do
28
+ before(:each) do
29
+ @page.next
30
+ end
31
+
32
+ it "incremens the current page" do
33
+ @page.page.should == 2
34
+ end
35
+
36
+ it "low is lowest item number for the current page" do
37
+ @page.low.should == 6
38
+ end
39
+
40
+ it "updates the params itself" do
41
+ @page.to_param.should == "low=6&count=5"
42
+ end
43
+ end
44
+ end
data/spec/profile_spec.rb CHANGED
@@ -126,7 +126,7 @@ end
126
126
 
127
127
  describe "Profile from search result" do
128
128
  before(:each) do
129
- VCR.use_cassette('search_by_filters', :erb => {:username => ENV['OKC_USERNAME'], :password => ENV['OKC_PASSWORD']}) do
129
+ VCR.use_cassette('load_profile_from_search', :erb => {:username => ENV['OKC_USERNAME'], :password => ENV['OKC_PASSWORD']}) do
130
130
  @profile = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD']).search({
131
131
  gentation: 'girls who like guys'
132
132
  }).results.first
@@ -134,23 +134,23 @@ describe "Profile from search result" do
134
134
  end
135
135
 
136
136
  it "has a username" do
137
- @profile.username.should == 'a2girl77'
137
+ @profile.username.should == 'Misha862'
138
138
  end
139
139
 
140
140
  it "has an age" do
141
- @profile.age.should == '34'
141
+ @profile.age.should == '35'
142
142
  end
143
143
 
144
144
  it "has a match %" do
145
- @profile.match.should == 92
145
+ @profile.match.should == 95
146
146
  end
147
147
 
148
148
  it "has a friend %" do
149
- @profile.friend.should == 82
149
+ @profile.friend.should == 73
150
150
  end
151
151
 
152
152
  it "has an enemy %" do
153
- @profile.enemy.should == 0
153
+ @profile.enemy.should == 4
154
154
  end
155
155
 
156
156
  it "has a location" do
@@ -158,7 +158,7 @@ describe "Profile from search result" do
158
158
  end
159
159
 
160
160
  it "has a small avatar url" do
161
- @profile.small_avatar_url.should == 'http://ak0.okccdn.com/php/load_okc_image.php/images/82x82/82x82/126x67/497x439/2/5607892676107173868.jpeg'
161
+ @profile.small_avatar_url.should == 'http://ak2.okccdn.com/php/load_okc_image.php/images/82x82/82x82/14x56/323x365/2/853930758706783150.jpeg'
162
162
  end
163
163
 
164
164
  it "has a sex" do
data/spec/search_spec.rb CHANGED
@@ -24,7 +24,7 @@ describe "Search" do
24
24
  :radius => 25, # acceptable values are 25, 50, 100, 250, 500
25
25
  :require_photo => false,
26
26
  :relationship_status => 'any'
27
- }).url.should =='/match?matchOrderBy=MATCH&filter2=5,315360000&locid=0&filter4=3,25&filter5=1,0&filter6=35,0&filter7=0,20&filter8=2,33,34'
27
+ }).url.should =='/match?filter1=5,315360000&filter2=3,25&filter3=1,0&filter4=35,0&filter5=0,20&filter6=2,33,34&low=1&count=10&matchOrderBy=MATCH&locid=0&timekey=1&custom_search=0'
28
28
  end
29
29
  end
30
30
  end
@@ -60,7 +60,7 @@ describe "Filters" do
60
60
  end
61
61
 
62
62
  it "custom filters: order_by" do
63
- OKCupid::OrderByFilter.new('order_by', 'Match %').to_param(1).should == 'matchOrderBy=MATCH'
63
+ OKCupid::OrderByParameter.new('Match %').to_param.should == 'matchOrderBy=MATCH'
64
64
  end
65
65
 
66
66
  it "custom filters: age" do
@@ -87,15 +87,15 @@ describe "Filters" do
87
87
 
88
88
  describe 'custom filters: location' do
89
89
  it "can use the 'near me' value" do
90
- OKCupid::LocationFilter.new('location', 'Near me').to_param(1).should == 'locid=0'
90
+ OKCupid::LocationParameter.new('Near me').to_param.should == 'locid=0'
91
91
  end
92
92
 
93
93
  it 'can use a location query' do
94
- OKCupid::LocationFilter.new('location', 'Cincinnati, Ohio').to_param(1).should == 'lquery=Cincinnati,%20Ohio'
94
+ OKCupid::LocationParameter.new('Cincinnati, Ohio').to_param.should == 'lquery=Cincinnati,%20Ohio'
95
95
  end
96
96
 
97
97
  it "can use a location_id" do
98
- OKCupid::LocationFilter.new('location', 4335338).to_param(1).should == 'locid=4335338'
98
+ OKCupid::LocationParameter.new(4335338).to_param.should == 'locid=4335338'
99
99
  end
100
100
  end
101
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lonely_coder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-24 00:00:00.000000000 Z
12
+ date: 2012-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.0
21
+ version: 2.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 2.0.0
29
+ version: 2.0.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 3.2.1
46
- description: ''
46
+ description: A gem for interacting with OKCupid as if it had an API.
47
47
  email:
48
48
  - trek.glowacki@gmail.com
49
49
  executables: []
@@ -51,7 +51,6 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
53
  - Gemfile
54
- - Gemfile.lock
55
54
  - README.mdown
56
55
  - lib/lonely_coder.rb
57
56
  - lib/lonely_coder/authentication.rb
@@ -59,16 +58,19 @@ files:
59
58
  - lib/lonely_coder/profile.rb
60
59
  - lib/lonely_coder/search.rb
61
60
  - lib/lonely_coder/search_pagination_parser.rb
61
+ - lonely_coder.gemspec
62
62
  - spec/authentication_spec.rb
63
63
  - spec/cassettes/failed_authentication.yml
64
64
  - spec/cassettes/find_location.yml
65
- - spec/cassettes/paginate_search_results.yml
65
+ - spec/cassettes/load_profile_from_search.yml
66
+ - spec/cassettes/paginate_search_results_by_10.yml
66
67
  - spec/cassettes/search_by_filters.yml
67
68
  - spec/cassettes/search_by_username.yml
68
69
  - spec/cassettes/successful_authentication.yml
69
70
  - spec/helper_spec.rb
70
71
  - spec/location_id_spec.rb
71
72
  - spec/pagination_spec.rb
73
+ - spec/paginator_spec.rb
72
74
  - spec/profile_spec.rb
73
75
  - spec/search_spec.rb
74
76
  - spec/spec_helper.rb
@@ -96,18 +98,20 @@ rubyforge_project:
96
98
  rubygems_version: 1.8.21
97
99
  signing_key:
98
100
  specification_version: 3
99
- summary: ''
101
+ summary: A gem for interacting with OKCupid as if it had an API
100
102
  test_files:
101
103
  - spec/authentication_spec.rb
102
104
  - spec/cassettes/failed_authentication.yml
103
105
  - spec/cassettes/find_location.yml
104
- - spec/cassettes/paginate_search_results.yml
106
+ - spec/cassettes/load_profile_from_search.yml
107
+ - spec/cassettes/paginate_search_results_by_10.yml
105
108
  - spec/cassettes/search_by_filters.yml
106
109
  - spec/cassettes/search_by_username.yml
107
110
  - spec/cassettes/successful_authentication.yml
108
111
  - spec/helper_spec.rb
109
112
  - spec/location_id_spec.rb
110
113
  - spec/pagination_spec.rb
114
+ - spec/paginator_spec.rb
111
115
  - spec/profile_spec.rb
112
116
  - spec/search_spec.rb
113
117
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,58 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- lonely_coder (0.1.0)
5
- activesupport (>= 3.2.1)
6
- mechanize (>= 2.0.0)
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activesupport (3.2.2)
12
- i18n (~> 0.6)
13
- multi_json (~> 1.0)
14
- addressable (2.2.7)
15
- crack (0.3.1)
16
- diff-lcs (1.1.3)
17
- domain_name (0.5.2)
18
- unf (~> 0.0.3)
19
- i18n (0.6.0)
20
- mechanize (2.3)
21
- domain_name (~> 0.5, >= 0.5.1)
22
- mime-types (~> 1.17, >= 1.17.2)
23
- net-http-digest_auth (~> 1.1, >= 1.1.1)
24
- net-http-persistent (~> 2.5, >= 2.5.2)
25
- nokogiri (~> 1.4)
26
- ntlm-http (~> 0.1, >= 0.1.1)
27
- webrobots (~> 0.0, >= 0.0.9)
28
- mime-types (1.18)
29
- multi_json (1.1.0)
30
- net-http-digest_auth (1.2)
31
- net-http-persistent (2.5.2)
32
- nokogiri (1.5.2)
33
- ntlm-http (0.1.1)
34
- rspec (2.9.0)
35
- rspec-core (~> 2.9.0)
36
- rspec-expectations (~> 2.9.0)
37
- rspec-mocks (~> 2.9.0)
38
- rspec-core (2.9.0)
39
- rspec-expectations (2.9.0)
40
- diff-lcs (~> 1.1.3)
41
- rspec-mocks (2.9.0)
42
- unf (0.0.5)
43
- unf_ext
44
- unf_ext (0.0.4)
45
- vcr (2.0.0)
46
- webmock (1.8.4)
47
- addressable (>= 2.2.7)
48
- crack (>= 0.1.7)
49
- webrobots (0.0.13)
50
-
51
- PLATFORMS
52
- ruby
53
-
54
- DEPENDENCIES
55
- lonely_coder!
56
- rspec
57
- vcr
58
- webmock