serpscan 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64caaa4a34f1602e0b168432424a23c478690cb4
4
- data.tar.gz: 3aabf4b7e02237d19c6d7b0b0db874127926d7b2
3
+ metadata.gz: 412ac7c48836fef8fea3d7e290dead4210469d71
4
+ data.tar.gz: 7e242920660cbe89d0c75dd230070683129e0dfc
5
5
  SHA512:
6
- metadata.gz: c1d9363fb73c62fd135ed7cecc72f14cc1078b9bece1e34870c67f4f8533632e5f83b5a2d66e5aefcf4b119e22ed2c723e01eb6f3f50bd52f0771b7151346e40
7
- data.tar.gz: ad6ac3820209b650dec2b08fa9a03de5e8b9b14928200322c910136be6ebbb62e3a2590961c57e9a26fb6fc1217edc2d9b4dddb2e388afb146b3f0434f33de8a
6
+ metadata.gz: bbd2c2a7c46b2b3483b198bbc80a819c259e01998ea11c45d0b53f977382a9e5639677e61cf03a4f45af6df496a60dac5432ffa7877af6c57cca5e7da34ec17d
7
+ data.tar.gz: e512e1db694a02f04ff4bcc9f6d7aa1288e01f515159746ad5f8c6f660941834563ac61e65205d2f6c30bd6e8d9f822dc2ed6617166b6bb3b46a3078eb5c4656
data/README.md CHANGED
@@ -28,6 +28,12 @@ Set your API key. If you're using Rails you may want to place the code below in
28
28
  Serpscan.api_key = 'YOUR API KEY'
29
29
  ```
30
30
 
31
+ Alternatively you can set your API key as an environment variable:
32
+
33
+ ```ruby
34
+ ENV['SERPSCAN_API_KEY'] = 'YOUR API KEY'
35
+ ```
36
+ ### Websites
31
37
  To create a website:
32
38
 
33
39
  ```ruby
@@ -54,6 +60,7 @@ website = Serpscan::Website.find(1)
54
60
  website.keywords
55
61
  ```
56
62
 
63
+ ### Keywords
57
64
  To create a keyword:
58
65
 
59
66
  ```ruby
@@ -61,6 +68,15 @@ website = Serpscan::Website.find(1)
61
68
  website.create_keyword('example keyword')
62
69
  ```
63
70
 
71
+ To get a particular keyword:
72
+ ```ruby
73
+ Serpscan::Keyword.find(id)
74
+ ```
75
+
76
+ Ranking history:
77
+ ```ruby
78
+ Serpscan::Keyword.find(id).history #> [['2015-01-01', 2], ['2015-01-02', 1]]
79
+ ```
64
80
  ## Attributes
65
81
 
66
82
  Each of these attributes can be called directly on the object. Example:
@@ -7,5 +7,9 @@ module Serpscan
7
7
  def website
8
8
  parent
9
9
  end
10
+
11
+ def history
12
+ @history ||= Serpscan::API.get("#{api_path}/#{id}/history")['rankings']
13
+ end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module Serpscan
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -2,7 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  describe Serpscan::Keyword, vcr: true do
4
4
  it_should_behave_like 'a creatable object', keyword: 'example keyword', website_id: 1, search_engine_country_id: 1
5
-
6
5
  it_should_behave_like 'a findable object', 1, Serpscan::Keyword::ATTRIBUTES
7
6
  it_should_behave_like 'a deletable object', 2
7
+
8
+ describe 'history' do
9
+ it 'should return an array of dates and rankings' do
10
+ keyword = subject.class.find(1)
11
+ history = keyword.history
12
+
13
+ expect(history.class).to eq Array
14
+ expect(history.first.class).to eq Array
15
+ expect(history.first[0].class).to eq String
16
+ expect(history.first[1].class).to eq Fixnum
17
+ end
18
+ end
8
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serpscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Montgomery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-17 00:00:00.000000000 Z
11
+ date: 2015-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler