fancyhands-ruby 1.0.2 → 1.0.3
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/lib/fancyhands/v1/client.rb +2 -2
- data/lib/fancyhands/v1/request.rb +13 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 444a25440fd540b524302ccedf8fd3b2787a68ca
|
4
|
+
data.tar.gz: e135f4eb14cae7fb98ceb6d3d83fbc5c4b2ce6f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc2fc8eb949a60c4f7cac5c1b7e7b364dd616d19837ebfa29810f29ea692b8d0b05d079fb10b6bb08c2238a3a20a94845366e43b2e181fb42f83e1a383e96d37
|
7
|
+
data.tar.gz: ff5d308e5e8f66b7223c32e31fc04273f0063fb63e91b3153596449d0c98164a9f0d5c6ebac96a9fc76621d09a2b4f0f32f9f541e33f3efcdae14a190a32526a
|
data/lib/fancyhands/v1/client.rb
CHANGED
@@ -18,8 +18,8 @@ module FancyHands
|
|
18
18
|
|
19
19
|
attr_accessor :request
|
20
20
|
|
21
|
-
def initialize(key, secret, url="https://www.fancyhands.com/api/v1/")
|
22
|
-
@request = Request.new(key, secret, url)
|
21
|
+
def initialize(key, secret, test=false, url="https://www.fancyhands.com/api/v1/")
|
22
|
+
@request = Request.new(key, secret, test, url)
|
23
23
|
@_standard = @_echo = @_custom = @_message = @_outgoing = @_incoming = @_number = @_history = nil
|
24
24
|
end
|
25
25
|
|
@@ -1,12 +1,16 @@
|
|
1
1
|
require "oauth"
|
2
2
|
class Request
|
3
3
|
|
4
|
-
def initialize(key, secret, url)
|
4
|
+
def initialize(key, secret, test, url)
|
5
5
|
@url = url
|
6
|
+
@test = test
|
6
7
|
@consumer = OAuth::Consumer.new(key, secret)
|
7
8
|
end
|
8
9
|
|
9
10
|
def post(piece, data="")
|
11
|
+
if @test
|
12
|
+
data[:test] = @test
|
13
|
+
end
|
10
14
|
response = @consumer.request(:post, @url + piece, nil, {}, data)
|
11
15
|
return JSON.parse(response.body)
|
12
16
|
end
|
@@ -24,16 +28,22 @@ class Request
|
|
24
28
|
|
25
29
|
def put(piece, data="")
|
26
30
|
# {'Content-Type' => 'application/x-www-form-urlencoded'}
|
27
|
-
|
31
|
+
if @test
|
32
|
+
data[:test] = @test
|
33
|
+
end
|
34
|
+
response = @consumer.request(:put, @url + piece, nil, {}, data)
|
28
35
|
return JSON.parse(response.body)
|
29
36
|
end
|
30
37
|
|
31
38
|
def get(piece, data="")
|
39
|
+
if @test
|
40
|
+
data[:test] = @test
|
41
|
+
end
|
32
42
|
if data
|
33
43
|
uri = Addressable::URI.new
|
34
44
|
uri.query_values = data
|
35
45
|
data = uri.query
|
36
|
-
end
|
46
|
+
end
|
37
47
|
full = @url + piece + "?" + data
|
38
48
|
response = @consumer.request(:get, full)
|
39
49
|
return JSON.parse(response.body)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancyhands-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ted Roden
|
@@ -11,7 +11,21 @@ cert_chain: []
|
|
11
11
|
date: 2016-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: oauth
|
14
|
+
name: '["oauth", ">= 0"]'
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: '["addressable", ">= 0"]'
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|