totter 0.2.10 → 0.2.11
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.
- data/lib/totter/client/avatars.rb +4 -4
- data/lib/totter/client/choices.rb +4 -4
- data/lib/totter/client/comments.rb +3 -3
- data/lib/totter/client/configuration.rb +15 -0
- data/lib/totter/client/decisions.rb +7 -7
- data/lib/totter/client/slugs.rb +1 -1
- data/lib/totter/client/stickers.rb +2 -2
- data/lib/totter/client/timelines.rb +7 -7
- data/lib/totter/client/users.rb +1 -1
- data/lib/totter/client.rb +3 -1
- data/lib/totter/version.rb +1 -1
- data/test/cassettes/configuration/configuration.yml +50 -0
- data/test/totter/client/configuration_test.rb +9 -0
- metadata +10 -2
@@ -8,7 +8,7 @@ module Totter
|
|
8
8
|
# @param avatar_id [Numeric] The avatar id
|
9
9
|
# @return [Hashie::Mash]
|
10
10
|
# @example
|
11
|
-
#
|
11
|
+
# Totter.avatar(1, 1)
|
12
12
|
def avatar(user_id, avatar_id)
|
13
13
|
get "users/#{user_id}/avatars/#{avatar_id}"
|
14
14
|
end
|
@@ -18,7 +18,7 @@ module Totter
|
|
18
18
|
# @param user_id [Numeric] The avatar's user id
|
19
19
|
# @return [Array]
|
20
20
|
# @example
|
21
|
-
#
|
21
|
+
# Totter.avatar(1)
|
22
22
|
def avatars(user_id)
|
23
23
|
get "users/#{user_id}/avatars"
|
24
24
|
end
|
@@ -29,7 +29,7 @@ module Totter
|
|
29
29
|
# @param redirect_url [String] The URL to redirect the browser on completion of the upload (optional)
|
30
30
|
# @return [Hashie::Mash]
|
31
31
|
# @example
|
32
|
-
#
|
32
|
+
# Totter.create_avatar(1, 'http://google.com')
|
33
33
|
def create_avatar(user_id, redirect_url = nil)
|
34
34
|
data = {}
|
35
35
|
data[:redirect_url] = redirect_url if redirect_url
|
@@ -42,7 +42,7 @@ module Totter
|
|
42
42
|
# @param avatar_id [Numeric] The avatar id
|
43
43
|
# @return [Boolean] True if follow was successful, false otherwise.
|
44
44
|
# @example
|
45
|
-
#
|
45
|
+
# Totter.destroy_avatar(1, 1)
|
46
46
|
def destroy_avatar(user_id, avatar_id)
|
47
47
|
boolean_from_response :delete, "users/#{user_id}/avatars/#{avatar_id}"
|
48
48
|
end
|
@@ -9,7 +9,7 @@ module Totter
|
|
9
9
|
# @param choice_id [Numeric] The choice's id
|
10
10
|
# @return [Hashie::Mash]
|
11
11
|
# @example
|
12
|
-
#
|
12
|
+
# Totter.choice(1, 1, 1)
|
13
13
|
def choice(user_id, decision_id, choice_id)
|
14
14
|
get "users/#{user_id}/decisions/#{decision_id}/choices/#{choice_id}"
|
15
15
|
end
|
@@ -26,7 +26,7 @@ module Totter
|
|
26
26
|
# @option options [String] :link_title The title of a link to this image's page
|
27
27
|
# @return [Hashie::Mash]
|
28
28
|
# @example
|
29
|
-
#
|
29
|
+
# Totter.create_choice_for_image(1, 1, image_url: 'http://recess.s3.amazonaws.com/default_avatars/v1/photo_1.png', \
|
30
30
|
# subject: 'Sample Avatar', link_url: 'https://seesaw.co', link_title: 'Seesaw')
|
31
31
|
def create_choice_for_image(user_id, decision_id, options = {})
|
32
32
|
raise ArgumentError.new('image_url option is required') unless options[:image_url]
|
@@ -53,7 +53,7 @@ module Totter
|
|
53
53
|
# @param decision_id [Numeric] The choice's decision's id
|
54
54
|
# @return [Hashie::Mash]
|
55
55
|
# @example
|
56
|
-
#
|
56
|
+
# Totter.create_choice_upload(1, 1)
|
57
57
|
def create_choice_upload(user_id, decision_id)
|
58
58
|
post "users/#{user_id}/decisions/#{decision_id}/choices"
|
59
59
|
end
|
@@ -65,7 +65,7 @@ module Totter
|
|
65
65
|
# @param choice_id [Numeric] The choice's id
|
66
66
|
# @return [Boolean] True if follow was successful, false otherwise.
|
67
67
|
# @example
|
68
|
-
#
|
68
|
+
# Totter.destroy_choice(1, 1)
|
69
69
|
def destroy_choice(user_id, decision_id, choice_id)
|
70
70
|
boolean_from_response :delete, "users/#{user_id}/decisions/#{decision_id}/choices/#{choice_id}"
|
71
71
|
end
|
@@ -8,7 +8,7 @@ module Totter
|
|
8
8
|
# @param decision_id [Numeric] The decision's id
|
9
9
|
# @return [Array]
|
10
10
|
# @example
|
11
|
-
#
|
11
|
+
# Totter.comments(1, 1)
|
12
12
|
def comments(user_id, decision_id)
|
13
13
|
get "users/#{user_id}/decisions/#{decision_id}/comments"
|
14
14
|
end
|
@@ -20,7 +20,7 @@ module Totter
|
|
20
20
|
# @param message [String] The comment body
|
21
21
|
# @return [Hashie::Mash]
|
22
22
|
# @example
|
23
|
-
#
|
23
|
+
# Totter.create_comment(1, 1, 'I love boots!')
|
24
24
|
def create_comment(user_id, decision_id, message)
|
25
25
|
options = {
|
26
26
|
comment: {
|
@@ -37,7 +37,7 @@ module Totter
|
|
37
37
|
# @param comment_id [Numeric] The comment id
|
38
38
|
# @return [Boolean]
|
39
39
|
# @example
|
40
|
-
#
|
40
|
+
# Totter.destroy_comment(1, 1, 15)
|
41
41
|
def destroy_comment(user_id, decision_id, comment_id)
|
42
42
|
boolean_from_response :delete, "users/#{user_id}/decisions/#{decision_id}/comments/#{comment_id}"
|
43
43
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Totter
|
2
|
+
class Client
|
3
|
+
# Client methods for working with configuration.
|
4
|
+
module Configuration
|
5
|
+
# Get the configuration from the API.
|
6
|
+
#
|
7
|
+
# @return [Hashie::Mash] A hash of configuration data.
|
8
|
+
# @example
|
9
|
+
# Totter.configuration
|
10
|
+
def configuration
|
11
|
+
get 'configuration'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -8,7 +8,7 @@ module Totter
|
|
8
8
|
# @param decision_id [Numeric] The decision's id
|
9
9
|
# @return [Hashie::Mash]
|
10
10
|
# @example
|
11
|
-
#
|
11
|
+
# Totter.decision(1, 1)
|
12
12
|
def decision(user_id, decision_id)
|
13
13
|
get "users/#{user_id}/decisions/#{decision_id}"
|
14
14
|
end
|
@@ -18,7 +18,7 @@ module Totter
|
|
18
18
|
# @param user_id [Numeric] A Seesaw user id
|
19
19
|
# @return [Hashie::Mash]
|
20
20
|
# @example
|
21
|
-
#
|
21
|
+
# Totter.create_decision(1)
|
22
22
|
def create_decision(user_id)
|
23
23
|
post "users/#{user_id}/decisions"
|
24
24
|
end
|
@@ -34,7 +34,7 @@ module Totter
|
|
34
34
|
# @option options [Hash] :choice_attributes Additional attributes for decision choices
|
35
35
|
# @return [Hashie::Mash]
|
36
36
|
# @example
|
37
|
-
#
|
37
|
+
# Totter.publish_decision(1, 1, question: 'Why is the sky blue?')
|
38
38
|
def publish_decision(user_id, decision_id, options = {})
|
39
39
|
decision_options = {
|
40
40
|
decision: options
|
@@ -49,7 +49,7 @@ module Totter
|
|
49
49
|
# @param decision_id [Numeric] The decision's id
|
50
50
|
# @return [Boolean] True if follow was successful, false otherwise.
|
51
51
|
# @example
|
52
|
-
#
|
52
|
+
# Totter.destroy_decision(1, 1)
|
53
53
|
def destroy_decision(user_id, decision_id)
|
54
54
|
boolean_from_response :delete, "users/#{user_id}/decisions/#{decision_id}"
|
55
55
|
end
|
@@ -60,7 +60,7 @@ module Totter
|
|
60
60
|
# @param decision_id [Numeric] The decision's id
|
61
61
|
# @return [Hashie::Mash]
|
62
62
|
# @example
|
63
|
-
#
|
63
|
+
# Totter.decision_analytics(1, 1)
|
64
64
|
def decision_analytics(user_id, decision_id)
|
65
65
|
get "users/#{user_id}/decisions/#{decision_id}/analytics"
|
66
66
|
end
|
@@ -71,7 +71,7 @@ module Totter
|
|
71
71
|
# @param decision_id [Numeric] The decision's id
|
72
72
|
# @return [Boolean] True if follow was successful, false otherwise.
|
73
73
|
# @example
|
74
|
-
#
|
74
|
+
# Totter.flag_decision(1, 1)
|
75
75
|
def flag_decision(user_id, decision_id)
|
76
76
|
boolean_from_response :post, "users/#{user_id}/decisions/#{decision_id}/flag"
|
77
77
|
end
|
@@ -82,7 +82,7 @@ module Totter
|
|
82
82
|
# @param decision_id [Numeric] The decision's id
|
83
83
|
# @return [Boolean] True if follow was successful, false otherwise.
|
84
84
|
# @example
|
85
|
-
#
|
85
|
+
# Totter.unflag_decision(1, 1)
|
86
86
|
def unflag_decision(user_id, decision_id)
|
87
87
|
boolean_from_response :post, "users/#{user_id}/decisions/#{decision_id}/unflag"
|
88
88
|
end
|
data/lib/totter/client/slugs.rb
CHANGED
@@ -8,7 +8,7 @@ module Totter
|
|
8
8
|
# @param unique_id [String] an optional tracking string
|
9
9
|
# @return [Hashie::Mash]
|
10
10
|
# @example
|
11
|
-
#
|
11
|
+
# Totter.slug('d/3I0n0g')
|
12
12
|
def slug(id, unique_id = nil)
|
13
13
|
path = "slugs/#{id}"
|
14
14
|
path += "?unique_id=#{unique_id}" if unique_id
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Totter
|
2
2
|
class Client
|
3
3
|
# Client methods for working with stickers.
|
4
|
-
module
|
4
|
+
module Stickers
|
5
5
|
# Get all of the users with a given sticker.
|
6
6
|
#
|
7
7
|
# @param sticker_name [String] the sticker to get users for
|
8
8
|
# @return [Array] an array of `Hashie::Mash` objects representing users
|
9
9
|
# @example
|
10
|
-
#
|
10
|
+
# Totter.sticker('staff')
|
11
11
|
def sticker(sticker_name)
|
12
12
|
get "stickers/#{sticker_name}"
|
13
13
|
end
|
@@ -15,7 +15,7 @@ module Totter
|
|
15
15
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
16
16
|
# @return [Array] An array of `Hashie::Mash` objects representing decisions
|
17
17
|
# @example
|
18
|
-
#
|
18
|
+
# Totter.global_timeline(limit: 20, since: '1,15')
|
19
19
|
def global_timeline(options = DEFAULT_TIMELINE_OPTIONS)
|
20
20
|
get 'timelines/global', options
|
21
21
|
end
|
@@ -29,7 +29,7 @@ module Totter
|
|
29
29
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
30
30
|
# @return [Array] An array of `Hashie::Mash` objects representing decisions
|
31
31
|
# @example
|
32
|
-
#
|
32
|
+
# Totter.global_timeline(limit: 20, since: '1,15')
|
33
33
|
def hashtag_timeline(hashtag, options = DEFAULT_TIMELINE_OPTIONS)
|
34
34
|
get 'timelines/global', options.merge({hashtag: hashtag})
|
35
35
|
end
|
@@ -43,7 +43,7 @@ module Totter
|
|
43
43
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
44
44
|
# @return [Array]
|
45
45
|
# @example
|
46
|
-
#
|
46
|
+
# Totter.global_timeline(limit: 20, since: '1,15')
|
47
47
|
def sticker_timeline(sticker, options = DEFAULT_TIMELINE_OPTIONS)
|
48
48
|
get 'timelines/global', options.merge({sticker: sticker})
|
49
49
|
end
|
@@ -57,7 +57,7 @@ module Totter
|
|
57
57
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
58
58
|
# @return [Array] An array of `Hashie::Mash` objects representing decisions
|
59
59
|
# @example
|
60
|
-
#
|
60
|
+
# Totter.global_timeline(limit: 20, since: '1,15')
|
61
61
|
def search_timeline(query, options = DEFAULT_TIMELINE_OPTIONS)
|
62
62
|
get 'timelines/search', options.merge({query: query})
|
63
63
|
end
|
@@ -70,7 +70,7 @@ module Totter
|
|
70
70
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
71
71
|
# @return [Array] An array of `Hashie::Mash` objects representing decisions
|
72
72
|
# @example
|
73
|
-
#
|
73
|
+
# Totter.global_timeline(limit: 20, since: '1,15')
|
74
74
|
def flagged_timeline(options = DEFAULT_TIMELINE_OPTIONS)
|
75
75
|
get 'timelines/flagged', options
|
76
76
|
end
|
@@ -84,7 +84,7 @@ module Totter
|
|
84
84
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
85
85
|
# @return [Array] An array of `Hashie::Mash` objects representing decisions
|
86
86
|
# @example
|
87
|
-
#
|
87
|
+
# Totter.user_timeline(4, limit: 20, since: '1,15')
|
88
88
|
def user_timeline(user_id, options = DEFAULT_TIMELINE_OPTIONS)
|
89
89
|
get "users/#{user_id}/timelines/user", options
|
90
90
|
end
|
@@ -101,7 +101,7 @@ module Totter
|
|
101
101
|
# @option options [String] :until A user_id/decision_id pair in the format '1,15' when paging backwards
|
102
102
|
# @return [Array] An array of `Hashie::Mash` objects representing decisions
|
103
103
|
# @example
|
104
|
-
#
|
104
|
+
# Totter.friends_timeline(4, limit: 20, since: '1,15')
|
105
105
|
def friends_timeline(user_id, options = DEFAULT_TIMELINE_OPTIONS)
|
106
106
|
get "users/#{user_id}/timelines/friends", options
|
107
107
|
end
|
data/lib/totter/client/users.rb
CHANGED
data/lib/totter/client.rb
CHANGED
@@ -6,10 +6,12 @@ module Totter
|
|
6
6
|
Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
|
7
7
|
|
8
8
|
include Totter::Client::Avatars
|
9
|
-
include Totter::Client::Decisions
|
10
9
|
include Totter::Client::Choices
|
11
10
|
include Totter::Client::Comments
|
11
|
+
include Totter::Client::Configuration
|
12
|
+
include Totter::Client::Decisions
|
12
13
|
include Totter::Client::Slugs
|
14
|
+
include Totter::Client::Stickers
|
13
15
|
include Totter::Client::Timelines
|
14
16
|
include Totter::Client::Users
|
15
17
|
include Totter::Client::Votes
|
data/lib/totter/version.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.seesaw.co/v1/configuration
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Cache-Control:
|
22
|
+
- max-age=0, private, must-revalidate
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Date:
|
26
|
+
- Mon, 18 Feb 2013 13:44:46 GMT
|
27
|
+
Etag:
|
28
|
+
- ! '"94d49e0fd24e6f92c1cb6599d50b43c5"'
|
29
|
+
Server:
|
30
|
+
- thin 1.5.0 codename Knife
|
31
|
+
Strict-Transport-Security:
|
32
|
+
- max-age=31536000
|
33
|
+
X-Rack-Cache:
|
34
|
+
- miss
|
35
|
+
X-Request-Id:
|
36
|
+
- 9763cffde69b394f08afbd6627d2c18e
|
37
|
+
X-Runtime:
|
38
|
+
- '0.006196'
|
39
|
+
X-Ua-Compatible:
|
40
|
+
- IE=Edge,chrome=1
|
41
|
+
Content-Length:
|
42
|
+
- '323'
|
43
|
+
Connection:
|
44
|
+
- keep-alive
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: ! '{"api_version":"v1","view_url":"https://seesaw.co","max_invitiees":0,"decision_expiration":3600,"socket":{"auth_url":"https://api.seesaw.co/pusher/auth","app_id":27149,"app_key":"9f186e47577d6fa195b4"},"avatar_sizes":[35,70,80,160,320,640],"image_choice_sizes":[100,200,157,314,320,640],"updated_at":"2012-12-05T22:45:39Z"}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Mon, 18 Feb 2013 13:44:46 GMT
|
50
|
+
recorded_with: VCR 2.4.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: totter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-02-
|
14
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: multi_json
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/totter/client/avatars.rb
|
67
67
|
- lib/totter/client/choices.rb
|
68
68
|
- lib/totter/client/comments.rb
|
69
|
+
- lib/totter/client/configuration.rb
|
69
70
|
- lib/totter/client/decisions.rb
|
70
71
|
- lib/totter/client/slugs.rb
|
71
72
|
- lib/totter/client/stickers.rb
|
@@ -87,6 +88,7 @@ files:
|
|
87
88
|
- test/cassettes/comments/create.yml
|
88
89
|
- test/cassettes/comments/destroy.yml
|
89
90
|
- test/cassettes/comments/index.yml
|
91
|
+
- test/cassettes/configuration/configuration.yml
|
90
92
|
- test/cassettes/decisions/analytics.yml
|
91
93
|
- test/cassettes/decisions/create.yml
|
92
94
|
- test/cassettes/decisions/destroy.yml
|
@@ -115,6 +117,7 @@ files:
|
|
115
117
|
- test/totter/client/avatars_test.rb
|
116
118
|
- test/totter/client/choices_test.rb
|
117
119
|
- test/totter/client/comments_test.rb
|
120
|
+
- test/totter/client/configuration_test.rb
|
118
121
|
- test/totter/client/decisions_test.rb
|
119
122
|
- test/totter/client/slugs_test.rb
|
120
123
|
- test/totter/client/stickers_test.rb
|
@@ -143,6 +146,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
- - ! '>='
|
144
147
|
- !ruby/object:Gem::Version
|
145
148
|
version: '0'
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
hash: -859779867175174977
|
146
152
|
requirements: []
|
147
153
|
rubyforge_project:
|
148
154
|
rubygems_version: 1.8.23
|
@@ -161,6 +167,7 @@ test_files:
|
|
161
167
|
- test/cassettes/comments/create.yml
|
162
168
|
- test/cassettes/comments/destroy.yml
|
163
169
|
- test/cassettes/comments/index.yml
|
170
|
+
- test/cassettes/configuration/configuration.yml
|
164
171
|
- test/cassettes/decisions/analytics.yml
|
165
172
|
- test/cassettes/decisions/create.yml
|
166
173
|
- test/cassettes/decisions/destroy.yml
|
@@ -189,6 +196,7 @@ test_files:
|
|
189
196
|
- test/totter/client/avatars_test.rb
|
190
197
|
- test/totter/client/choices_test.rb
|
191
198
|
- test/totter/client/comments_test.rb
|
199
|
+
- test/totter/client/configuration_test.rb
|
192
200
|
- test/totter/client/decisions_test.rb
|
193
201
|
- test/totter/client/slugs_test.rb
|
194
202
|
- test/totter/client/stickers_test.rb
|