snapcat 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +194 -0
  7. data/Rakefile +10 -0
  8. data/lib/snapcat.rb +19 -0
  9. data/lib/snapcat/client.rb +189 -0
  10. data/lib/snapcat/crypt.rb +35 -0
  11. data/lib/snapcat/friend.rb +57 -0
  12. data/lib/snapcat/media.rb +81 -0
  13. data/lib/snapcat/requestor.rb +106 -0
  14. data/lib/snapcat/response.rb +43 -0
  15. data/lib/snapcat/snap.rb +80 -0
  16. data/lib/snapcat/snapcat_error.rb +4 -0
  17. data/lib/snapcat/timestamp.rb +17 -0
  18. data/lib/snapcat/user.rb +46 -0
  19. data/snapcat.gemspec +28 -0
  20. data/spec/snapcat/client_spec.rb +217 -0
  21. data/spec/snapcat/crypt_spec.rb +27 -0
  22. data/spec/snapcat/friend_spec.rb +22 -0
  23. data/spec/snapcat/media_spec.rb +61 -0
  24. data/spec/snapcat/response_spec.rb +71 -0
  25. data/spec/snapcat/snap_spec.rb +72 -0
  26. data/spec/snapcat/timestamp_spec.rb +32 -0
  27. data/spec/snapcat/user_spec.rb +40 -0
  28. data/spec/snapcat_spec.rb +4 -0
  29. data/spec/spec_helper.rb +13 -0
  30. data/spec/support/data_helper.rb +20 -0
  31. data/spec/support/fixture.rb +70 -0
  32. data/spec/support/minitest_spec_context.rb +7 -0
  33. data/spec/support/request_stub.rb +322 -0
  34. data/spec/support/response_helper.rb +15 -0
  35. data/spec/support/responses/block_success.json +5 -0
  36. data/spec/support/responses/delete_success.json +5 -0
  37. data/spec/support/responses/login_success.json +91 -0
  38. data/spec/support/responses/logout_success.json +1 -0
  39. data/spec/support/responses/register_failure.json +4 -0
  40. data/spec/support/responses/register_success.json +6 -0
  41. data/spec/support/responses/registeru_failure.json +4 -0
  42. data/spec/support/responses/registeru_success.json +58 -0
  43. data/spec/support/responses/send_snap_success.json +1 -0
  44. data/spec/support/responses/set_display_name_failure.json +4 -0
  45. data/spec/support/responses/set_display_name_success.json +9 -0
  46. data/spec/support/responses/unblock_success.json +10 -0
  47. data/spec/support/responses/update_email_success.json +5 -0
  48. data/spec/support/responses/update_privacy_success.json +5 -0
  49. data/spec/support/responses/updates_success.json +97 -0
  50. data/spec/support/responses/upload_success.json +1 -0
  51. data/spec/support/snaps/image_decrypted.jpg +0 -0
  52. data/spec/support/snaps/image_encrypted.jpg +0 -0
  53. data/spec/support/snaps/video_decrypted.mp4 +0 -0
  54. data/spec/support/snaps/video_encrypted.mp4 +0 -0
  55. data/spec/support/user_experience.rb +20 -0
  56. metadata +218 -0
@@ -0,0 +1,15 @@
1
+ module ResponseHelper
2
+ extend self
3
+
4
+ def hash_for(response_name, status = :success)
5
+ raw_response = json_for(response_name, status)
6
+ JSON.parse(raw_response, { symbolize_names: true })
7
+ end
8
+
9
+ def json_for(response_name, status = :success)
10
+ File.open(
11
+ "#{SPEC_ROOT}/support/responses/#{response_name}_#{status}.json",
12
+ 'rb'
13
+ ).read
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ {
2
+ "message":"catsaregreat was blocked",
3
+ "param":"catsaregreat",
4
+ "logged":true
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "message": "catsaregreat was removed from your friends",
3
+ "param":"iluva",
4
+ "logged":true
5
+ }
@@ -0,0 +1,91 @@
1
+ {
2
+ "bests":[
3
+ "ronnie99",
4
+ "bigdog",
5
+ "catsaregreat"
6
+ ],
7
+ "is_vip":false,
8
+ "score":390,
9
+ "received":267,
10
+ "logged":true,
11
+ "added_friends":[
12
+ {
13
+ "ts":1376694306700,
14
+ "name":"catsaregreat",
15
+ "display":"John Smith",
16
+ "type":0
17
+ },
18
+
19
+ {
20
+ "ts":1377255695593,
21
+ "name":"bigdog",
22
+ "display":"Jay Whittaker",
23
+ "type":0
24
+ },
25
+ {
26
+ "ts":1377255695593,
27
+ "name":"ronnie99",
28
+ "display":"James Edison",
29
+ "type":0
30
+ }
31
+ ],
32
+ "requests":[
33
+
34
+ ],
35
+ "sent":108,
36
+ "story_privacy":"FRIENDS",
37
+ "username":"iluvkittens",
38
+ "snaps":[
39
+ {
40
+ "id":"519861384740350100r",
41
+ "sn":"ronnie99",
42
+ "t":6,
43
+ "ts":1384740350062,
44
+ "sts":1384740350062,
45
+ "m":0,
46
+ "st":1
47
+ }
48
+ ],
49
+ "friends":[
50
+ {
51
+ "can_see_custom_stories":true,
52
+ "name":"wraymond",
53
+ "display":"",
54
+ "type":1
55
+ },
56
+ {
57
+ "can_see_custom_stories":true,
58
+ "name":"ronnie99",
59
+ "display":"James Edison",
60
+ "type":0
61
+ },
62
+ {
63
+ "can_see_custom_stories":true,
64
+ "name":"catsaregreat",
65
+ "display":"John Smith",
66
+ "type":0
67
+ },
68
+ {
69
+ "can_see_custom_stories":true,
70
+ "name":"bigdog",
71
+ "display":"Jay Whittaker",
72
+ "type":0
73
+ }
74
+ ],
75
+ "device_token":"",
76
+ "snap_p":0,
77
+ "mobile_verification_key":"Ljlw0TppbKa2a250dGVucsM=",
78
+ "recents":[
79
+ "iluvkittens"
80
+ ],
81
+ "added_friends_timestamp":1382364149068,
82
+ "notification_sound_setting":"OFF",
83
+ "snapchat_phone_number":"+15553334444",
84
+ "auth_token":"60cae630-4c19-43e1-b930-cd819ea0133l",
85
+ "image_caption":false,
86
+ "country_code":"US",
87
+ "can_view_mature_content":false,
88
+ "email":"meow@meow.com",
89
+ "should_send_text_to_verify_number":true,
90
+ "mobile":"+19992229999"
91
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "message":"meow@meow.com is already taken! Login with that email address or try another one",
3
+ "logged":false
4
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "token":"9aeb294f-0cc0-4a8a-ae6c-0044e11b598c",
3
+ "email":"meow@meow.com",
4
+ "snapchat_phone_number":"+15554442222",
5
+ "logged":true
6
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "message":"Invalid username. Letters and numbers with an optional hyphen, underscore, or period in between please!",
3
+ "logged":false
4
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "bests":[
3
+
4
+ ],
5
+ "is_vip":false,
6
+ "score":0,
7
+ "received":0,
8
+ "logged":true,
9
+ "added_friends":[
10
+
11
+ ],
12
+ "requests":[
13
+
14
+ ],
15
+ "sent":0,
16
+ "story_privacy":"FRIENDS",
17
+ "username":"iluvkittens",
18
+ "snaps":[
19
+ {
20
+ "id":"119381384741764374r",
21
+ "sn":"teamsnapchat",
22
+ "t":10,
23
+ "ts":1384741764374,
24
+ "sts":1384741764374,
25
+ "m":0,
26
+ "st":1
27
+ }
28
+ ],
29
+ "friends":[
30
+ {
31
+ "can_see_custom_stories":true,
32
+ "name":"iluvkittens",
33
+ "display":"",
34
+ "type":0
35
+ },
36
+ {
37
+ "can_see_custom_stories":true,
38
+ "name":"teamsnapchat",
39
+ "display":"Team Snapchat",
40
+ "type":0
41
+ }
42
+ ],
43
+ "device_token":"",
44
+ "snap_p":1,
45
+ "mobile_verification_key":"MXkwMjpkwoFpc2kdUXNkZm9q",
46
+ "recents":[
47
+ "teamsnapchat"
48
+ ],
49
+ "added_friends_timestamp":0,
50
+ "notification_sound_setting":"OFF",
51
+ "snapchat_phone_number":"+17864088362",
52
+ "auth_token":"556563e7-362e-439d-8f20-6d3603f29b46",
53
+ "image_caption":false,
54
+ "can_view_mature_content":false,
55
+ "email":"meow@meow.com",
56
+ "should_send_text_to_verify_number":true,
57
+ "mobile":""
58
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ message":"Something went wrong.",
3
+ "logged":false
4
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "message":"Set the display name for catsaregreat to Johnny!",
3
+ "object":{
4
+ "can_see_custom_stories":true,
5
+ "name":"iluva",
6
+ "display":"Henrie McKitten",
7
+ "type":0
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "message":"catsaregreat was unblocked",
3
+ "object":{
4
+ "can_see_custom_stories":true,
5
+ "name":"catsaregreat",
6
+ "display":"",
7
+ "type":3
8
+ },
9
+ "logged":true
10
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "message":"Email updated",
3
+ "param":"cat@meow.com",
4
+ "logged":true
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "message":"Snap privacy updated",
3
+ "param":"0",
4
+ "logged":true
5
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "bests":[
3
+ "ronnie99",
4
+ "bigdog",
5
+ "catsaregreat"
6
+ ],
7
+ "is_vip":false,
8
+ "score":390,
9
+ "received":267,
10
+ "logged":true,
11
+ "added_friends":[
12
+ {
13
+ "ts":1376694306700,
14
+ "name":"catsaregreat",
15
+ "display":"John Smith",
16
+ "type":0
17
+ },
18
+
19
+ {
20
+ "ts":1377255695593,
21
+ "name":"bigdog",
22
+ "display":"Jay Whittaker",
23
+ "type":0
24
+ },
25
+ {
26
+ "ts":1377255695593,
27
+ "name":"ronnie99",
28
+ "display":"James Edison",
29
+ "type":0
30
+ }
31
+ ],
32
+ "requests":[
33
+
34
+ ],
35
+ "sent":108,
36
+ "story_privacy":"FRIENDS",
37
+ "username":"iluvkittens",
38
+ "snaps":[
39
+ {
40
+ "id":"519861384740350100r",
41
+ "sn":"ronnie99",
42
+ "t":6,
43
+ "ts":1384740350062,
44
+ "sts":1384740350062,
45
+ "m":0,
46
+ "st":1
47
+ }
48
+ ],
49
+ "friends":[
50
+ {
51
+ "can_see_custom_stories":true,
52
+ "name":"wraymond",
53
+ "display":"",
54
+ "type":1
55
+ },
56
+ {
57
+ "can_see_custom_stories":true,
58
+ "name":"ronnie99",
59
+ "display":"James Edison",
60
+ "type":0
61
+ },
62
+ {
63
+ "can_see_custom_stories":true,
64
+ "name":"catsaregreat",
65
+ "display":"John Smith",
66
+ "type":0
67
+ },
68
+ {
69
+ "can_see_custom_stories":true,
70
+ "name":"bigdog",
71
+ "display":"Jay Whittaker",
72
+ "type":0
73
+ },
74
+ {
75
+ "can_see_custom_stories":true,
76
+ "name":"jimmytwo",
77
+ "display":"Jimmy Two",
78
+ "type":0
79
+ }
80
+ ],
81
+ "device_token":"",
82
+ "snap_p":0,
83
+ "mobile_verification_key":"Ljlw0TppbKa2a250dGVucsM=",
84
+ "recents":[
85
+ "iluvkittens"
86
+ ],
87
+ "added_friends_timestamp":1382364149068,
88
+ "notification_sound_setting":"OFF",
89
+ "snapchat_phone_number":"+15553334444",
90
+ "auth_token":"60cae630-4c19-43e1-b930-cd819ea0133l",
91
+ "image_caption":false,
92
+ "country_code":"US",
93
+ "can_view_mature_content":false,
94
+ "email":"meow@meow.com",
95
+ "should_send_text_to_verify_number":true,
96
+ "mobile":"+19992229999"
97
+ }
@@ -0,0 +1,20 @@
1
+ class UserExperience
2
+ attr_reader :client, :user
3
+
4
+ def initialize
5
+ @client = Snapcat::Client.new(Fixture::USERNAME)
6
+ @user = @client.user
7
+ end
8
+
9
+ def friend
10
+ @user.friends.find { |friend| friend.username == Fixture::FRIEND_USERNAME }
11
+ end
12
+
13
+ def login
14
+ @client.login(Fixture::PASSWORD)
15
+ end
16
+
17
+ def snap
18
+ @user.snaps_received.first
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snapcat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Neal Kemp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httmultiparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.6.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
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: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '1.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '1.10'
97
+ description: Snapchat API wrapper
98
+ email:
99
+ - ''
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .travis.yml
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - lib/snapcat.rb
111
+ - lib/snapcat/client.rb
112
+ - lib/snapcat/crypt.rb
113
+ - lib/snapcat/friend.rb
114
+ - lib/snapcat/media.rb
115
+ - lib/snapcat/requestor.rb
116
+ - lib/snapcat/response.rb
117
+ - lib/snapcat/snap.rb
118
+ - lib/snapcat/snapcat_error.rb
119
+ - lib/snapcat/timestamp.rb
120
+ - lib/snapcat/user.rb
121
+ - snapcat.gemspec
122
+ - spec/snapcat/client_spec.rb
123
+ - spec/snapcat/crypt_spec.rb
124
+ - spec/snapcat/friend_spec.rb
125
+ - spec/snapcat/media_spec.rb
126
+ - spec/snapcat/response_spec.rb
127
+ - spec/snapcat/snap_spec.rb
128
+ - spec/snapcat/timestamp_spec.rb
129
+ - spec/snapcat/user_spec.rb
130
+ - spec/snapcat_spec.rb
131
+ - spec/spec_helper.rb
132
+ - spec/support/data_helper.rb
133
+ - spec/support/fixture.rb
134
+ - spec/support/minitest_spec_context.rb
135
+ - spec/support/request_stub.rb
136
+ - spec/support/response_helper.rb
137
+ - spec/support/responses/block_success.json
138
+ - spec/support/responses/delete_success.json
139
+ - spec/support/responses/login_success.json
140
+ - spec/support/responses/logout_success.json
141
+ - spec/support/responses/register_failure.json
142
+ - spec/support/responses/register_success.json
143
+ - spec/support/responses/registeru_failure.json
144
+ - spec/support/responses/registeru_success.json
145
+ - spec/support/responses/send_snap_success.json
146
+ - spec/support/responses/set_display_name_failure.json
147
+ - spec/support/responses/set_display_name_success.json
148
+ - spec/support/responses/unblock_success.json
149
+ - spec/support/responses/update_email_success.json
150
+ - spec/support/responses/update_privacy_success.json
151
+ - spec/support/responses/updates_success.json
152
+ - spec/support/responses/upload_success.json
153
+ - spec/support/snaps/image_decrypted.jpg
154
+ - spec/support/snaps/image_encrypted.jpg
155
+ - spec/support/snaps/video_decrypted.mp4
156
+ - spec/support/snaps/video_encrypted.mp4
157
+ - spec/support/user_experience.rb
158
+ homepage: https://github.com/NealKemp/snapcat
159
+ licenses:
160
+ - MIT
161
+ metadata: {}
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - '>='
169
+ - !ruby/object:Gem::Version
170
+ version: 1.9.3
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.0.7
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: Ruby wrapper for Snapchat's private API
182
+ test_files:
183
+ - spec/snapcat/client_spec.rb
184
+ - spec/snapcat/crypt_spec.rb
185
+ - spec/snapcat/friend_spec.rb
186
+ - spec/snapcat/media_spec.rb
187
+ - spec/snapcat/response_spec.rb
188
+ - spec/snapcat/snap_spec.rb
189
+ - spec/snapcat/timestamp_spec.rb
190
+ - spec/snapcat/user_spec.rb
191
+ - spec/snapcat_spec.rb
192
+ - spec/spec_helper.rb
193
+ - spec/support/data_helper.rb
194
+ - spec/support/fixture.rb
195
+ - spec/support/minitest_spec_context.rb
196
+ - spec/support/request_stub.rb
197
+ - spec/support/response_helper.rb
198
+ - spec/support/responses/block_success.json
199
+ - spec/support/responses/delete_success.json
200
+ - spec/support/responses/login_success.json
201
+ - spec/support/responses/logout_success.json
202
+ - spec/support/responses/register_failure.json
203
+ - spec/support/responses/register_success.json
204
+ - spec/support/responses/registeru_failure.json
205
+ - spec/support/responses/registeru_success.json
206
+ - spec/support/responses/send_snap_success.json
207
+ - spec/support/responses/set_display_name_failure.json
208
+ - spec/support/responses/set_display_name_success.json
209
+ - spec/support/responses/unblock_success.json
210
+ - spec/support/responses/update_email_success.json
211
+ - spec/support/responses/update_privacy_success.json
212
+ - spec/support/responses/updates_success.json
213
+ - spec/support/responses/upload_success.json
214
+ - spec/support/snaps/image_decrypted.jpg
215
+ - spec/support/snaps/image_encrypted.jpg
216
+ - spec/support/snaps/video_decrypted.mp4
217
+ - spec/support/snaps/video_encrypted.mp4
218
+ - spec/support/user_experience.rb