rvine 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16eda076cec664dcc88bb8c7f59416f5920e2d31
4
+ data.tar.gz: ed98fe9d5f403855681deed92facc7fb1323a5fa
5
+ SHA512:
6
+ metadata.gz: 198141d6fbb3ba459c96a128e01a0bcd8f45f42dada974620b9489c8c6bf4afdc0455f1609026264284b53670add8c4cf4d17eeda974bb4fa80339adef9dbb74
7
+ data.tar.gz: 2faf4111e196c671864e300d25eee634371b02aa7d5d9c28d411b5b63f4ac197dcf5f7f5616a0ac8a2f6e0b2f88ea1a942fda5a95eb3fdf9f258f2ce2083504d
@@ -0,0 +1,23 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rvine.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Kyuden
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.
@@ -0,0 +1,65 @@
1
+ # Rvine
2
+
3
+ A simple Ruby wrapper for the unofficial and undocumented Vine API.
4
+ Please pull-request.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'rvine'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install rvine
19
+
20
+ ## Usage
21
+
22
+ ### Get popular timeline
23
+ ```ruby
24
+ Rvine.popular_timeline
25
+ ```
26
+
27
+ ### Get tag's items
28
+ ```ruby
29
+ Rvine.tags 'ruby'
30
+ ```
31
+
32
+ ### Get a specified user's profile
33
+ ```ruby
34
+ user_id = '1234567890abcdefg'
35
+ Rvine.profile user_id
36
+ ```
37
+
38
+
39
+ ## Authenticated requests
40
+
41
+ ### Login with "username & password" or "key"
42
+ ```
43
+ rvine = Rvine.new url_name: 'kyuden', password: 'mysecret'
44
+ # or
45
+ rvine = Rvine.new key: 'authtoken'
46
+ ```
47
+
48
+ ### Get my data
49
+ ```ruby
50
+ rvine.me
51
+ ```
52
+
53
+ ## more
54
+ Read [code](https://github.com/VineAPI/VineAPI/blob/master/endpoints.md).
55
+
56
+ ## ToDo
57
+ All support [this](https://github.com/VineAPI/VineAPI/blob/master/endpoints.md)
58
+
59
+ ## Contributing
60
+
61
+ 1. Fork it ( https://github.com/[my-github-username]/rvine/fork )
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rvine'
@@ -0,0 +1,16 @@
1
+ require "rvine/version"
2
+ require "rvine/client"
3
+
4
+ module Rvine
5
+ class << self
6
+ def new options={}
7
+ Rvine::Client.new options
8
+ end
9
+
10
+ #Delegate to Rvine::Client.new
11
+ def method_missing(method, *args, &block)
12
+ return super unless new.respond_to?(method)
13
+ new.send(method, *args, &block)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,45 @@
1
+ require 'faraday_middleware'
2
+ require 'json'
3
+ require 'rvine/request'
4
+ require 'rvine/client/channels'
5
+ require 'rvine/client/posts'
6
+ require 'rvine/client/tags'
7
+ require 'rvine/client/timelines'
8
+ require 'rvine/client/users'
9
+
10
+ module Rvine
11
+ class Client
12
+ ROOT_URL = 'https://api.vineapp.com/'
13
+ LOGIN_ITEMS = [:key, :username, :password].freeze
14
+
15
+ attr_accessor *LOGIN_ITEMS
16
+
17
+ def initialize(args)
18
+ LOGIN_ITEMS.each do |item|
19
+ send("#{item}=", args[item])
20
+ end
21
+
22
+ login if !key && username && password
23
+ end
24
+
25
+ #endpoint
26
+ include Rvine::Client::Channels
27
+ include Rvine::Client::Posts
28
+ include Rvine::Client::Tags
29
+ include Rvine::Client::Timelines
30
+ include Rvine::Client::Users
31
+
32
+ private
33
+
34
+ def login
35
+ result = post('/users/authenticate', username: username, password: password)
36
+ @key = result['key']
37
+ end
38
+
39
+ def logout
40
+ delete '/users/authenticate'
41
+ end
42
+
43
+ include Rvine::Client::Request
44
+ end
45
+ end
@@ -0,0 +1,9 @@
1
+ module Rvine
2
+ class Client
3
+ module Channels
4
+ def featured_channels(params={})
5
+ get "channels/featured", params
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,41 @@
1
+ module Rvine
2
+ class Client
3
+ module Posts
4
+ def like(post_id, prams={})
5
+ post "posts/#{post_id}/likes", params
6
+ end
7
+
8
+ def unlike(post_id, prams={})
9
+ delete "posts/#{post_id}/likes", params
10
+ end
11
+
12
+ def comment(post_id, prams={})
13
+ post "posts/#{post_id}/comments", params
14
+ end
15
+
16
+ def uncomment(post_id, comment_id, prams={})
17
+ delete "posts/#{post_id}/comments/#{comment_id}", params
18
+ end
19
+
20
+ def revine(post_id, prams={})
21
+ post "posts/#{post_id}/repost", params
22
+ end
23
+
24
+ def unrevine(post_id, revine_id, prams={})
25
+ delete "posts/#{post_id}/repost/#{revine_id}", params
26
+ end
27
+
28
+ def report(post_id, prams={})
29
+ post "posts/#{post_id}/complaints", params
30
+ end
31
+
32
+ def post(prams={})
33
+ post "posts", params
34
+ end
35
+
36
+ def delete_post(post_id, prams={})
37
+ delete "posts/#{post_id}", params
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+ module Rvine
2
+ class Client
3
+ module Tags
4
+ def trending_tags(prams={})
5
+ get "tags/trending", prams
6
+ end
7
+
8
+ def tags(tag_name, prams={})
9
+ get "tags/search/#{tag_name}", prams
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,49 @@
1
+ module Rvine
2
+ class Client
3
+ module Timelines
4
+ def post_timeline(post_id, params={})
5
+ get "timelines/posts/#{post_id}", params
6
+ end
7
+
8
+ def user_timeline(user_id, params={})
9
+ get "timelines/posts/#{user_id}", params
10
+ end
11
+
12
+ def user_likes(user_id, params={})
13
+ get "timelines/users/#{user_id}/likes", params
14
+ end
15
+
16
+ def tag_timeline(tag_name, params={})
17
+ get "timelines/tags/#{tag_name}", params
18
+ end
19
+
20
+ def global_timeline(params={})
21
+ get "timelines/graph", params
22
+ end
23
+
24
+ def popular_timeline(params={})
25
+ get "timelines/popular", params
26
+ end
27
+
28
+ def ontherise_timeline(params={})
29
+ get "timelines/trending", params
30
+ end
31
+
32
+ def editorpicks_timeline(params={})
33
+ get "timelines/promoted", params
34
+ end
35
+
36
+ def channel_popular_timeline(channel_id, params={})
37
+ get "timelines/channels/#{channel_id}/popular", params
38
+ end
39
+
40
+ def channel_recent_timeline(channel_id, params={})
41
+ get "timelines/channels/#{channel_id}/recent", params
42
+ end
43
+
44
+ def venue_timeline(venue_id, params={})
45
+ get "timelines/venues/#{venue_id}", params
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,61 @@
1
+ module Rvine
2
+ class Client
3
+ module Users
4
+ def me
5
+ get "users/me"
6
+ end
7
+
8
+ def profile(user_id, params={})
9
+ get "users/profiles/#{user_id}", params
10
+ end
11
+
12
+ def update_profile(user_id, params={})
13
+ post "users/profiles/#{user_id}", params
14
+ end
15
+
16
+ def set_explicit(user_id, params={})
17
+ post "users/#{user_id}/explicit", params
18
+ end
19
+
20
+ def unset_explicit(user_id, params={})
21
+ delete "users/#{user_id}/explicit", params
22
+ end
23
+
24
+ def follow(user_id, params={})
25
+ post "users/#{user_id}/followers", params
26
+ end
27
+
28
+ def unfollow(user_id, params={})
29
+ delete "users/#{user_id}/followers", params
30
+ end
31
+
32
+ def block(user_id, block_user_id, params={})
33
+ post "users/#{user_id}/blocked/#{block_user_id}", params
34
+ end
35
+
36
+ def unblock(user_id, unblock_user_id, params={})
37
+ delete "users/#{user_id}/blocked/#{unblock_user_id}", params
38
+ end
39
+
40
+ def pending_notifications_count(user_id, params={})
41
+ get "users/#{user_id}/pendingNotificationsCount", params
42
+ end
43
+
44
+ def notifications(user_id, params={})
45
+ get "users/#{user_id}/notifications", params
46
+ end
47
+
48
+ def followers(user_id, params={})
49
+ get "users/#{user_id}/followers", params
50
+ end
51
+
52
+ def following(user_id, params={})
53
+ get "users/#{user_id}/following", params
54
+ end
55
+
56
+ def users(query, params={})
57
+ get "users/search/#{query}"
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,37 @@
1
+ module Rvine
2
+ class Client
3
+ module Request
4
+ [:get, :post, :delet, :put, :patch].each{ |verb| define_method(verb){ |path, params={}| request(verb, path, params)}}
5
+
6
+ def connection
7
+ options = {
8
+ url: ROOT_URL,
9
+ headers: {
10
+ accept: 'application/json',
11
+ user_agent: "com.vine.iphone/1.0.3 (unknown, iPhone OS 6.1.0, iPhone, Scale/2.000000)"
12
+ },
13
+ request: {
14
+ open_timeout: 5,
15
+ timeout: 10
16
+ },
17
+ ssl: {
18
+ verify: true
19
+ }
20
+ }
21
+
22
+ @connection ||= Faraday.new(options) do |faraday|
23
+ faraday.request :url_encoded
24
+ faraday.response :json
25
+ faraday.adapter :net_http
26
+ end
27
+ end
28
+
29
+ def request(method, path, params)
30
+ response = connection.send(method, path, params) do |req|
31
+ req[:vine_session_id] = @key if @key
32
+ end
33
+ response.body['data']
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,15 @@
1
+ module Rvine
2
+ class Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ class << self
8
+ def to_s
9
+ [MAJOR, MINOR, PATCH].compact.join('.')
10
+ end
11
+ end
12
+ end
13
+
14
+ VERSION = Version
15
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rvine/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rvine"
8
+ spec.version = Rvine::VERSION
9
+ spec.authors = ["Kyuden"]
10
+ spec.email = ["msmsms.um@gmail.com"]
11
+ spec.summary = %q{Ruby wrapper for Vine API}
12
+ spec.description = %q{Ruby wrapper for Vine API}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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_runtime_dependency 'faraday'
22
+ spec.add_runtime_dependency 'faraday_middleware'
23
+ spec.add_runtime_dependency 'json'
24
+
25
+ spec.add_development_dependency "bundler"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec", '~> 2.14.1'
28
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rvine do
4
+ it 'has a version number' do
5
+ expect(Rvine::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'rvine'
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rvine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kyuden
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.14.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.14.1
97
+ description: Ruby wrapper for Vine API
98
+ email:
99
+ - msmsms.um@gmail.com
100
+ executables:
101
+ - rvine
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".travis.yml"
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - bin/rvine
113
+ - lib/rvine.rb
114
+ - lib/rvine/client.rb
115
+ - lib/rvine/client/channels.rb
116
+ - lib/rvine/client/posts.rb
117
+ - lib/rvine/client/tags.rb
118
+ - lib/rvine/client/timelines.rb
119
+ - lib/rvine/client/users.rb
120
+ - lib/rvine/request.rb
121
+ - lib/rvine/version.rb
122
+ - rvine.gemspec
123
+ - spec/rvine_spec.rb
124
+ - spec/spec_helper.rb
125
+ homepage: ''
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.2.2
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Ruby wrapper for Vine API
149
+ test_files:
150
+ - spec/rvine_spec.rb
151
+ - spec/spec_helper.rb