getclicky 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,11 +11,10 @@ Gem::Specification.new do |s|
11
11
  s.summary = %q{Ruby Wrapper for GetClicky API Analytics}
12
12
  s.description = s.summary
13
13
 
14
- s.add_dependency "httparty" , "~> 0.8.0"
15
- s.add_dependency "hashie" , "~> 1.1.0"
16
- s.add_development_dependency "rspec" , "~> 2.6"
17
- s.add_development_dependency "test_notifier", "~> 0.3"
18
- s.add_development_dependency "fakeweb" , "~> 1.3"
14
+ s.add_dependency "hashie" , "~> 1.2.0"
15
+ s.add_development_dependency "rspec" , "~> 2.8"
16
+ s.add_development_dependency "test_notifier", "~> 1.0.0"
17
+ s.add_development_dependency "fakeweb" , "~> 1.3.0"
19
18
  s.add_development_dependency "ruby-debug19" , "~> 0.11"
20
19
 
21
20
  s.files = `git ls-files`.split("\n")
@@ -12,6 +12,9 @@ module Getclicky
12
12
  RUBY
13
13
  end
14
14
 
15
+ # Retrieves a request with lot of parameters
16
+ # See documentation for more info
17
+ #
15
18
  def multiple(types = [], params = {})
16
19
  valid_types = types.reject { |t| !Getclicky::Types::ALL.include?(t.intern) }
17
20
  response = Getclicky::Request.new(valid_types.join(','), params).get
@@ -1,7 +1,8 @@
1
+ require "net/http"
2
+ require "uri"
3
+
1
4
  module Getclicky
2
- class Request
3
- include HTTParty
4
-
5
+ class Request
5
6
  attr_accessor :type, :params
6
7
 
7
8
  def initialize(type, params = {})
@@ -11,16 +12,24 @@ module Getclicky
11
12
 
12
13
  # Handle all HTTP::Get request, wrapping all the logic
13
14
  #
14
- def get
15
- response = self.class.get(Getclicky.endpoint, :query => build_params(@type, @params))
15
+ def get
16
+ response = Net::HTTP.get_response(build_url())
16
17
 
17
18
  case response.code
18
- when "404"
19
- raise Getclicky::NotFoundError
20
- else
21
- Getclicky::Response.new(response.parsed_response, @params[:output])
19
+ when Net::HTTPNotFound
20
+ raise Getclicky::NotFoundError
21
+ else
22
+ Getclicky::Response.new(response.body, @params[:output])
22
23
  end
23
24
  end
25
+
26
+ #Build the url for make request to API
27
+ #
28
+ def build_url
29
+ uri = URI.parse(Getclicky.endpoint)
30
+ uri.query = URI.encode_www_form(build_params(@type, @params))
31
+ uri
32
+ end
24
33
 
25
34
  # Build the hash of options for make resquest to API
26
35
  #
@@ -7,13 +7,14 @@ module Getclicky
7
7
  :pages_entrance,
8
8
  :pages_exit,
9
9
  :downloads,
10
- :clicks,
10
+ :events,
11
11
  :links,
12
12
  :links_domains,
13
13
  :links_outbound,
14
14
  :searches,
15
15
  :searches_keywords,
16
16
  :searches_engines,
17
+ :searches_rankings,
17
18
  :goals,
18
19
  :split_tests,
19
20
  :campaigns,
@@ -32,23 +33,24 @@ module Getclicky
32
33
  :visitors_most_active,
33
34
  :traffic_sources,
34
35
  :tweets,
35
- :shorturls,
36
+ :shorturls,
36
37
  :visitors_list,
37
38
  :actions_list,
38
39
  :searches_recent,
39
40
  :searches_unique,
40
41
  :links_recent,
41
- :links_unique,
42
+ :links_unique,
42
43
  :visitors,
44
+ :visitors_online,
43
45
  :visitors_unique,
46
+ :visitors_new,
44
47
  :actions,
45
48
  :actions_average,
46
49
  :time_average,
47
50
  :time_average_pretty,
48
51
  :time_total,
49
52
  :time_total_pretty,
50
- :bounce_rate,
51
- :visitors_online
53
+ :bounce_rate
52
54
  ]
53
55
  end
54
56
  end
@@ -2,7 +2,7 @@ module Getclicky
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -8,6 +8,10 @@ describe Getclicky::Client do
8
8
  subject.should respond_to(type)
9
9
  end
10
10
  RUBY
11
- end
11
+ end
12
+
13
+ it "should be implement multiple method" do
14
+ subject.should respond_to("multiple")
15
+ end
12
16
  end
13
17
  end
@@ -34,4 +34,11 @@ describe Getclicky::Request do
34
34
  params.should == { :site_id => Getclicky.site_id, :sitekey => Getclicky.sitekey, :type => "bounce-rate", :output => :json }
35
35
  end
36
36
  end
37
+
38
+ describe "request" do
39
+ before do
40
+ ENV["GETCLICKY_ENDPOINT"] = "http://example.com"
41
+ FakeWeb.register_uri :any, "http://example.com", :status => 200
42
+ end
43
+ end
37
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getclicky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,66 +9,55 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-30 00:00:00.000000000Z
12
+ date: 2012-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: httparty
16
- requirement: &70106845571760 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 0.8.0
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *70106845571760
25
14
  - !ruby/object:Gem::Dependency
26
15
  name: hashie
27
- requirement: &70106845570980 !ruby/object:Gem::Requirement
16
+ requirement: &70288102271460 !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
19
  - - ~>
31
20
  - !ruby/object:Gem::Version
32
- version: 1.1.0
21
+ version: 1.2.0
33
22
  type: :runtime
34
23
  prerelease: false
35
- version_requirements: *70106845570980
24
+ version_requirements: *70288102271460
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: rspec
38
- requirement: &70106845570520 !ruby/object:Gem::Requirement
27
+ requirement: &70288102270880 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ~>
42
31
  - !ruby/object:Gem::Version
43
- version: '2.6'
32
+ version: '2.8'
44
33
  type: :development
45
34
  prerelease: false
46
- version_requirements: *70106845570520
35
+ version_requirements: *70288102270880
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: test_notifier
49
- requirement: &70106845569860 !ruby/object:Gem::Requirement
38
+ requirement: &70288102270360 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
41
  - - ~>
53
42
  - !ruby/object:Gem::Version
54
- version: '0.3'
43
+ version: 1.0.0
55
44
  type: :development
56
45
  prerelease: false
57
- version_requirements: *70106845569860
46
+ version_requirements: *70288102270360
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: fakeweb
60
- requirement: &70106845566420 !ruby/object:Gem::Requirement
49
+ requirement: &70288102269800 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ~>
64
53
  - !ruby/object:Gem::Version
65
- version: '1.3'
54
+ version: 1.3.0
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *70106845566420
57
+ version_requirements: *70288102269800
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: ruby-debug19
71
- requirement: &70106845565720 !ruby/object:Gem::Requirement
60
+ requirement: &70288102269320 !ruby/object:Gem::Requirement
72
61
  none: false
73
62
  requirements:
74
63
  - - ~>
@@ -76,7 +65,7 @@ dependencies:
76
65
  version: '0.11'
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *70106845565720
68
+ version_requirements: *70288102269320
80
69
  description: Ruby Wrapper for GetClicky API Analytics
81
70
  email:
82
71
  - petersonferreiras@gmail.com
@@ -122,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
111
  version: '0'
123
112
  requirements: []
124
113
  rubyforge_project:
125
- rubygems_version: 1.8.9
114
+ rubygems_version: 1.8.17
126
115
  signing_key:
127
116
  specification_version: 3
128
117
  summary: Ruby Wrapper for GetClicky API Analytics