yoyo 0.3.0 → 0.3.1
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 +13 -5
- data/.travis.yml +7 -0
- data/README.md +2 -0
- data/lib/yoyo.rb +11 -0
- data/lib/yoyo/version.rb +1 -1
- data/test/yoyo_test.rb +17 -0
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWZmZGJhYTIxZDIwNWM4MWFiZTQ4ODgxNzM3N2VjNWM2MDhmMTkyZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODE1MzUwZjBlMGIyZWNhMDM2OGMwZjhlOTc2NWFmY2I2YmZlYzgzMA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjM1NmI2YTVkNTM2ZmEzZjdkZjczZTNlNjRmN2VhNWI2MmU4YmE1YWFkOTRh
|
10
|
+
MjRmNzQ2YWJkMWRjN2U4OTMyNTI2Zjc4OTkwYmZjZDFjYzNhNmI5NjMyN2Jj
|
11
|
+
ZmMxZjc2NTdlYTU1OTE1ZTA5NzMyNzdlOWU5NGIwZDE2MTVmZTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGNjY2FlZjY0NTU4NjY3MDVmZDkwNzllZjRlOWJkZDIzOTcxNzAzMjE1MjFj
|
14
|
+
MGYyMmMyZTY0YzgzOTU5OTk4OTJjNWUxYzU1M2YzODcxNDNmODRhMThlMjQ2
|
15
|
+
YTAxYjg1ZGM1ZjQ2MTgzODgwYWRhOGMwNGRkN2E5YTFjYjIyZDg=
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/lib/yoyo.rb
CHANGED
@@ -4,6 +4,8 @@ require 'json'
|
|
4
4
|
require 'ostruct'
|
5
5
|
|
6
6
|
module Yoyo
|
7
|
+
InvalidLocationError = Class.new(StandardError)
|
8
|
+
|
7
9
|
class Yo
|
8
10
|
# = Yoyo
|
9
11
|
#
|
@@ -68,6 +70,8 @@ module Yoyo
|
|
68
70
|
private
|
69
71
|
|
70
72
|
def build_result(method, path, opts={})
|
73
|
+
assert_valid_location!(opts[:location], opts[:link])
|
74
|
+
|
71
75
|
tap do
|
72
76
|
response = api_connection.send(method, path, opts.merge(api_token: api_token))
|
73
77
|
begin
|
@@ -88,6 +92,13 @@ module Yoyo
|
|
88
92
|
})
|
89
93
|
end
|
90
94
|
end
|
95
|
+
|
96
|
+
def assert_valid_location!(location, link)
|
97
|
+
return true unless location
|
98
|
+
raise InvalidLocationError, ":location may not be requested with :link" if location && link
|
99
|
+
raise InvalidLocationError, ":location must be in format 'lat;long'" unless location.split(';').compact.size == 2
|
100
|
+
true
|
101
|
+
end
|
91
102
|
end
|
92
103
|
end
|
93
104
|
|
data/lib/yoyo/version.rb
CHANGED
data/test/yoyo_test.rb
CHANGED
@@ -72,4 +72,21 @@ class YoyoTest < Minitest::Test
|
|
72
72
|
yo.yo_all link: "http://justyo.co"
|
73
73
|
assert_equal "{}", yo.result.response.body
|
74
74
|
end
|
75
|
+
|
76
|
+
def test_yo_with_valid_location
|
77
|
+
yo.yo("PHILCRISSMAN", location: "51.5033630;-0.1276250")
|
78
|
+
assert_equal({'result' => "OK"}, yo.result.parsed)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_yo_with_invalid_location
|
82
|
+
assert_raises Yoyo::InvalidLocationError do
|
83
|
+
yo.yo("PHILCRISSMAN", location: "51.5033630,-0.1276250")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_yo_with_link_and_location
|
88
|
+
assert_raises Yoyo::InvalidLocationError do
|
89
|
+
yo.yo("PHILCRISSMAN", location: "51.5033630;-0.1276250", link: "http://justyo.co")
|
90
|
+
end
|
91
|
+
end
|
75
92
|
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.3.
|
4
|
+
version: 0.3.1
|
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-
|
12
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -29,56 +29,56 @@ dependencies:
|
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - '>='
|
32
|
+
- - ! '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - '>='
|
39
|
+
- - ! '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: minitest
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - '>='
|
46
|
+
- - ! '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - '>='
|
53
|
+
- - ! '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: mocha
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - '>='
|
60
|
+
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - '>='
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: faraday
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - '>='
|
74
|
+
- - ! '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - '>='
|
81
|
+
- - ! '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
description: It's a ruby gem for using the YO API. You need to get an API Token, okay?
|
@@ -89,6 +89,7 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- .gitignore
|
92
|
+
- .travis.yml
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
@@ -107,17 +108,17 @@ require_paths:
|
|
107
108
|
- lib
|
108
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
|
-
- - '>='
|
111
|
+
- - ! '>='
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: '0'
|
113
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
115
|
requirements:
|
115
|
-
- - '>='
|
116
|
+
- - ! '>='
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: '0'
|
118
119
|
requirements: []
|
119
120
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.2.2
|
121
122
|
signing_key:
|
122
123
|
specification_version: 4
|
123
124
|
summary: A ruby gem for using the YO API
|