snapcat 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/snapcat/client.rb +8 -0
- data/lib/snapcat/requestor.rb +2 -0
- data/snapcat.gemspec +2 -2
- data/spec/snapcat/client_spec.rb +22 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aef10d3c529df778a318445e623c2f40326b9eca
|
4
|
+
data.tar.gz: a80ad2981ef72c4edbfd3fb9eed71c870a23a621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b4418a99a483435d91e786261700ac97277d8321f6a50a1282da3f77978abeaa4973a748d845a001f59ef433db8ac93e1d6b3bf79f9e6ecfe612cf34bfe7c8a
|
7
|
+
data.tar.gz: e5f0c9e61597ec7ea2f93841183e9fef759c96c23c620cff89eae58f96a557a74cd34381b0150dec61a872a138defa710440944910a5a9c39111337cba11cd58
|
data/README.md
CHANGED
@@ -181,6 +181,20 @@ snap.sent
|
|
181
181
|
snap.opened
|
182
182
|
```
|
183
183
|
|
184
|
+
**Advanced User Auth**
|
185
|
+
|
186
|
+
The standard `login` method will log out all other sessions. If you want to use
|
187
|
+
Snapcat in multiple concurrent processes, you need to share this token across
|
188
|
+
processes and set it manually.
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
# Fetch token
|
192
|
+
snapcat.client.auth_token
|
193
|
+
|
194
|
+
# Set token
|
195
|
+
snapcat.client.auth_token = '1c7e8f83-1379-4694-8fa9-4cab6b73f0d4'
|
196
|
+
```
|
197
|
+
|
184
198
|
|
185
199
|
Contributing
|
186
200
|
------------
|
data/lib/snapcat/client.rb
CHANGED
@@ -7,6 +7,14 @@ module Snapcat
|
|
7
7
|
@requestor = Requestor.new(username)
|
8
8
|
end
|
9
9
|
|
10
|
+
def auth_token
|
11
|
+
@requestor.auth_token
|
12
|
+
end
|
13
|
+
|
14
|
+
def auth_token=(auth_token)
|
15
|
+
@requestor.auth_token = auth_token
|
16
|
+
end
|
17
|
+
|
10
18
|
def block(username)
|
11
19
|
@requestor.request_with_username(
|
12
20
|
'friend',
|
data/lib/snapcat/requestor.rb
CHANGED
@@ -7,6 +7,8 @@ module Snapcat
|
|
7
7
|
STATIC_TOKEN = 'm198sOkJEn37DjqZ32lpRu76xmw288xSQ9'
|
8
8
|
HASH_PATTERN = '0001110111101110001111010101111011010001001110011000110001000110'
|
9
9
|
|
10
|
+
attr_accessor :auth_token
|
11
|
+
|
10
12
|
base_uri 'https://feelinsonice-hrd.appspot.com/bq/'
|
11
13
|
|
12
14
|
def initialize(username)
|
data/snapcat.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'snapcat'
|
7
|
-
spec.version = '0.0
|
7
|
+
spec.version = '0.1.0'
|
8
8
|
spec.authors = ['Neal Kemp']
|
9
9
|
spec.email = ['']
|
10
10
|
spec.description = %q{Snapchat API wrapper}
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'httmultiparty', '~> 0.3'
|
22
|
-
spec.add_runtime_dependency 'json', '
|
22
|
+
spec.add_runtime_dependency 'json', '~> 1.6'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
25
|
spec.add_development_dependency 'mocha', '~> 0'
|
data/spec/snapcat/client_spec.rb
CHANGED
@@ -5,6 +5,28 @@ describe Snapcat::Client do
|
|
5
5
|
RequestStub.stub_all
|
6
6
|
end
|
7
7
|
|
8
|
+
describe '#auth_token' do
|
9
|
+
it 'returns the requestors auth token' do
|
10
|
+
ux = UserExperience.new
|
11
|
+
ux.login
|
12
|
+
|
13
|
+
auth_token = ux.client.auth_token
|
14
|
+
|
15
|
+
auth_token.must_equal Snapcat::Requestor::STATIC_TOKEN
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#auth_token=' do
|
20
|
+
it 'set the requestors auth token' do
|
21
|
+
ux = UserExperience.new
|
22
|
+
ux.login
|
23
|
+
|
24
|
+
ux.client.auth_token = 'imatoken'
|
25
|
+
|
26
|
+
ux.client.auth_token.must_equal 'imatoken'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
8
30
|
describe '#block' do
|
9
31
|
it 'blocks a user' do
|
10
32
|
ux = UserExperience.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neal Kemp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|