totter 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/totter/client.rb +9 -1
- data/lib/totter/version.rb +1 -1
- data/test/totter/client_test.rb +6 -0
- metadata +7 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c79f1d13ebf748ec4278c88c99dfc1977120ea8a
|
4
|
+
data.tar.gz: 3be1bb08e5691ab79a0b0dbc7638f6b26292206b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f15f1f5be6b0526eda586e812a0d382be1f01f79158f870b5495070d063acc394a3591dd8dd7a10ac2fdb71b211db5ac663fc74aaf5b63b3871758747a1c7cd
|
7
|
+
data.tar.gz: e8eb49e5a830b6f440c6b6c11f9c567460a79cb58a8ad0bbfa10da8413f9249591846d718b0091c9d7d529729cd61debcfc2e7da8b3620612424445b4e219ded
|
data/lib/totter/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'totter/transport'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
module Totter
|
4
5
|
# API client for interacting with the Seesaw API
|
@@ -50,11 +51,18 @@ module Totter
|
|
50
51
|
|
51
52
|
# Initialize a new client.
|
52
53
|
#
|
53
|
-
# @param options [Hash] optionally specify `:access_token`, `:api_scheme`, `:api_host`, `:api_version`, `:client_token`, or `:transport`.
|
54
|
+
# @param options [Hash] optionally specify `:access_token`, `:api_scheme`, `:api_host`, ':api_url', `:api_version`, `:client_token`, or `:transport`.
|
54
55
|
def initialize(options = {})
|
55
56
|
options = { :access_token => options } if options.is_a? String
|
56
57
|
options = self.class.options.merge(options)
|
57
58
|
|
59
|
+
# Parse `api_url` option
|
60
|
+
if url = options.delete(:api_url)
|
61
|
+
uri = URI.parse(url)
|
62
|
+
options[:api_scheme] = uri.scheme
|
63
|
+
options[:api_host] = uri.host + (uri.port != 80 && uri.port != 443 ? ":#{uri.port}" : '')
|
64
|
+
end
|
65
|
+
|
58
66
|
@access_token = options[:access_token] if options[:access_token]
|
59
67
|
@api_scheme = options[:api_scheme]
|
60
68
|
@api_host = options[:api_host]
|
data/lib/totter/version.rb
CHANGED
data/test/totter/client_test.rb
CHANGED
@@ -19,6 +19,12 @@ class ClientTest < Totter::TestCase
|
|
19
19
|
|
20
20
|
client = Totter::Client.new(:api_scheme => 'http', :api_host => 'example.com', :api_version => 42)
|
21
21
|
assert_equal 'http://example.com/v42/', client.base_url
|
22
|
+
|
23
|
+
client = Totter::Client.new(:api_url => 'http://example.com')
|
24
|
+
assert_equal 'http://example.com/v1/', client.base_url
|
25
|
+
|
26
|
+
client = Totter::Client.new(:api_url => 'http://localhost:3000')
|
27
|
+
assert_equal 'http://localhost:3000/v1/', client.base_url
|
22
28
|
end
|
23
29
|
|
24
30
|
def test_ssl?
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: totter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sam Soffes
|
@@ -11,12 +10,11 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: multi_json
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ~>
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,7 +22,6 @@ dependencies:
|
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ~>
|
30
27
|
- !ruby/object:Gem::Version
|
@@ -32,7 +29,6 @@ dependencies:
|
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: hashie
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ~>
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,7 +36,6 @@ dependencies:
|
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ~>
|
46
41
|
- !ruby/object:Gem::Version
|
@@ -140,27 +135,26 @@ files:
|
|
140
135
|
homepage: https://github.com/seesawco/totter-rb
|
141
136
|
licenses:
|
142
137
|
- MIT
|
138
|
+
metadata: {}
|
143
139
|
post_install_message:
|
144
140
|
rdoc_options: []
|
145
141
|
require_paths:
|
146
142
|
- lib
|
147
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
144
|
requirements:
|
150
|
-
- -
|
145
|
+
- - '>='
|
151
146
|
- !ruby/object:Gem::Version
|
152
147
|
version: 1.8.7
|
153
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
149
|
requirements:
|
156
|
-
- -
|
150
|
+
- - '>='
|
157
151
|
- !ruby/object:Gem::Version
|
158
152
|
version: '0'
|
159
153
|
requirements: []
|
160
154
|
rubyforge_project:
|
161
|
-
rubygems_version:
|
155
|
+
rubygems_version: 2.0.0
|
162
156
|
signing_key:
|
163
|
-
specification_version:
|
157
|
+
specification_version: 4
|
164
158
|
summary: Ruby gem for working with the Seesaw API.
|
165
159
|
test_files:
|
166
160
|
- test/cassettes/avatars/create.yml
|