kinja 0.0.13 → 0.0.14

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: 2c1365488768a90ad365de8c792729b83b46dc62
4
- data.tar.gz: 483808eb1f3462b8703c62bfbcaef14fa5eca9e3
3
+ metadata.gz: f1fc37b8940e467abd3a87cd326049a1c18bd0b8
4
+ data.tar.gz: eb620f3338e513cd4670e18258b8207d13315630
5
5
  SHA512:
6
- metadata.gz: c04a5b1c4b3189396ba00ac2fc3e6c00e7b6199b5f399be5827980616d8c82f98d72069855496b77d2dc0d7d727710910f8070ad7be9e4b0d6a5f8b0f8866f8e
7
- data.tar.gz: 23c7eb3454ef57f12ac77b2ae2c601406b8b0d3e94ab870f6ec49c4543beb85e0b29c4fb6ba1229f6eb92885ec901524acc33888ae73a0194604f919ec389ad0
6
+ metadata.gz: 80f38d15922898ec3743271a0a0ed1b9adb9a0ad4e1a328c3c047cc6b48ac73fce3518c655da72f5e535cd600bb08106db91c6ebd995251ea0790c962c57ef2d
7
+ data.tar.gz: 0663725854bdc9a3ad301f868a23478ed45c3ceeb7b67942e783c88d9c46eddb7acbeffd0c2e9aa1f3f5242f79f8257d698dc892b2c2f0ca7d33a5e582af096e
data/lib/kinja/author.rb CHANGED
@@ -4,9 +4,17 @@ module Kinja
4
4
  HTTParty.get(author_path(user["id"]))["data"]
5
5
  end
6
6
 
7
+ def get_author_id(name)
8
+ HTTParty.get(author_name_path(name))["data"]["id"]
9
+ end
10
+
7
11
  def get_default_blog_id(user)
8
12
  get_author(user)[0]["defaultBlogId"]
9
13
  end
14
+
15
+ def get_author_posts(id, start=nil, max=20)
16
+ HTTParty.get(author_posts_path(id, start, max))["data"]
17
+ end
10
18
  end
11
19
  end
12
20
 
data/lib/kinja/blog.rb CHANGED
@@ -27,6 +27,11 @@ module Kinja
27
27
  profile["data"]["id"]
28
28
  end
29
29
 
30
+ def get_members(id)
31
+ members = HTTParty.get(blog_members_path(id))
32
+ members["data"]
33
+ end
34
+
30
35
  end
31
36
  end
32
37
 
data/lib/kinja/helpers.rb CHANGED
@@ -10,15 +10,17 @@ module Kinja
10
10
 
11
11
  private
12
12
  API_ROOT = "http://kinja.com/api"
13
- # LOGIN_PATH = "/profile/account/burner/login"
14
13
  LOGIN_PATH = "/profile/session/burnerLogin"
15
14
  TOKEN_PATH = "/profile/token/create"
16
15
  CREATE_POST_PATH = "/core/post/add"
17
16
  POST_PATH = "core/post"
18
17
  BLOG_PATH = "core/blog"
18
+ BLOG_MEMBERS_PATH = "profile/blogmembership/views/manageBlogMembers?blogId="
19
19
  TAG_PATH = "core/tag"
20
20
  BLOG_PROFILE_PATH = "profile/blog/byhost"
21
21
  AUTHOR_PATH = "profile/user/views/asAuthor"
22
+ AUTHOR_NAME_PATH = "profile/user/views/byName?name="
23
+ AUTHOR_POSTS_PATH = "core/author"
22
24
 
23
25
  def post_path(id)
24
26
  "#{API_ROOT}/#{POST_PATH}/#{id}"
@@ -40,6 +42,10 @@ module Kinja
40
42
  "#{API_ROOT}/#{BLOG_PROFILE_PATH}/#{name}"
41
43
  end
42
44
 
45
+ def blog_members_path(id)
46
+ "#{API_ROOT}/#{BLOG_MEMBERS_PATH}#{id}"
47
+ end
48
+
43
49
  def tag_path(name)
44
50
  "#{API_ROOT}/#{TAG_PATH}/#{URI.encode name}"
45
51
  end
@@ -52,6 +58,15 @@ module Kinja
52
58
  "#{API_ROOT}/#{AUTHOR_PATH}?ids=#{id}"
53
59
  end
54
60
 
61
+ def author_name_path(name)
62
+ "#{API_ROOT}/#{AUTHOR_NAME_PATH}#{name}"
63
+ end
64
+
65
+ def author_posts_path(id, start=nil, max=20)
66
+ start = DateTime.now.strftime('%Q') if start.nil?
67
+ "#{API_ROOT}/#{AUTHOR_POSTS_PATH}/#{id}/profileposts?startTime=#{start}&maxReturned=#{max}"
68
+ end
69
+
55
70
  end
56
71
  end
57
72
 
data/lib/kinja/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kinja
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -0,0 +1,74 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://kinja.com/api/profile/user/views/byName?name=adampash
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Security-Policy:
22
+ - default-src 'self'
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Frame-Options:
28
+ - DENY
29
+ X-Kinja:
30
+ - 'app08.xyz.kinja-ops.com #1636'
31
+ X-Kinja-Version:
32
+ - '20141118'
33
+ X-Permitted-Cross-Domain-Policies:
34
+ - master-only
35
+ X-Robots-Tag:
36
+ - noindex
37
+ X-Xss-Protection:
38
+ - 1; mode=block
39
+ Via:
40
+ - 1.1 varnish
41
+ - 1.1 varnish
42
+ Fastly-Debug-Digest:
43
+ - b0e86222ad7092d388e5e259f33c3906fae744aa7906b9a514bbed2e0d0502bf
44
+ X-Cdn-Fetch:
45
+ - mantle-origin-cache
46
+ Content-Length:
47
+ - '243'
48
+ Accept-Ranges:
49
+ - bytes
50
+ Date:
51
+ - Wed, 04 Nov 2015 16:39:50 GMT
52
+ Age:
53
+ - '0'
54
+ Connection:
55
+ - keep-alive
56
+ X-Served-By:
57
+ - cache-jfk1022-JFK, cache-nrt6124-NRT
58
+ X-Cache:
59
+ - MISS, MISS
60
+ X-Cache-Hits:
61
+ - 0, 0
62
+ X-Timer:
63
+ - S1446655189.889814,VS0,VE166
64
+ Vary:
65
+ - X-Feature-Hash,Accept-Encoding
66
+ Set-Cookie:
67
+ - geocc=US;path=/;
68
+ body:
69
+ encoding: ASCII-8BIT
70
+ string: '{"meta":{"error":null,"warnings":[]},"data":{"id":"5716491910670767033","screenName":"adampash","displayName":"Adam
71
+ Pash","authType":3,"authName":"google","createdMillis":1330974491000,"updatedMillis":1446215432000,"lastLoginMillis":1446215432000,"status":"enabled","avatar":{"id":"gdjxua361big4hslpfhx","format":"png"},"superUser":false}}'
72
+ http_version:
73
+ recorded_at: Wed, 04 Nov 2015 16:39:49 GMT
74
+ recorded_with: VCR 2.9.3