pwnalytics_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -69,17 +69,16 @@ class PwnalyticsClient
69
69
 
70
70
  # Returns an array of all Sites on this server.
71
71
  def sites
72
- request('/web_properties.json').map do |site|
73
- Site.new self, site['uid'], site['name']
72
+ request('/web_properties.json').map do |site_data|
73
+ Site.new self, site_data['uid'], site_data['name']
74
74
  end
75
75
  end
76
76
 
77
77
  # Returns the Site with the given UID.
78
78
  #
79
79
  # This method does a server request, to get additional property data.
80
- def property(uid)
81
- request('/web_property/#{uid}.json').map do |site|
82
- Site.new self, site['uid'], site['name']
83
- end
80
+ def site(uid)
81
+ site_data = request("/web_properties/#{uid}.json")
82
+ Site.new self, site_data['uid'], site_data['name']
84
83
  end
85
84
  end # class PwnalyticsClient
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pwnalytics_client}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Victor Costan"]
12
- s.date = %q{2011-04-13}
12
+ s.date = %q{2011-04-14}
13
13
  s.description = %q{Client library for pulling data from a Pwnalytics server}
14
14
  s.email = %q{victor@costan.us}
15
15
  s.extra_rdoc_files = [
@@ -12,9 +12,9 @@ describe PwnalyticsClient do
12
12
  response.should_not be_empty
13
13
  end
14
14
 
15
- let(:js_test) { response.find { |prop| prop['uid'] == 'AA123456' }}
15
+ let(:js_test) { response.find { |site| site['uid'] == 'AA123456' }}
16
16
 
17
- it 'should return the test property' do
17
+ it 'should return the test site' do
18
18
  js_test.should_not be_nil
19
19
  js_test['name'].should == 'Pwnalytics itself'
20
20
  end
@@ -29,6 +29,22 @@ describe PwnalyticsClient do
29
29
  it 'should report whether it uses SSL' do
30
30
  client.ssl.should == integration_server_data[:ssl]
31
31
  end
32
+
33
+ let(:sites) { client.sites }
34
+
35
+ describe 'sites' do
36
+ it 'should have at least one entry' do
37
+ sites.should_not be_empty
38
+ end
39
+ end
40
+
41
+ describe 'site' do
42
+ let(:uid) { sites.first.uid }
43
+
44
+ it 'should get data matching the sites call' do
45
+ client.site(uid).name.should == sites.first.name
46
+ end
47
+ end
32
48
  end
33
49
 
34
50
  describe 'with bad credentials' do
@@ -76,4 +92,6 @@ describe PwnalyticsClient do
76
92
  js_test.name.should == 'Pwnalytics itself'
77
93
  end
78
94
  end
95
+
96
+
79
97
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwnalytics_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Victor Costan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-13 00:00:00 Z
18
+ date: 2011-04-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement