web_api 0.1.0 → 0.1.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 +4 -4
- data/History.txt +2 -0
- data/examples/blockexplorer +1 -2
- data/examples/facebook +36 -0
- data/lib/web_api/version.rb +1 -1
- data/lib/web_api/web_api.rb +2 -1
- data/lib/web_api.rb +1 -0
- data/web_api.gemspec +7 -7
- metadata +15 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 873ee24ff6c9780e32b2b34b43e63d2b000567e2
|
4
|
+
data.tar.gz: 8a728d4dcf1a0489470c284644f5c9a4490b9fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e9a5348a706625c3fefff66746bf1c103deff3295a8345329d57834389aa4f4f9e12050f959327cc56a3bf333581d7ee32d3938c9302eaa11107e9625b9527
|
7
|
+
data.tar.gz: 51219d952d14337afc190ad9589726b9927f99ed18dc126245150c1aa712d4966c6835bb9ea0f7df7832cc7feeb19fa86c34e35487a2bc77c78e9cfdd3065bae
|
data/History.txt
CHANGED
data/examples/blockexplorer
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'web_api'
|
4
4
|
|
5
5
|
BX = WEB_API::Auto.new('http://blockexplorer.com/q/')
|
6
|
-
LJ = 55
|
7
6
|
|
8
7
|
puts "*** BlockExplorer.com ***"
|
9
8
|
print "Difficulty:\t"
|
@@ -12,5 +11,5 @@ print "Block Count:\t"
|
|
12
11
|
puts BX.getblockcount
|
13
12
|
# Etc... see http://blockexplorer.com/q/ for the API method list.
|
14
13
|
# But wait,... can it do this??? (address is associated with WikiLeaks.)
|
15
|
-
print "addressbalance('1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v'): "
|
14
|
+
print "addressbalance('1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v'): "
|
16
15
|
puts BX.addressbalance('1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v')
|
data/examples/facebook
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'oauth'
|
3
|
+
require 'web_api'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
puts "You'll need to have your OAuth Key and Secret."
|
7
|
+
puts "Then you'll need to follow a link to get your pin."
|
8
|
+
puts "So first your API Key:"
|
9
|
+
print "Key: "
|
10
|
+
KEY = STDIN.gets.strip
|
11
|
+
|
12
|
+
puts "Now your API Secret:"
|
13
|
+
print "Secret: "
|
14
|
+
SECRET = STDIN.gets.strip
|
15
|
+
|
16
|
+
|
17
|
+
SITE = "http://api.twitter.com"
|
18
|
+
CONSUMER = OAuth::Consumer.new(KEY, SECRET, {:site => SITE})
|
19
|
+
REQUEST_TOKEN = CONSUMER.get_request_token
|
20
|
+
|
21
|
+
|
22
|
+
puts "Set your set your web browser this url:"
|
23
|
+
puts " " + REQUEST_TOKEN.authorize_url
|
24
|
+
puts "Then follow the instructions to authorize."
|
25
|
+
puts "Twitter should give you a pin number."
|
26
|
+
print "Pin: "
|
27
|
+
PIN = STDIN.gets.strip
|
28
|
+
|
29
|
+
|
30
|
+
ACCESS = REQUEST_TOKEN.get_access_token(:oauth_verifier => PIN)
|
31
|
+
|
32
|
+
WEBAPI = WEB_API::Client.new(ACCESS)
|
33
|
+
WEBAPI.add('timeline', 'https://api.twitter.com/1.1/statuses/home_timeline.json', 'get')
|
34
|
+
RESPONSE = JSON.parse WEBAPI.timeline
|
35
|
+
|
36
|
+
puts JSON.pretty_generate RESPONSE
|
data/lib/web_api/version.rb
CHANGED
data/lib/web_api/web_api.rb
CHANGED
@@ -18,7 +18,8 @@ class WebApiMethod
|
|
18
18
|
|
19
19
|
# Escapes value's string representation for query string use.
|
20
20
|
def escape(value)
|
21
|
-
|
21
|
+
#http://rosettacode.org/wiki/URL_encoding#Ruby
|
22
|
+
CGI.escape(value.to_s).gsub("+", "%20")
|
22
23
|
end
|
23
24
|
|
24
25
|
# kv is a key, value pair
|
data/lib/web_api.rb
CHANGED
data/web_api.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'web_api'
|
4
|
-
s.version = '0.1.
|
4
|
+
s.version = '0.1.1'
|
5
5
|
|
6
6
|
s.homepage = 'https://github.com/carlosjhr64/web_api'
|
7
7
|
|
8
|
-
s.author = '
|
8
|
+
s.author = 'carlosjhr64'
|
9
9
|
s.email = 'carlosjhr64@gmail.com'
|
10
10
|
|
11
|
-
s.date = '
|
11
|
+
s.date = '2015-01-04'
|
12
12
|
s.licenses = ['MIT']
|
13
13
|
|
14
14
|
s.description = <<DESCRIPTION
|
@@ -32,6 +32,7 @@ README.rdoc
|
|
32
32
|
TODO.txt
|
33
33
|
examples/bitcoincharts
|
34
34
|
examples/blockexplorer
|
35
|
+
examples/facebook
|
35
36
|
examples/mtgox1
|
36
37
|
examples/mtgox2
|
37
38
|
examples/twitter
|
@@ -51,10 +52,9 @@ test/web_api.rb
|
|
51
52
|
web_api.gemspec
|
52
53
|
)
|
53
54
|
|
54
|
-
s.add_development_dependency 'help_parser', '~> 1.
|
55
|
+
s.add_development_dependency 'help_parser', '~> 1.2', '>= 1.2.0'
|
55
56
|
s.add_development_dependency 'oauth', '~> 0.4', '>= 0.4.7'
|
56
|
-
s.add_development_dependency 'signet', '~> 0.
|
57
|
-
s.
|
58
|
-
s.requirements << 'ruby: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]'
|
57
|
+
s.add_development_dependency 'signet', '~> 0.6', '>= 0.6.0'
|
58
|
+
s.requirements << 'ruby: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]'
|
59
59
|
|
60
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: help_parser
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.2'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.2.0
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
29
|
+
version: '1.2'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.2.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: oauth
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,40 +56,20 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
59
|
+
version: '0.6'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 0.6.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
|
-
version: '0.
|
69
|
+
version: '0.6'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: test-unit
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '2.5'
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 2.5.5
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.5'
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 2.5.5
|
72
|
+
version: 0.6.0
|
93
73
|
description: |
|
94
74
|
Ruby library for web api's.
|
95
75
|
|
@@ -106,6 +86,7 @@ files:
|
|
106
86
|
- TODO.txt
|
107
87
|
- examples/bitcoincharts
|
108
88
|
- examples/blockexplorer
|
89
|
+
- examples/facebook
|
109
90
|
- examples/mtgox1
|
110
91
|
- examples/mtgox2
|
111
92
|
- examples/twitter
|
@@ -144,10 +125,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
125
|
- !ruby/object:Gem::Version
|
145
126
|
version: '0'
|
146
127
|
requirements:
|
147
|
-
- 'ruby: ruby 2.1.
|
128
|
+
- 'ruby: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]'
|
148
129
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.4.1
|
150
131
|
signing_key:
|
151
132
|
specification_version: 4
|
152
133
|
summary: Ruby library for web api's.
|
153
134
|
test_files: []
|
135
|
+
has_rdoc:
|