yo_client 0.0.3 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +17 -12
- data/lib/yo_client.rb +7 -4
- data/lib/yo_client/version.rb +1 -1
- data/spec/yo_client_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c2b8524fe06d26b06354cfde2984a8304028b4
|
4
|
+
data.tar.gz: 3433008f5060651eaa5926f435e1c2b5d0385e47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6e5b547f8acea5cbca9cf9614076beb074db39ffab6b72acbe0e626810c4fdaa204b47ae503b0980ad8cf486a5d96e24b6250d822d212eb947825cee2872089
|
7
|
+
data.tar.gz: a9665a44049944584010315de738f2385f34afd9d2f3f273594633d81f47be62ea1ce91482202d1b94ab356414a7c747c9df11ed4bf59e909036eeec8b8ec9d7
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
is a Ruby client of [Yo](http://www.justyo.co/).
|
4
4
|
[](https://travis-ci.org/youcune/yo_client)
|
5
|
-
[](https://coveralls.io/r/youcune/yo_client)
|
6
5
|
|
7
6
|
## Requirements
|
8
7
|
|
@@ -31,10 +30,16 @@ client = YoClient::Client.new(API_TOKEN)
|
|
31
30
|
# Yo all subscribers
|
32
31
|
client.yoall
|
33
32
|
|
34
|
-
# Yo
|
33
|
+
# Yo all subscribers with a link (added from v0.1.0)
|
34
|
+
client.yoall(link: 'http://youcune.com/')
|
35
|
+
|
36
|
+
# Yo the specific user
|
35
37
|
# Note that USERNAME will be upcased before sending to API
|
36
38
|
client.yo(USERNAME)
|
37
39
|
|
40
|
+
# Yo the specific user with a link (added from v0.1.0)
|
41
|
+
client.yoall(USERNAME, link: 'http://youcune.com/')
|
42
|
+
|
38
43
|
# Count Total Subscribers
|
39
44
|
client.subscribers_count # -> 5
|
40
45
|
```
|
@@ -46,20 +51,20 @@ client.subscribers_count # -> 5
|
|
46
51
|
|
47
52
|
At the date of 13th July, even if API results in failure, it sometimes behaves as if it succeed. In this case, YoClient cannot tell succeeded or not.
|
48
53
|
|
49
|
-
##
|
50
|
-
|
51
|
-
1. Fork it ( https://github.com/youcune/yo_client/fork )
|
52
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
53
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
54
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
55
|
-
5. Create a new Pull Request
|
56
|
-
|
57
|
-
## Yo the author
|
54
|
+
## Yo the developer
|
58
55
|
|
59
|
-
[Yo YOUCUNE](http://justyo.co/YOUCUNE),
|
56
|
+
[Yo YOUCUNE](http://justyo.co/YOUCUNE), the developer of YoClient, if you ...
|
60
57
|
|
61
58
|
* like YoClient
|
62
59
|
* dislike YoClient
|
63
60
|
* have any ideas about YoClient
|
64
61
|
|
65
62
|
Thanks.
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it ( https://github.com/youcune/yo_client/fork )
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create a new Pull Request
|
data/lib/yo_client.rb
CHANGED
@@ -16,20 +16,23 @@ module YoClient
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Yo to all subscribers
|
19
|
+
# @param [Hash] options allowed only link for now
|
19
20
|
# @return [Boolean] if request has succeed
|
20
|
-
def yoall
|
21
|
+
def yoall(options = {})
|
21
22
|
response = connection_wrapper {
|
22
|
-
@faraday.post '/yoall/', token_hash
|
23
|
+
@faraday.post '/yoall/', token_hash.merge(options)
|
23
24
|
}
|
24
25
|
response.success?
|
25
26
|
end
|
26
27
|
|
27
28
|
# Yo to specific user
|
28
29
|
# @param [String] username usename to send yo
|
30
|
+
# @param [Hash] options allowed only link for now
|
29
31
|
# @return [Boolean] if request has succeed
|
30
|
-
def yo(username)
|
32
|
+
def yo(username, options = {})
|
33
|
+
options.merge!(username: username.upcase)
|
31
34
|
response = connection_wrapper {
|
32
|
-
@faraday.post '/yo/', token_hash.merge(
|
35
|
+
@faraday.post '/yo/', token_hash.merge(options)
|
33
36
|
}
|
34
37
|
response.success?
|
35
38
|
end
|
data/lib/yo_client/version.rb
CHANGED
data/spec/yo_client_spec.rb
CHANGED
@@ -23,6 +23,15 @@ describe YoClient do
|
|
23
23
|
)
|
24
24
|
@client.yoall
|
25
25
|
end
|
26
|
+
|
27
|
+
it 'sends Yo with a link' do
|
28
|
+
expect_any_instance_of(Faraday::Connection).to(
|
29
|
+
receive(:post)
|
30
|
+
.with('/yoall/', { api_token: 'test', link: 'http://youcune.com/' })
|
31
|
+
.and_return(double('yo', body: {}, success?: true))
|
32
|
+
)
|
33
|
+
@client.yoall(link: 'http://youcune.com/')
|
34
|
+
end
|
26
35
|
end
|
27
36
|
|
28
37
|
describe '#yo' do
|
@@ -34,6 +43,15 @@ describe YoClient do
|
|
34
43
|
)
|
35
44
|
@client.yo('youcune')
|
36
45
|
end
|
46
|
+
|
47
|
+
it 'sends Yo with a link' do
|
48
|
+
expect_any_instance_of(Faraday::Connection).to(
|
49
|
+
receive(:post)
|
50
|
+
.with('/yo/', { api_token: 'test', username: 'YOUCUNE', link: 'http://youcune.com/' })
|
51
|
+
.and_return(double('yo', body: {}, success?: true))
|
52
|
+
)
|
53
|
+
@client.yo('youcune', link: 'http://youcune.com/')
|
54
|
+
end
|
37
55
|
end
|
38
56
|
|
39
57
|
describe '#subscribers_count' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yo_client
|
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
|
- Yu Nakanishi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|