postrank-api 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,7 +23,7 @@ For complete documentation on all endpoints please see [PostRank API Docs](http:
23
23
  top = api.top_posts(igvita['id'], :num => 1)
24
24
 
25
25
  # lookup the engagement score for the past two days
26
- eng = api.engagement(igvita['id'], :start => 'yesterday')
26
+ eng = api.feed_engagement(igvita['id'], :start_time => 'yesterday')
27
27
 
28
28
  # lookup social metrics for a url
29
29
  metrics = api.metrics('http://www.igvita.com/')
@@ -31,8 +31,8 @@ For complete documentation on all endpoints please see [PostRank API Docs](http:
31
31
  # get recommended feeds
32
32
  recommendations = api.recommendations(igvita['id'])
33
33
 
34
- #lookup relative postranks for given posts
34
+ # lookup thematic postranks for given posts
35
35
  postrank = api.postrank(top['items'].collect!{|info| info['original_link']})
36
36
 
37
- #lookup metrics history for a given post hash
38
- history = api.postrank(top['items'].first['id'], :start => '1 month ago')
37
+ # lookup metrics history for a given post hash
38
+ history = api.postrank(top['items'].first['id'])
data/Rakefile CHANGED
@@ -14,6 +14,7 @@ begin
14
14
  gemspec.add_dependency('em-http-request')
15
15
  gemspec.add_dependency('em-synchrony')
16
16
  gemspec.add_dependency('yajl-ruby')
17
+ gemspec.add_dependency('chronic')
17
18
  gemspec.rubyforge_project = "postrank-api"
18
19
  end
19
20
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0
@@ -45,13 +45,13 @@ module PostRank
45
45
  parse(http.response)
46
46
  end
47
47
 
48
- def recommendations(feeds, opts = {})
48
+ def recommendations(feeds, opts = {})
49
49
  req = {
50
50
  :query => {
51
51
  :appkey => @appkey,
52
52
  :num => opts[:num] || 10
53
53
  },
54
- :body => build_body(feeds, 'feed')
54
+ :body => build_body(feeds, 'feed')
55
55
  }
56
56
 
57
57
  http = post("#{V2_API_BASE}/recommend", req)
@@ -59,19 +59,18 @@ module PostRank
59
59
  end
60
60
 
61
61
  def metrics_versioned(posts, opts = {})
62
+ opts[:start_time] ||= 'yesterday'
63
+ opts[:end_time] ||= 'today'
62
64
 
63
- start_time = opts[:start] || 'yesterday'
64
- end_time = opts[:end] || 'today'
65
-
66
- req = {
65
+ req = {
67
66
  :query => {
68
67
  :appkey => @appkey,
69
- :min_time => Chronic.parse(start_time).to_i,
70
- :max_time => Chronic.parse(end_time).to_i
68
+ :min_time => Chronic.parse(opts[:start_time]).to_i,
69
+ :max_time => Chronic.parse(opts[:start_time]).to_i
71
70
  },
72
71
  :body => build_body( posts, 'post_hash')
73
72
  }
74
-
73
+
75
74
  http = post("#{V2_API_BASE}/entry/metrics/historic", req)
76
75
  parse(http.response)
77
76
  end
@@ -132,7 +131,8 @@ module PostRank
132
131
  :query => {
133
132
  :appkey => @appkey,
134
133
  :start_time => Chronic.parse(opts[:start_time]).to_i,
135
- :end_time => Chronic.parse(opts[:end_time]).to_i
134
+ :end_time => Chronic.parse(opts[:end_time]).to_i,
135
+ :mode => opts[:mode]
136
136
  },
137
137
  :body => build_body(domains, 'domain')
138
138
  }
@@ -206,5 +206,5 @@ module PostRank
206
206
  end
207
207
  http
208
208
  end
209
+ end
209
210
  end
210
- end
data/postrank-api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{postrank-api}
8
- s.version = "0.1.3"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ilya Grigorik"]
12
- s.date = %q{2010-07-28}
12
+ s.date = %q{2010-12-15}
13
13
  s.description = %q{PostRank API Wrapper}
14
14
  s.email = %q{ilya@igvita.com}
15
15
  s.extra_rdoc_files = [
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.require_paths = ["lib"]
30
30
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
31
31
  s.rubyforge_project = %q{postrank-api}
32
- s.rubygems_version = %q{1.3.6}
32
+ s.rubygems_version = %q{1.3.7}
33
33
  s.summary = %q{PostRank API Wrapper}
34
34
  s.test_files = [
35
35
  "spec/api_spec.rb"
@@ -39,22 +39,25 @@ Gem::Specification.new do |s|
39
39
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
40
  s.specification_version = 3
41
41
 
42
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
43
  s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.9"])
44
44
  s.add_runtime_dependency(%q<em-http-request>, [">= 0"])
45
45
  s.add_runtime_dependency(%q<em-synchrony>, [">= 0"])
46
46
  s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
47
+ s.add_runtime_dependency(%q<chronic>, [">= 0"])
47
48
  else
48
49
  s.add_dependency(%q<eventmachine>, [">= 0.12.9"])
49
50
  s.add_dependency(%q<em-http-request>, [">= 0"])
50
51
  s.add_dependency(%q<em-synchrony>, [">= 0"])
51
52
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
53
+ s.add_dependency(%q<chronic>, [">= 0"])
52
54
  end
53
55
  else
54
56
  s.add_dependency(%q<eventmachine>, [">= 0.12.9"])
55
57
  s.add_dependency(%q<em-http-request>, [">= 0"])
56
58
  s.add_dependency(%q<em-synchrony>, [">= 0"])
57
59
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
60
+ s.add_dependency(%q<chronic>, [">= 0"])
58
61
  end
59
62
  end
60
63
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 3
9
- version: 0.1.3
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ilya Grigorik
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-28 00:00:00 -04:00
17
+ date: 2010-12-15 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: eventmachine
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
@@ -35,6 +36,7 @@ dependencies:
35
36
  name: em-http-request
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
@@ -47,6 +49,7 @@ dependencies:
47
49
  name: em-synchrony
48
50
  prerelease: false
49
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
50
53
  requirements:
51
54
  - - ">="
52
55
  - !ruby/object:Gem::Version
@@ -59,6 +62,7 @@ dependencies:
59
62
  name: yajl-ruby
60
63
  prerelease: false
61
64
  requirement: &id004 !ruby/object:Gem::Requirement
65
+ none: false
62
66
  requirements:
63
67
  - - ">="
64
68
  - !ruby/object:Gem::Version
@@ -67,6 +71,19 @@ dependencies:
67
71
  version: "0"
68
72
  type: :runtime
69
73
  version_requirements: *id004
74
+ - !ruby/object:Gem::Dependency
75
+ name: chronic
76
+ prerelease: false
77
+ requirement: &id005 !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ type: :runtime
86
+ version_requirements: *id005
70
87
  description: PostRank API Wrapper
71
88
  email: ilya@igvita.com
72
89
  executables: []
@@ -93,6 +110,7 @@ rdoc_options:
93
110
  require_paths:
94
111
  - lib
95
112
  required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
96
114
  requirements:
97
115
  - - ">="
98
116
  - !ruby/object:Gem::Version
@@ -102,6 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
120
  - 1
103
121
  version: 1.9.1
104
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
+ none: false
105
124
  requirements:
106
125
  - - ">="
107
126
  - !ruby/object:Gem::Version
@@ -111,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
130
  requirements: []
112
131
 
113
132
  rubyforge_project: postrank-api
114
- rubygems_version: 1.3.6
133
+ rubygems_version: 1.3.7
115
134
  signing_key:
116
135
  specification_version: 3
117
136
  summary: PostRank API Wrapper