adsense-info 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ vendor/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in adsense-info.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "adsense-info/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "adsense-info"
7
+ s.version = Adsense::Info::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Clive Crous"]
10
+ s.email = ["clive@crous.co.za"]
11
+ s.homepage = "http://www.darkarts.co.za/adsense-info"
12
+ s.summary = %q{Retrieve adsense income totals}
13
+ s.description = %q{Retrieve income from your adsense account}
14
+
15
+ s.add_dependency "mechanize"
16
+ s.add_dependency "hpricot"
17
+
18
+ s.add_development_dependency "bundler", ">= 1.0.0"
19
+ s.add_development_dependency "rake", ">= 0.8.7"
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
@@ -0,0 +1,5 @@
1
+ module Adsense
2
+ class Info
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require 'mechanize'
2
+ require 'hpricot'
3
+
4
+ module Adsense
5
+ class Info
6
+
7
+ def initialize( username, password )
8
+ @username = username
9
+ @password = password
10
+ @agent = Mechanize::Mechanize.new
11
+ end
12
+
13
+ def login!
14
+ page = @agent.get 'http://www.gmail.com'
15
+ form = page.forms.first
16
+ form.Email = @username
17
+ form.Passwd = @password
18
+ @agent.submit form
19
+ end
20
+
21
+ def today_so_far
22
+ login!
23
+ ( get('https://www.google.com/adsense/v3/m/home') / 'span[@class~=value]' ).first.inner_html
24
+ end
25
+
26
+ private
27
+
28
+ def get( url )
29
+ Hpricot(@agent.get( url ).body)
30
+ end
31
+
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adsense-info
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Clive Crous
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-03-09 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: mechanize
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ prerelease: false
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: hpricot
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: &id003 !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 1
55
+ - 0
56
+ - 0
57
+ version: 1.0.0
58
+ type: :development
59
+ prerelease: false
60
+ version_requirements: *id003
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ - 8
71
+ - 7
72
+ version: 0.8.7
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: *id004
76
+ description: Retrieve income from your adsense account
77
+ email:
78
+ - clive@crous.co.za
79
+ executables: []
80
+
81
+ extensions: []
82
+
83
+ extra_rdoc_files: []
84
+
85
+ files:
86
+ - .gitignore
87
+ - Gemfile
88
+ - Rakefile
89
+ - adsense-info.gemspec
90
+ - lib/adsense-info.rb
91
+ - lib/adsense-info/version.rb
92
+ has_rdoc: true
93
+ homepage: http://www.darkarts.co.za/adsense-info
94
+ licenses: []
95
+
96
+ post_install_message:
97
+ rdoc_options: []
98
+
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 23827165
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 23827165
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ requirements: []
120
+
121
+ rubyforge_project:
122
+ rubygems_version: 1.3.7
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: Retrieve adsense income totals
126
+ test_files: []
127
+