Class: Redvine
Constant Summary collapse
- VERSION =
"0.0.2"
- @@baseUrl =
'https://api.vineapp.com/'
- @@deviceToken =
'Redvine'
- @@userAgent =
'com.vine.iphone/1.01 (unknown, iPhone OS 6.0, iPad, Scale/2.000000) (Redvine)'
Instance Attribute Summary collapse
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#vine_key ⇒ Object
readonly
Returns the value of attribute vine_key.
Instance Method Summary collapse
- #connect(opts = {}) ⇒ Object
- #popular ⇒ Object
- #promoted ⇒ Object
- #search(tag) ⇒ Object
- #timeline ⇒ Object
- #user_profile(uid) ⇒ Object
- #user_timeline(uid) ⇒ Object
Instance Attribute Details
permalink #user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
6 7 8 |
# File 'lib/redvine.rb', line 6 def user_id @user_id end |
permalink #username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/redvine.rb', line 6 def username @username end |
permalink #vine_key ⇒ Object (readonly)
Returns the value of attribute vine_key.
6 7 8 |
# File 'lib/redvine.rb', line 6 def vine_key @vine_key end |
Instance Method Details
permalink #connect(opts = {}) ⇒ Object
[View source]
12 13 14 15 16 17 18 19 20 |
# File 'lib/redvine.rb', line 12 def connect(opts={}) validate_connect_args(opts) query = {username: opts[:email], password: opts[:password], deviceToken: @@deviceToken} headers = {'User-Agent' => @@userAgent} response = HTTParty.post(@@baseUrl + 'users/authenticate', {body: query, headers: headers}) @vine_key = response.parsed_response['data']['key'] @username = response.parsed_response['data']['username'] @user_id = response.parsed_response['data']['userId'] end |
permalink #popular ⇒ Object
[View source]
27 28 29 |
# File 'lib/redvine.rb', line 27 def popular get_request_data('timelines/popular') end |
permalink #promoted ⇒ Object
[View source]
31 32 33 |
# File 'lib/redvine.rb', line 31 def promoted get_request_data('timelines/promoted') end |
permalink #search(tag) ⇒ Object
22 23 24 25 |
# File 'lib/redvine.rb', line 22 def search(tag) raise(ArgumentError, 'You must specify a tag') if !tag get_request_data('timelines/tags/' + tag) end |
permalink #timeline ⇒ Object
[View source]
35 36 37 |
# File 'lib/redvine.rb', line 35 def timeline get_request_data('timelines/graph') end |
permalink #user_profile(uid) ⇒ Object
39 40 41 42 |
# File 'lib/redvine.rb', line 39 def user_profile(uid) raise(ArgumentError, 'You must specify a user id') if !uid get_request_data('users/profiles/' + uid, false) end |
permalink #user_timeline(uid) ⇒ Object
44 45 46 47 |
# File 'lib/redvine.rb', line 44 def user_timeline(uid) raise(ArgumentError, 'You must specify a user id') if !uid get_request_data('timelines/users/' + uid) end |