Class: Redvine
- Inherits:
-
Object
- Object
- Redvine
- Defined in:
- lib/redvine.rb,
lib/redvine/version.rb
Constant Summary collapse
- VERSION =
"0.0.3"- @@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
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
7 8 9 |
# File 'lib/redvine.rb', line 7 def user_id @user_id end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/redvine.rb', line 7 def username @username end |
#vine_key ⇒ Object (readonly)
Returns the value of attribute vine_key.
7 8 9 |
# File 'lib/redvine.rb', line 7 def vine_key @vine_key end |
Instance Method Details
#connect(opts = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/redvine.rb', line 13 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 |
#popular ⇒ Object
28 29 30 |
# File 'lib/redvine.rb', line 28 def popular get_request_data('timelines/popular') end |
#promoted ⇒ Object
32 33 34 |
# File 'lib/redvine.rb', line 32 def promoted get_request_data('timelines/promoted') end |
#search(tag) ⇒ Object
23 24 25 26 |
# File 'lib/redvine.rb', line 23 def search(tag) raise(ArgumentError, 'You must specify a tag') if !tag get_request_data('timelines/tags/' + tag) end |
#timeline ⇒ Object
36 37 38 |
# File 'lib/redvine.rb', line 36 def timeline get_request_data('timelines/graph') end |
#user_profile(uid) ⇒ Object
40 41 42 43 |
# File 'lib/redvine.rb', line 40 def user_profile(uid) raise(ArgumentError, 'You must specify a user id') if !uid get_request_data('users/profiles/' + uid, false) end |
#user_timeline(uid) ⇒ Object
45 46 47 48 |
# File 'lib/redvine.rb', line 45 def user_timeline(uid) raise(ArgumentError, 'You must specify a user id') if !uid get_request_data('timelines/users/' + uid) end |