pergola 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1f79838dcd18cbe312d0f51d3a58cba1cb4af448
4
+ data.tar.gz: 1219dce44d165be71b4b4411dc41554c0d41fb7c
5
+ SHA512:
6
+ metadata.gz: 0e940e62c74c7b4546de9fb87addd0aea787e57e94cca5291d699724e197775875125ab5615ce94a48ab6a1b4d9f50888890d6c3ce43210aa25c692d2a7ed531
7
+ data.tar.gz: fc18f28c7d32c7a827c65e2ec6060694e14236c36e57730cb48ef739278500ad6b4f8bf19598b95328e3e4fb09572e5cca45ae2d13649a4d8bcbb572050094da
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pergola.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 adamjonas
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Pergola
2
+
3
+ Simple Ruby wrapper for the Vine API.
4
+
5
+ ## Installation
6
+
7
+ sudo gem install Pergola
8
+
9
+ ## Usage
10
+
11
+ You'll need a Vine client.
12
+
13
+ require 'Pergola'
14
+ client = Pergola::Client.new(:username => "email", :password => "sekret")
15
+
16
+ ### Retrieving info
17
+
18
+ client.me #=> your profile
19
+ client.profile #=> your profile
20
+ client.profile(123467890) #=> some user's profile
21
+ client.timeline #=> your timeline
22
+ client.timeline(123467890) #=> some user's timeline
23
+ client.popular #=> 99 popular vines
24
+ client.get_notifications #=> get notifications
25
+ client.with_tag("tag") #=> get vines with a tag
26
+ client.logout #=> logout
27
+
28
+ ## How to contribute
29
+
30
+ * Fork the project.
31
+ * Make your feature addition or bug fix.
32
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
33
+ * Commit, do not mess with rakefile, version, or history.
34
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
35
+ * Send me a pull request. Bonus points for topic branches.
36
+
37
+ * Hat tip to [Starlock](https://github.com/starlock/vino/wiki/API-Reference) for providing the basis of the API.
38
+
39
+ Copyright (c) 2013 [Carrot Creative](http://carrotcreative.com). See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,45 @@
1
+ # AUTHENTICATE FIRST found in examples/authenticate.rb
2
+
3
+ # client is an instance of Pergola::Client
4
+
5
+ HTTParty.post("https://api.vineapp.com/users/authenticate", body: { username: "example@gmail.com", password: "sekret"})
6
+ OR
7
+ curl -X POST --data "username=example@gmail.com&password=sekret" https://api.vineapp.com/users/authenticate
8
+
9
+
10
+ # Authenticate
11
+ HTTParty.post("https://api.vineapp.com/users/authenticate", body: { username: "example@gmail.com", password: "sekret"})
12
+
13
+ ###############
14
+ client.profile
15
+
16
+ # Get /me
17
+ HTTParty.get("https://api.vineapp.com/users/me", :headers => {"vine-session-id" => response["data"]["key"]})
18
+
19
+ # Get /Lee Ourand
20
+ HTTParty.get("https://api.vineapp.com/users/profiles/#{other_user_id}", :headers => { "vine-session-id" => response["data"]["key"] })
21
+ curl --header "vine-session-id:#{session}" https://api.vineapp.com/users/profile/"#{other_user_id}"
22
+ curl --header "vine-session-id:#{session}" https://api.vine"app.com/users/me"
23
+
24
+ #################
25
+ cient.timeline || client.timeline(":id => "#{other_user_id}") || client.timeline("@twitter_handle")
26
+ # Get a user timeline
27
+ HTTParty.get("https://api.vineapp.com/timelines/users/908940759363887104", :headers => {"vine-session-id" => response["data"]["key"]})
28
+
29
+ #####################
30
+ client.popular
31
+ # Get Popular
32
+ HTTParty.get("https://api.vineapp.com/timelines/popular", :headers => {"vine-session-id" => response["data"]["key"]})
33
+ curl -H "vine-session-id:#{session}" https://api.vineapp.com/timelines/popular
34
+ ##################
35
+ client.with_tag("tag")
36
+
37
+ curl -H "vine-session-id:#{session}" https://api.vineapp.com/timelines/tags/carrot
38
+
39
+ ##################
40
+ client.get_notifications
41
+ curl -H "vine-session-id:#{session}" https://api.vineapp.com/users/"#{user_id}"/pendingNotificationsCount
42
+
43
+ ##############
44
+ client.logout
45
+ curl -X DELETE -H "vine-session-id:#{session}" https://api.vineapp.com/users/authenticate
@@ -0,0 +1,90 @@
1
+ module Pergola
2
+ class Client
3
+ include HTTParty
4
+ base_uri "https://api.vineapp.com"
5
+ format :json
6
+ attr_accessor :session, :user_id
7
+
8
+ # Initialize the Pergola client
9
+ # E.G.
10
+ # client = Pergola::Client.new(:username => "email", :password => "sekret")
11
+
12
+ def initialize(options={})
13
+ if options[:token]
14
+ @session = options[:token]
15
+ @user_id = options[:token].match(/(\d*(?=-))/)[0]
16
+ elsif options[:username] && options[:password]
17
+ response = self.class.post('/users/authenticate', body: {username: options[:username], password: options[:password] })
18
+ @user_id = response["data"]["userId"]
19
+ @session = response["data"]["key"]
20
+ end
21
+
22
+ Pergola.session = @session
23
+ Pergola.user_id = @user_id
24
+
25
+ @headers = {:headers => {"vine-session-id" => @session}}
26
+ end
27
+
28
+ #client.logout #=> destroys the client session
29
+ def logout
30
+ path = "/users/authenticate"
31
+ self.request(path, :delete)
32
+ end
33
+
34
+ # client.profile #=> Your Profile
35
+ # client.me #=> Your Profile
36
+ # client.profile('user_id') #=> some user's profile
37
+ def profile(user_id = @user_id)
38
+ path = "/users/profiles/#{user_id}"
39
+ self.request(path)
40
+ end
41
+
42
+ def me
43
+ path = "/users/me"
44
+ self.request(path)
45
+ end
46
+
47
+ #client.timeline #=> your timeline
48
+ #client.timeline('user_id') #=> friend's timeline
49
+ def timeline(user_id = @user_id)
50
+ path = "/timelines/users/#{user_id}"
51
+ self.request(path)
52
+ end
53
+
54
+ #client.tag("brooklyn") #=> find vines with similar tags
55
+ def with_tag(tag)
56
+ path = "/timelines/tags/#{tag}"
57
+ self.request(path)
58
+ end
59
+
60
+ #client.get_notifications #=> get pending notifications
61
+ def get_notifications
62
+ path = "/users/#{@user_id}/pendingNotificationsCount"
63
+ self.request(path)
64
+ end
65
+
66
+ #client.popular #=> discover popular vines
67
+ def popular
68
+ path = "/timelines/popular"
69
+ self.request(path)
70
+ end
71
+
72
+ def request(path, method=:get)
73
+ request = self.class.send(method, path, @headers)
74
+
75
+ if request["code"] != ""
76
+ config = Pergola.configuration
77
+ puts "YOUR SESSION IS NO LONGER VALID"
78
+ puts "REINITIALIZING YOUR SESSION BASED ON CONFIGURATION.RB"
79
+
80
+ new_client = self.class.new(username: config.username, password: config.password)
81
+ @headers = {:headers => {"vine-session-id" => new_client.session}}
82
+
83
+ puts "RETRYING THE API CALL"
84
+ request = self.class.send(method, path, @headers)
85
+ end
86
+ request
87
+ end
88
+
89
+ end
90
+ end
@@ -0,0 +1,29 @@
1
+ module Pergola
2
+ class Configuration
3
+ attr_accessor :username, :password
4
+
5
+ def initialize
6
+ @username = 'email'
7
+ @password = '1234567890ABC'
8
+ end
9
+ end
10
+
11
+ class << self
12
+ attr_accessor :configuration
13
+ end
14
+
15
+ # Configure Pergola someplace sensible,
16
+ # like config/initializers/Pergola.rb
17
+ #
18
+ # use throughout gem with Pergola.configuration.username
19
+ #
20
+ # @example
21
+ # Pergola.configure do |config|
22
+ # config.username = '12343534456457'
23
+ # config.password = 'AB12323DNASDA'
24
+ # end
25
+ def self.configure
26
+ self.configuration ||= Configuration.new
27
+ yield(configuration)
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module Pergola
2
+ VERSION = "0.0.1"
3
+ end
data/lib/pergola.rb ADDED
@@ -0,0 +1,58 @@
1
+ require 'httparty'
2
+ require 'hashie'
3
+
4
+ Hash.send :include, Hashie::HashExtensions
5
+
6
+ module Pergola
7
+
8
+ def self.logout
9
+ Pergola::Client.new(token: "#{Pergola.session}").logout
10
+ end
11
+
12
+ def self.profile(user_id= @user_id)
13
+ Pergola::Client.new(token: "#{Pergola.session}").profile(user_id)
14
+ end
15
+
16
+ def self.me
17
+ Pergola::Client.new(token: "#{Pergola.session}").me
18
+ end
19
+
20
+ def self.timeline(user_id = @user_id)
21
+ Pergola::Client.new(token: "#{Pergola.session}").timeline(user_id)
22
+ end
23
+
24
+ def self.with_tag(tag)
25
+ Pergola::Client.new(token: "#{Pergola.session}").with_tag(tag)
26
+ end
27
+
28
+ def self.get_notifications
29
+ Pergola::Client.new(token: "#{Pergola.session}").get_notifications
30
+ end
31
+
32
+ def self.popular
33
+ Pergola::Client.new(token: "#{Pergola.session}").popular
34
+ end
35
+
36
+ def self.configuration
37
+ Pergola::Configuration.new
38
+ end
39
+
40
+ # def self.client_extension(*args)
41
+ # args.each do |arg|
42
+ # define_method self.send(arg) do
43
+ # Pergola::Client.new(token: "#{Pergola.session}").send(arg)
44
+ # end
45
+ # end
46
+ # end
47
+ # self.client_extension(:logout, :profile, :me, :timeline, :get_notifications, :popular)
48
+
49
+
50
+ class << self
51
+ attr_accessor :session, :user_id
52
+ end
53
+
54
+ autoload :Version, "pergola/version"
55
+ autoload :Client, "pergola/client"
56
+ autoload :Configuration, "pergola/configuration"
57
+ end
58
+
data/pergola.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pergola/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pergola"
8
+ spec.version = Pergola::VERSION
9
+ spec.authors = ["adamjonas"]
10
+ spec.email = ["adam.jonas@carrotcreative.com"]
11
+ spec.description = %q{A ruby wrapper for the Vine API.}
12
+ spec.summary = %q{Tame the Vine API with pergola.}
13
+ spec.homepage = 'http://carrot.is/adamjonas'
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,10 @@
1
+ {
2
+ "code": "",
3
+ "data": {
4
+ "username": "Josh Rowley",
5
+ "userId": 908940759363887104,
6
+ "key": "908940759363887104-3931d3e3-e22a-40e5-8913-468544543a07"
7
+ },
8
+ "success": true,
9
+ "error": ""
10
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "code": "",
3
+ "data": {},
4
+ "success": true,
5
+ "error": ""
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "code": "",
3
+ "data": 3,
4
+ "success": true,
5
+ "error": ""
6
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "code": "got it",
3
+ "data": {
4
+ "count": 100,
5
+ "records": [
6
+ {
7
+ "liked": false,
8
+ "foursquareVenueId": null,
9
+ "userId": 914021455983943700,
10
+ "likes": {
11
+ "count": 1043,
12
+ "records": [
13
+ {
14
+ "comment": "Very creative, you are one talented individual.",
15
+ "username": "Dmante Jewelry",
16
+ "verified": 0,
17
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/A7EFBBA1-6524-42A4-B161-638FFA655D9A-4611-0000017208272F00.jpg?versionId=re5xYeVRflXbb8py83OsKmTKVkgVc1ms",
18
+ "created": "2013-04-30T19:20:17.000000",
19
+ "userId": 908658737949057000,
20
+ "entities": [],
21
+ "location": "Round Here , California",
22
+ "commentId": 941098652942884900,
23
+ "user": {
24
+ "username": "Dmante Jewelry",
25
+ "verified": 0,
26
+ "description": "I make pretty things, I love pretty things and I like cool people, places and stuff...www.dmante.com. (it's simple) ",
27
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/A7EFBBA1-6524-42A4-B161-638FFA655D9A-4611-0000017208272F00.jpg?versionId=re5xYeVRflXbb8py83OsKmTKVkgVc1ms",
28
+ "userId": 908658737949057000,
29
+ "location": "Round Here , California",
30
+ "explicitContent": null
31
+ }
32
+ }
33
+ ],
34
+ "nextPage": 2,
35
+ "anchor": 0,
36
+ "previousPage": null,
37
+ "size": 10
38
+ },
39
+ "entities": [],
40
+ "location": "Kuwait City, Kuwait",
41
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/AD9622D9-F792-4DF8-B93A-3C9937D07908-3426-00000273A60B0851_1.1.mp4?versionId=QIWQ_QlCHjhqb3gp6VgrmL2XV1oysHCq",
42
+ "username": "Pinot",
43
+ "description": "Here's my experiment with front facing camera. Yea I know I'm not front facing cam genic.",
44
+ "tags": [
45
+ {
46
+ "tagId": 909637972620742700,
47
+ "tag": "frontfacingcamera"
48
+ },
49
+ {
50
+ "tagId": 937975907178795000,
51
+ "tag": "frontface"
52
+ }
53
+ ],
54
+ "postVerified": null,
55
+ "postFlags": 2,
56
+ "user": {
57
+ "username": "Pinot",
58
+ "verified": 0,
59
+ "description": "Indonesian father of Neverland family. Believe in dream, graphic design and Apple. Work as Illustrator & Graphic Designer in Kuwait. http://about.me/pinot",
60
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/55974369-1708-4FDD-A9EA-37A58F26B55B-3221-000002ACE0994E0B.jpg?versionId=IgxYaX5P.fXSaAkCnpyIqvFLkoftOvzs",
61
+ "userId": 906288872982458400,
62
+ "location": "Kuwait City, Kuwait",
63
+ "explicitContent": null
64
+ },
65
+ "postId": 941086690137776100,
66
+ "postToTwitter": 1,
67
+ "videoUrl": "https://v.cdn.vine.co/v/videos/AD9622D9-F792-4DF8-B93A-3C9937D07908-3426-00000273A60B0851_1.1.mp4?versionId=gFqg0boWaZuqFShGxT75f7BggJI3RzR0",
68
+ "created": "2013-04-30T18:32:45.000000",
69
+ "shareUrl": "https://vine.co/v/bxV9YDLHwXi",
70
+ "promoted": 0
71
+ }
72
+ ],
73
+ "nextPage": 2,
74
+ "anchor": 941086690137776100,
75
+ "previousPage": null,
76
+ "size": 20
77
+ },
78
+ "success": true,
79
+ "error": ""
80
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "code": "",
3
+ "data": {
4
+ "username": "JoshRowley",
5
+ "following": 0,
6
+ "followerCount": 15,
7
+ "includePromoted": 1,
8
+ "verified": 0,
9
+ "description": "developer@sidetour.@flatironschoolgrad.&hearts;coding,baseball,skiing,improv,camping,andtravelingtheworld.blog@http: //jrowdev.com",
10
+ "avatarUrl": "https: //vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
11
+ "twitterId": 57117767,
12
+ "userId": 908940759363887104,
13
+ "twitterConnected": 1,
14
+ "likeCount": 0,
15
+ "facebookConnected": 1,
16
+ "postCount": 7,
17
+ "phoneNumber": null,
18
+ "location": "Brooklyn,NY",
19
+ "blocking": 0,
20
+ "followingCount": 25,
21
+ "explicitContent": 0,
22
+ "email": "josh.rowley@gmail.com",
23
+ "blocked": 0
24
+ },
25
+ "success": true,
26
+ "error": ""
27
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "code": "",
3
+ "data": {
4
+ "count": 500,
5
+ "records": [
6
+ {
7
+ "liked": false,
8
+ "foursquareVenueId": null,
9
+ "userId": 939450600679202800,
10
+ "likes": {
11
+ "count": 1,
12
+ "records": [
13
+ {
14
+ "username": "angella miller",
15
+ "verified": 0,
16
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/10105373-A95F-45FD-96CD-8EC5796E45D7-367-000000141F2C1F98.jpg?versionId=TJMnXmjcVafgsJntCUS1IiHyg2es6x6I",
17
+ "created": "2013-04-28T17:11:49.000000",
18
+ "userId": 939317624179978200,
19
+ "location": "Chicago",
20
+ "likeId": 940341548699267100,
21
+ "user": {
22
+ "username": "angella miller",
23
+ "verified": 0,
24
+ "description": "inspired by everything. smile-scatterer. interior design student. owner of lavender and honey (a work in progress).",
25
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/10105373-A95F-45FD-96CD-8EC5796E45D7-367-000000141F2C1F98.jpg?versionId=TJMnXmjcVafgsJntCUS1IiHyg2es6x6I",
26
+ "userId": 939317624179978200,
27
+ "location": "Chicago",
28
+ "explicitContent": null
29
+ }
30
+ }
31
+ ],
32
+ "nextPage": null,
33
+ "anchor": 0,
34
+ "previousPage": null,
35
+ "size": 10
36
+ },
37
+ "postToFacebook": 0,
38
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/2013/04/28/6D343195-4828-4D0E-988B-D18401E43506-12777-000007D0CCAEBD44_1.0.7.mp4.jpg?versionId=ZxBxrk2Ou5zEtbpefsFgkgISZRdhY6gm",
39
+ "explicitContent": 0,
40
+ "verified": 0,
41
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/8795BACC-4B4F-4088-A374-4008B0C404B4-9500-0000056C8F8AB15D.jpg?versionId=W.ybm50DDByg87LHtoKRjtJ4c36et0BN",
42
+ "comments": {
43
+ "count": 0,
44
+ "records": [],
45
+ "nextPage": null,
46
+ "anchor": 0,
47
+ "previousPage": null,
48
+ "size": 10
49
+ },
50
+ "entities": [
51
+ {
52
+ "type": "tag",
53
+ "range": [
54
+ 19,
55
+ 25
56
+ ],
57
+ "link": "vine://tag/horse",
58
+ "id": 906326824148275200,
59
+ "title": "horse"
60
+ },
61
+ {
62
+ "type": "tag",
63
+ "range": [
64
+ 26,
65
+ 33
66
+ ],
67
+ "link": "vine://tag/carrot",
68
+ "id": 906521802011058200,
69
+ "title": "carrot"
70
+ }
71
+ ],
72
+ "location": "Stockholm",
73
+ "videoLowURL": null,
74
+ "username": "Henrik Lundgren",
75
+ "description": "Feeding the horse! #horse #carrot",
76
+ "tags": [
77
+ {
78
+ "tagId": 906521802011058200,
79
+ "tag": "carrot"
80
+ },
81
+ {
82
+ "tagId": 906326824148275200,
83
+ "tag": "horse"
84
+ }
85
+ ],
86
+ "postVerified": null,
87
+ "postFlags": 0,
88
+ "user": {
89
+ "username": "Henrik Lundgren",
90
+ "verified": 0,
91
+ "description": "PhD student at KTH in Stockholm researching in the future of vehicles. Amazingly geeky when it comes to video-games (especially retro), science and music.",
92
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/8795BACC-4B4F-4088-A374-4008B0C404B4-9500-0000056C8F8AB15D.jpg?versionId=W.ybm50DDByg87LHtoKRjtJ4c36et0BN",
93
+ "userId": 939450600679202800,
94
+ "location": "Stockholm",
95
+ "explicitContent": null
96
+ },
97
+ "postId": 940337443817799700,
98
+ "postToTwitter": 1,
99
+ "videoUrl": "https://v.cdn.vine.co/v/videos/6D343195-4828-4D0E-988B-D18401E43506-12777-000007D0CCAEBD44_1.0.7.mp4?versionId=U4sbCuX2IS1CxX_r_B5.JYdKCXLvSNiY",
100
+ "created": "2013-04-28T16:55:31.000000",
101
+ "shareUrl": "https://vine.co/v/bxr5qJqD21A",
102
+ "promoted": 0
103
+ }
104
+ ],
105
+ "nextPage": 2,
106
+ "anchor": 940337443817799700,
107
+ "previousPage": null,
108
+ "size": 20
109
+ },
110
+ "success": true,
111
+ "error": ""
112
+ }
@@ -0,0 +1,364 @@
1
+ {
2
+ "code": "",
3
+ "data": {
4
+ "count": 7,
5
+ "records": [
6
+ {
7
+ "username": "Josh Rowley",
8
+ "liked": false,
9
+ "description": ".@claudiacukrov is a natural.",
10
+ "tags": [],
11
+ "postVerified": null,
12
+ "userId": 908940759363887104,
13
+ "postFlags": 0,
14
+ "likes": {
15
+ "count": 0,
16
+ "records": [],
17
+ "nextPage": null,
18
+ "anchor": 0,
19
+ "previousPage": null,
20
+ "size": 10
21
+ },
22
+ "postToFacebook": 0,
23
+ "verified": 0,
24
+ "postId": 929866820515663900,
25
+ "explicitContent": 0,
26
+ "postToTwitter": 1,
27
+ "videoUrl": "https://v.cdn.vine.co/v/videos/4C1DA01F-D7E8-4306-A11B-6E0BC42C57A2-4059-0000034C0EF00A28_1.0.3.mp4?versionId=kQxyDqp87DyP.f4tK720hu1Bx_leF9HP",
28
+ "entities": [],
29
+ "created": "2013-03-30T19:29:00.000000",
30
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/4C1DA01F-D7E8-4306-A11B-6E0BC42C57A2-4059-0000034C0EF00A28_1.0.3.mp4.jpg?versionId=62yLVKOcMr7Onv6KWMa2s_Tklb1tHKQC",
31
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
32
+ "shareUrl": "https://vine.co/v/bIuM9QOl5HV",
33
+ "comments": {
34
+ "count": 0,
35
+ "records": [],
36
+ "nextPage": null,
37
+ "anchor": 0,
38
+ "previousPage": null,
39
+ "size": 10
40
+ },
41
+ "foursquareVenueId": null,
42
+ "location": "Brooklyn, NY",
43
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/4C1DA01F-D7E8-4306-A11B-6E0BC42C57A2-4059-0000034C0EF00A28_1.0.3.mp4?versionId=4zTP.h2MS2hvDEtFKx8peWLFNLikxSb5",
44
+ "promoted": 0,
45
+ "user": {
46
+ "username": "Josh Rowley",
47
+ "verified": 0,
48
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
49
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
50
+ "userId": 908940759363887104,
51
+ "location": "Brooklyn, NY",
52
+ "explicitContent": null
53
+ }
54
+ },
55
+ {
56
+ "username": "Josh Rowley",
57
+ "liked": false,
58
+ "description": "Five year old is killing it!",
59
+ "tags": [],
60
+ "postVerified": null,
61
+ "userId": 908940759363887104,
62
+ "postFlags": 0,
63
+ "likes": {
64
+ "count": 0,
65
+ "records": [],
66
+ "nextPage": null,
67
+ "anchor": 0,
68
+ "previousPage": null,
69
+ "size": 10
70
+ },
71
+ "postToFacebook": 0,
72
+ "verified": 0,
73
+ "postId": 927330361384517600,
74
+ "explicitContent": 0,
75
+ "postToTwitter": 1,
76
+ "videoUrl": "https://v.cdn.vine.co/v/videos/4A64A587-BD43-4631-9B7F-3F4FA42D4A5A-2344-00000172CE83C9FA_1.0.3.mp4?versionId=TT994QSHMwWeBoIKsn3bWbt78zoNkFVZ",
77
+ "entities": [],
78
+ "created": "2013-03-23T19:30:01.000000",
79
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/4A64A587-BD43-4631-9B7F-3F4FA42D4A5A-2344-00000172CE83C9FA_1.0.3.mp4.jpg?versionId=BOakwxrzAi8ny0pE4bI6UI89Dq6tSrhr",
80
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
81
+ "shareUrl": "https://vine.co/v/bDrLuTAOZxY",
82
+ "comments": {
83
+ "count": 0,
84
+ "records": [],
85
+ "nextPage": null,
86
+ "anchor": 0,
87
+ "previousPage": null,
88
+ "size": 10
89
+ },
90
+ "foursquareVenueId": null,
91
+ "location": "Brooklyn, NY",
92
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/4A64A587-BD43-4631-9B7F-3F4FA42D4A5A-2344-00000172CE83C9FA_1.0.3.mp4?versionId=m_TMO5.GxGTP1LFgCQ94_xb0jGiE7kpV",
93
+ "promoted": 0,
94
+ "user": {
95
+ "username": "Josh Rowley",
96
+ "verified": 0,
97
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
98
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
99
+ "userId": 908940759363887104,
100
+ "location": "Brooklyn, NY",
101
+ "explicitContent": null
102
+ }
103
+ },
104
+ {
105
+ "username": "Josh Rowley",
106
+ "liked": false,
107
+ "description": "Even the kids are getting funky",
108
+ "tags": [],
109
+ "postVerified": null,
110
+ "userId": 908940759363887104,
111
+ "postFlags": 0,
112
+ "likes": {
113
+ "count": 0,
114
+ "records": [],
115
+ "nextPage": null,
116
+ "anchor": 0,
117
+ "previousPage": null,
118
+ "size": 10
119
+ },
120
+ "postToFacebook": 0,
121
+ "verified": 0,
122
+ "postId": 927328754152390700,
123
+ "explicitContent": 0,
124
+ "postToTwitter": 1,
125
+ "videoUrl": "https://v.cdn.vine.co/v/videos/10621FB8-07E1-41C1-8064-590056345A73-2312-000001715E04A111_1.0.3.mp4?versionId=3G8o5QR7fcEYVyMlnD_uq_EJux4wW7aA",
126
+ "entities": [],
127
+ "created": "2013-03-23T19:23:37.000000",
128
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/10621FB8-07E1-41C1-8064-590056345A73-2312-000001715E04A111_1.0.3.mp4.jpg?versionId=ZYp3NVCw_uzaFcM7H2KLpCMrKPn89ftF",
129
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
130
+ "shareUrl": "https://vine.co/v/bDrVIwJe6u5",
131
+ "comments": {
132
+ "count": 0,
133
+ "records": [],
134
+ "nextPage": null,
135
+ "anchor": 0,
136
+ "previousPage": null,
137
+ "size": 10
138
+ },
139
+ "foursquareVenueId": null,
140
+ "location": "Brooklyn, NY",
141
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/10621FB8-07E1-41C1-8064-590056345A73-2312-000001715E04A111_1.0.3.mp4?versionId=eK19xhke9CPvO655AQry9EAIx_FQHwjZ",
142
+ "promoted": 0,
143
+ "user": {
144
+ "username": "Josh Rowley",
145
+ "verified": 0,
146
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
147
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
148
+ "userId": 908940759363887104,
149
+ "location": "Brooklyn, NY",
150
+ "explicitContent": null
151
+ }
152
+ },
153
+ {
154
+ "username": "Josh Rowley",
155
+ "liked": false,
156
+ "description": "",
157
+ "tags": [],
158
+ "postVerified": null,
159
+ "userId": 908940759363887104,
160
+ "postFlags": 0,
161
+ "likes": {
162
+ "count": 0,
163
+ "records": [],
164
+ "nextPage": null,
165
+ "anchor": 0,
166
+ "previousPage": null,
167
+ "size": 10
168
+ },
169
+ "postToFacebook": 0,
170
+ "verified": 0,
171
+ "postId": 927321023194476500,
172
+ "explicitContent": 0,
173
+ "postToTwitter": 1,
174
+ "videoUrl": "https://v.cdn.vine.co/v/videos/65BDC558-2987-469A-A32C-33FF2480E645-2179-0000016BDCA8F326_1.0.3.mp4?versionId=ntcJOtai0e5lmepzZSk8pYtGyBgKkIlH",
175
+ "entities": [],
176
+ "created": "2013-03-23T18:52:54.000000",
177
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/65BDC558-2987-469A-A32C-33FF2480E645-2179-0000016BDCA8F326_1.0.3.mp4.jpg?versionId=pe0zDcVi8s_aODUmP8wxkLds0bRjkhm7",
178
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
179
+ "shareUrl": "https://vine.co/v/bDrTMBUVvl3",
180
+ "comments": {
181
+ "count": 0,
182
+ "records": [],
183
+ "nextPage": null,
184
+ "anchor": 0,
185
+ "previousPage": null,
186
+ "size": 10
187
+ },
188
+ "foursquareVenueId": null,
189
+ "location": "Brooklyn, NY",
190
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/65BDC558-2987-469A-A32C-33FF2480E645-2179-0000016BDCA8F326_1.0.3.mp4?versionId=lILQlm2pSdv4l3ZxgjEIcU0jC2eEbA8C",
191
+ "promoted": 0,
192
+ "user": {
193
+ "username": "Josh Rowley",
194
+ "verified": 0,
195
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
196
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
197
+ "userId": 908940759363887104,
198
+ "location": "Brooklyn, NY",
199
+ "explicitContent": null
200
+ }
201
+ },
202
+ {
203
+ "username": "Josh Rowley",
204
+ "liked": false,
205
+ "description": "And lots of dancing",
206
+ "tags": [],
207
+ "postVerified": null,
208
+ "userId": 908940759363887104,
209
+ "postFlags": 0,
210
+ "likes": {
211
+ "count": 0,
212
+ "records": [],
213
+ "nextPage": null,
214
+ "anchor": 0,
215
+ "previousPage": null,
216
+ "size": 10
217
+ },
218
+ "postToFacebook": 0,
219
+ "verified": 0,
220
+ "postId": 927315208551153700,
221
+ "explicitContent": 0,
222
+ "postToTwitter": 1,
223
+ "videoUrl": "https://v.cdn.vine.co/v/videos/2539518C-8973-43F0-AF6D-28E7D679A2D4-2179-000001688BA22417_1.0.3.mp4?versionId=.QuPJVM2JzdXjau5nj.urWXlTxJXC3qc",
224
+ "entities": [],
225
+ "created": "2013-03-23T18:29:48.000000",
226
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/2539518C-8973-43F0-AF6D-28E7D679A2D4-2179-000001688BA22417_1.0.3.mp4.jpg?versionId=8E2AZsBLo9F_r9sNluZI9vxCYZ5hE732",
227
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
228
+ "shareUrl": "https://vine.co/v/bDrgTYZYtzW",
229
+ "comments": {
230
+ "count": 0,
231
+ "records": [],
232
+ "nextPage": null,
233
+ "anchor": 0,
234
+ "previousPage": null,
235
+ "size": 10
236
+ },
237
+ "foursquareVenueId": null,
238
+ "location": "Brooklyn, NY",
239
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/2539518C-8973-43F0-AF6D-28E7D679A2D4-2179-000001688BA22417_1.0.3.mp4?versionId=xHcLCfxtydVAyBmRw0NCXfbixFN7WH8r",
240
+ "promoted": 0,
241
+ "user": {
242
+ "username": "Josh Rowley",
243
+ "verified": 0,
244
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
245
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
246
+ "userId": 908940759363887104,
247
+ "location": "Brooklyn, NY",
248
+ "explicitContent": null
249
+ }
250
+ },
251
+ {
252
+ "username": "Josh Rowley",
253
+ "liked": false,
254
+ "description": "Dancing",
255
+ "tags": [],
256
+ "postVerified": null,
257
+ "userId": 908940759363887104,
258
+ "postFlags": 0,
259
+ "likes": {
260
+ "count": 0,
261
+ "records": [],
262
+ "nextPage": null,
263
+ "anchor": 0,
264
+ "previousPage": null,
265
+ "size": 10
266
+ },
267
+ "postToFacebook": 0,
268
+ "verified": 0,
269
+ "postId": 927314204761919500,
270
+ "explicitContent": 0,
271
+ "postToTwitter": 0,
272
+ "videoUrl": "https://v.cdn.vine.co/v/videos/B91FEE8B-9C74-4BB6-8380-45FE4792454D-2179-000001670402E9DB_1.0.3.mp4?versionId=.jiQ7fL3L3VCGKGeWiQiiNp94.udCxDJ",
273
+ "entities": [],
274
+ "created": "2013-03-23T18:25:49.000000",
275
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/B91FEE8B-9C74-4BB6-8380-45FE4792454D-2179-000001670402E9DB_1.0.3.mp4.jpg?versionId=9_HA.V8LdrJZMsKrLQJ5CtpmpKtvLR.6",
276
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
277
+ "comments": {
278
+ "count": 0,
279
+ "records": [],
280
+ "nextPage": null,
281
+ "anchor": 0,
282
+ "previousPage": null,
283
+ "size": 10
284
+ },
285
+ "foursquareVenueId": null,
286
+ "location": "Brooklyn, NY",
287
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/B91FEE8B-9C74-4BB6-8380-45FE4792454D-2179-000001670402E9DB_1.0.3.mp4?versionId=Fr8dr8wm5qwRd3Hp.laq34c2bhaYNd6U",
288
+ "promoted": 0,
289
+ "user": {
290
+ "username": "Josh Rowley",
291
+ "verified": 0,
292
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
293
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
294
+ "userId": 908940759363887104,
295
+ "location": "Brooklyn, NY",
296
+ "explicitContent": null
297
+ }
298
+ },
299
+ {
300
+ "username": "Josh Rowley",
301
+ "liked": false,
302
+ "description": "Ghanaian naming ceremonies are a ton of fun!",
303
+ "tags": [],
304
+ "venueCategoryId": "4bf58dd8d48988d1e2931735",
305
+ "postVerified": null,
306
+ "userId": 908940759363887104,
307
+ "postFlags": 0,
308
+ "likes": {
309
+ "count": 0,
310
+ "records": [],
311
+ "nextPage": null,
312
+ "anchor": 0,
313
+ "previousPage": null,
314
+ "size": 10
315
+ },
316
+ "postToFacebook": 1,
317
+ "verified": 0,
318
+ "postId": 927310990071185400,
319
+ "explicitContent": 0,
320
+ "venueCategoryShortName": "Art Gallery",
321
+ "venueState": "NJ",
322
+ "venueAddress": "240 Mount Vernon Place",
323
+ "venueCategoryIconUrl": "https://foursquare.com/img/categories_v2/arts_entertainment/artgallery_32.png",
324
+ "postToTwitter": 1,
325
+ "videoUrl": "https://v.cdn.vine.co/v/videos/7220842C-5E4A-4B8F-AA9E-CB16DFE05D9D-2119-00000164F6751154_1.0.3.mp4?versionId=zUq80.DIj1QM7HnGFx45lYD9EWzCcZqZ",
326
+ "entities": [],
327
+ "created": "2013-03-23T18:13:02.000000",
328
+ "thumbnailUrl": "https://v.cdn.vine.co/v/thumbs/7220842C-5E4A-4B8F-AA9E-CB16DFE05D9D-2119-00000164F6751154_1.0.3.mp4.jpg?versionId=y561QxZxRjAvNcE9MUYgzBxr_4MhHW70",
329
+ "venueName": "Ivy Hill Park Apartments",
330
+ "avatarUrl": "https://v.cdn.vine.co/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
331
+ "shareUrl": "https://vine.co/v/bDrJ6mmEpbg",
332
+ "comments": {
333
+ "count": 0,
334
+ "records": [],
335
+ "nextPage": null,
336
+ "anchor": 0,
337
+ "previousPage": null,
338
+ "size": 10
339
+ },
340
+ "foursquareVenueId": "4b9e42c5f964a520b9d536e3",
341
+ "location": "Brooklyn, NY",
342
+ "videoLowURL": "https://v.cdn.vine.co/v/videos_500k/7220842C-5E4A-4B8F-AA9E-CB16DFE05D9D-2119-00000164F6751154_1.0.3.mp4?versionId=V9iBKaqtlmGPXGQeE7d1kRqOaWwQ5InE",
343
+ "promoted": 0,
344
+ "venueCountryCode": "US",
345
+ "venueCity": "Newark",
346
+ "user": {
347
+ "username": "Josh Rowley",
348
+ "verified": 0,
349
+ "description": "developer @sidetour. @flatironschool grad. &hearts; coding, baseball, skiing, improv, camping, and traveling the world. blog @ http://jrowdev.com",
350
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/5516E52A-8699-455F-9CD0-8DEA93FD457C-736-000000A30FAFA41B.jpg?versionId=DyLODkv2VTvqlkyQkHhhHuNI6luW9EkV",
351
+ "userId": 908940759363887104,
352
+ "location": "Brooklyn, NY",
353
+ "explicitContent": null
354
+ }
355
+ }
356
+ ],
357
+ "nextPage": null,
358
+ "anchor": 927310990071185400,
359
+ "previousPage": null,
360
+ "size": 20
361
+ },
362
+ "success": true,
363
+ "error": ""
364
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "code": "",
3
+ "data": {
4
+ "username": "Lee Ourand",
5
+ "followerCount": 34,
6
+ "verified": 0,
7
+ "description": "8 essential vitamins and minerals",
8
+ "avatarUrl": "https://vines.s3.amazonaws.com/v/avatars/308B53A5-99CE-42FA-9BD4-DA60533E489A-4725-000002C8444F3E10.jpg?versionId=VyfeLumV67TpFHDk054fN53Y5wtAb978",
9
+ "userId": 907189074719289344,
10
+ "likeCount": 0,
11
+ "following": 0,
12
+ "postCount": 5,
13
+ "location": "Brooklyn,NY",
14
+ "followingCount": 0,
15
+ "explicitContent": 0,
16
+ "blocking": 0,
17
+ "blocked": 0
18
+ },
19
+ "success": true,
20
+ "error": ""
21
+ }
data/test/helper.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'json'
5
+
6
+ require 'fakeweb'
7
+
8
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
10
+ require 'pergola'
11
+
12
+
13
+ # Set the default allow_net_connect option--usually you'll want this off.
14
+ # You don't usually want your test suite to make HTTP connections, do you?
15
+ FakeWeb.allow_net_connect = false
16
+
17
+ class Test::Unit::TestCase
18
+ end
19
+
20
+ def fixture_file(filename)
21
+ return '' if filename == ''
22
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
23
+ File.read(file_path)
24
+ end
25
+
26
+ def vine_url(url, options={})
27
+ url =~ /^http/ ? url : "https://api.vineapp.com#{url}"
28
+ end
29
+
30
+ def stub_request(method, url, filename, status=nil)
31
+ options = {:body => ""}
32
+ options.merge!({:body => fixture_file(filename)}) if filename
33
+ options.merge!({:body => status.last}) if status
34
+ options.merge!({:status => status}) if status
35
+
36
+ FakeWeb.register_uri(method, vine_url(url), options)
37
+ end
38
+
39
+ def stub_get(*args); stub_request(:get, *args) end
40
+ def stub_post(*args); stub_request(:post, *args) end
41
+ def stub_delete(*args); stub_request(:delete, *args) end
@@ -0,0 +1,91 @@
1
+ require_relative 'helper'
2
+
3
+ class PergolaTest < Test::Unit::TestCase
4
+
5
+ context "Pergola Client" do
6
+
7
+ def setup
8
+ stub_post("/users/authenticate", "authentication.json")
9
+ @client = Pergola::Client.new(:username => "josh.rowley@gmail.com", :password => "sekret")
10
+ @another_client_id = 907189074719289344
11
+ end
12
+
13
+ should "return the attributes of a user" do
14
+ assert_equal @client.user_id, 908940759363887104
15
+ assert_equal @client.session, "908940759363887104-3931d3e3-e22a-40e5-8913-468544543a07"
16
+ end
17
+
18
+ should "initialize with a session only" do
19
+ @client = Pergola::Client.new(token: "908940759363887104-3931d3e3-e22a-40e5-8913-468544543a07")
20
+ assert_equal @client.user_id, "908940759363887104"
21
+ assert_equal @client.session, "908940759363887104-3931d3e3-e22a-40e5-8913-468544543a07"
22
+ end
23
+
24
+
25
+ should "#me" do
26
+ stub_get("/users/me", "profile.json")
27
+ profile = Pergola.me
28
+ assert_equal profile["data"]["userId"], @client.user_id
29
+ end
30
+
31
+ should "#profile" do
32
+ stub_get("/users/profiles/#{@client.user_id}", "profile.json")
33
+ profile = Pergola.profile
34
+ assert_equal profile["data"]["userId"], @client.user_id
35
+ end
36
+
37
+ should "#profile with a parameter" do
38
+ stub_get("/users/profiles/#{@another_client_id}", "user.json")
39
+ profile = Pergola.profile(907189074719289344)
40
+ assert_not_equal profile["data"]["userId"], @client.user_id
41
+ assert_equal profile["data"]["userId"], @another_client_id
42
+ end
43
+
44
+ should '#timeline' do
45
+ stub_get("/timelines/users/#{@client.user_id}", "timeline.json")
46
+ timeline = Pergola.timeline
47
+ assert_equal timeline["data"]['records'][0]["userId"], @client.user_id
48
+ end
49
+
50
+ should '#timeline with a parameter' do
51
+ stub_get("/timelines/users/#{@client.user_id}", "timeline.json")
52
+ timeline = Pergola.timeline(@client.user_id)
53
+ assert_equal timeline["data"]['records'][0]["userId"], @client.user_id
54
+ end
55
+
56
+ should '#get_notifications' do
57
+ stub_get("/users/#{@client.user_id}/pendingNotificationsCount", "notification.json")
58
+ notification = Pergola.get_notifications
59
+ assert_equal notification["success"], true
60
+ end
61
+
62
+ should '#popular' do
63
+ stub_get("/timelines/popular", "popular.json")
64
+ popular = Pergola.popular
65
+ assert_equal popular["success"], true
66
+ end
67
+
68
+ should '#with_tag()' do
69
+ tag = "carrot"
70
+ stub_get("/timelines/tags/#{tag}", "tagged.json")
71
+ subject = Pergola.with_tag(tag)
72
+ assert_equal subject["data"]["records"][0]["tags"][0]["tag"], tag
73
+ end
74
+
75
+ should '#logout' do
76
+ stub_delete("/users/authenticate", "logout.json")
77
+ logout = Pergola.logout
78
+ assert_equal logout["success"], true
79
+ end
80
+
81
+ should "reinitialize with config variables if token fails" do
82
+ stub_get("/users/me", "profile.json")
83
+ @expired_client = Pergola::Client.new(token: "908940759363887104-3931d3e3-e22a-40e5-8913-468544543b32") #note the last 3 digits
84
+ profile = @expired_client.me
85
+ assert_equal profile["data"]["userId"], @client.user_id
86
+ end
87
+
88
+
89
+ end
90
+
91
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pergola
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - adamjonas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A ruby wrapper for the Vine API.
42
+ email:
43
+ - adam.jonas@carrotcreative.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - examples/curl_httparty_requests.rb
54
+ - lib/pergola.rb
55
+ - lib/pergola/client.rb
56
+ - lib/pergola/configuration.rb
57
+ - lib/pergola/version.rb
58
+ - pergola.gemspec
59
+ - test/fixtures/authentication.json
60
+ - test/fixtures/logout.json
61
+ - test/fixtures/notification.json
62
+ - test/fixtures/popular.json
63
+ - test/fixtures/profile.json
64
+ - test/fixtures/tagged.json
65
+ - test/fixtures/timeline.json
66
+ - test/fixtures/user.json
67
+ - test/helper.rb
68
+ - test/pergola_test.rb
69
+ homepage: http://carrot.is/adamjonas
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.0.0
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: Tame the Vine API with pergola.
93
+ test_files:
94
+ - test/fixtures/authentication.json
95
+ - test/fixtures/logout.json
96
+ - test/fixtures/notification.json
97
+ - test/fixtures/popular.json
98
+ - test/fixtures/profile.json
99
+ - test/fixtures/tagged.json
100
+ - test/fixtures/timeline.json
101
+ - test/fixtures/user.json
102
+ - test/helper.rb
103
+ - test/pergola_test.rb