yoyo 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4d9274c4174c9919a59d12427ad0c5d7dfdaba7
4
- data.tar.gz: 7c37d0c6d4f981233de9c129751b2ea3cab5c3cd
3
+ metadata.gz: 61b8a46f7c094e74fddf2f2fb5f4334fe71f200d
4
+ data.tar.gz: 20c990c37d6fa9ba34caf3e4fbd315eac84bcd59
5
5
  SHA512:
6
- metadata.gz: c2ae76267bde7cabb68972ee7098d9bf6418f79fd09e8288519c00f3d45c0009c7e6ecc6e88678c05bb2e358fb18585fab1d43baabc5633e370bbb83b7a1dd2a
7
- data.tar.gz: 60130b990bdaa7ddb11dea48711b6b4713839952cae1bf7ea56c00c16260ce2e58ac3d25410879ad4e713eef08bc6ccab8bddf46aeaccff30bebc88e093a9e61
6
+ metadata.gz: 496d07bb160e35ebe719c20e0c0b69ed2ef4cbb3e1cc63c86f4a4e5162f4df485c45bb80e10be1c2ae9b279d1adff17c4524586b3759cf11120ace3e1490399d
7
+ data.tar.gz: a4ef8e49e79617660e88094e6e7659574b47b14dc93d3512609e6e18b7d54fccf3a3b86ee05fd89c96a7f706c4987dcd720b1e4c512ac29525591d73156c55db
data/lib/yoyo.rb CHANGED
@@ -38,14 +38,14 @@ module Yoyo
38
38
  # Say YO to someone from your API account
39
39
  # Usage: yo("PHILCRISSMAN")
40
40
  # Returns a Faraday response, so you can see the HTTP status and errors, if any
41
- def yo(some_user)
42
- build_result :post, "/yo/", username: some_user
41
+ def yo(some_user, opts={})
42
+ build_result :post, "/yo/", opts.merge(username: some_user)
43
43
  end
44
44
 
45
45
  # Say YO to everyone who has ever YO'd your API account
46
46
  # Should return an empty body. YOs all your subscribers
47
- def yo_all
48
- build_result :post, "/yoall/"
47
+ def yo_all(opts={})
48
+ build_result :post, "/yoall/", opts
49
49
  end
50
50
 
51
51
  # Get the number of subscribers you have. That sounds handy.
data/lib/yoyo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Yoyo
2
2
  # This is what version of Yoyo this is!
3
3
  # They grow up so fast.
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
data/test/yoyo_test.rb CHANGED
@@ -4,6 +4,10 @@ require 'yoyo'
4
4
  require 'mocha/mini_test'
5
5
 
6
6
  class YoyoTest < Minitest::Test
7
+ def yo
8
+ @yo ||= Yoyo::Yo.new("some-token")
9
+ end
10
+
7
11
  def setup
8
12
  @test_connection = Faraday.new do |builder|
9
13
  builder.adapter :test do |stub|
@@ -15,9 +19,8 @@ class YoyoTest < Minitest::Test
15
19
 
16
20
  Yoyo::Yo.any_instance.stubs(:api_connection).returns(@test_connection)
17
21
  end
18
-
22
+
19
23
  def test_yo_initialization
20
- yo = Yoyo::Yo.new("some-token")
21
24
  assert_equal "some-token", yo.api_token
22
25
  end
23
26
 
@@ -28,8 +31,6 @@ class YoyoTest < Minitest::Test
28
31
  end
29
32
 
30
33
  def test_saying_yo
31
- yo = Yoyo::Yo.new("some-token")
32
-
33
34
  yo.yo("PHILCRISSMAN")
34
35
  assert_equal "{\"result\": \"OK\"}", yo.result.response.body
35
36
  assert_equal({'result' => "OK"}, yo.result.parsed)
@@ -46,8 +47,6 @@ class YoyoTest < Minitest::Test
46
47
 
47
48
  Yoyo::Yo.any_instance.stubs(:api_connection).returns(@rate_limited_test_connection)
48
49
 
49
- yo = Yoyo::Yo.new("some-token")
50
-
51
50
  yo.yo("PHILCRISSMAN")
52
51
  assert_equal "\"Rate limit exceeded. Only one Yo per recipient per minute.\"", yo.result.response.body
53
52
  assert_equal "Rate limit exceeded. Only one Yo per recipient per minute.", yo.result.error
@@ -56,15 +55,21 @@ class YoyoTest < Minitest::Test
56
55
  end
57
56
 
58
57
  def test_saying_yo_all
59
- yo = Yoyo::Yo.new("some-token")
60
-
61
58
  yo.yo_all
62
59
  assert_equal "{}", yo.result.response.body
63
60
  end
64
61
 
65
62
  def test_get_subscriber_count
66
- yo = Yoyo::Yo.new("some-token")
67
-
68
63
  assert_equal 9001, yo.subscribers_count
69
64
  end
65
+
66
+ def test_yo_with_link
67
+ yo.yo("PHILCRISSMAN", link: "http://justyo.co")
68
+ assert_equal({'result' => "OK"}, yo.result.parsed)
69
+ end
70
+
71
+ def test_yo_all_with_link
72
+ yo.yo_all link: "http://justyo.co"
73
+ assert_equal "{}", yo.result.response.body
74
+ end
70
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoyo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Crissman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler