gimmie 0.1.2 → 0.1.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 +7 -0
- metadata +21 -18
- data/README.md +0 -77
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 96adefc62c85f11fbd123fe189b69a1ea6732152
|
4
|
+
data.tar.gz: e85053065882d9924b3867273cfedda7ebdad28e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 816c9b2338a114da9020897832ea5ca8110a872786b776a5c01af72222365470a3d0c8d6d82d2b4dc0b9c052a87dcd4eeb2e0e75a59ee608eaf17cbf07ce4ad2
|
7
|
+
data.tar.gz: 53db847184c39237554da40bd9d5f3e4069c2562cc3ce7b661e3837f24ade00bbaabc66dc8d990a52b6721b2d4f85c87a4639c5c426175da444bd53f5fa24385
|
metadata
CHANGED
@@ -1,69 +1,72 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimmie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chew Choon Keat
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rack
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.4.5
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.4.5
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: oauth
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 0.4.6
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.4.6
|
36
41
|
description: Rack application to provide a reverse proxy for Gimmie REST API
|
37
42
|
email: choonkeat@gmail.com
|
38
43
|
executables: []
|
39
44
|
extensions: []
|
40
45
|
extra_rdoc_files: []
|
41
46
|
files:
|
42
|
-
- README.md
|
43
47
|
- lib/gimmie.rb
|
44
48
|
- lib/gimmie/proxy.rb
|
45
49
|
homepage: http://gimmieworld.com
|
46
50
|
licenses: []
|
51
|
+
metadata: {}
|
47
52
|
post_install_message:
|
48
53
|
rdoc_options: []
|
49
54
|
require_paths:
|
50
55
|
- lib
|
51
56
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
57
|
requirements:
|
54
|
-
- -
|
58
|
+
- - ">="
|
55
59
|
- !ruby/object:Gem::Version
|
56
60
|
version: '0'
|
57
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
62
|
requirements:
|
60
|
-
- -
|
63
|
+
- - ">="
|
61
64
|
- !ruby/object:Gem::Version
|
62
65
|
version: '0'
|
63
66
|
requirements: []
|
64
67
|
rubyforge_project:
|
65
|
-
rubygems_version:
|
68
|
+
rubygems_version: 2.4.2
|
66
69
|
signing_key:
|
67
|
-
specification_version:
|
70
|
+
specification_version: 4
|
68
71
|
summary: Proxy for Gimmie API
|
69
72
|
test_files: []
|
data/README.md
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# Gimmie Rack Library
|
2
|
-
|
3
|
-
This gem is Rack application to provide a reverse proxy for Gimmie REST API
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
gem install gimmie
|
8
|
-
|
9
|
-
If you are using `bundler`, add this into your `Gemfile`
|
10
|
-
|
11
|
-
gem "gimmie"
|
12
|
-
|
13
|
-
### Configuration
|
14
|
-
|
15
|
-
Gimmie Proxy library prefers configuration to be set as environment variables
|
16
|
-
|
17
|
-
GIMMIE_OAUTH_KEY
|
18
|
-
GIMMIE_OAUTH_SECRET
|
19
|
-
GIMMIE_COOKIE_KEY
|
20
|
-
GIMMIE_URL_PREFIX
|
21
|
-
|
22
|
-
In this way, the `Gimmie::Proxy` object can be simply initialized as
|
23
|
-
|
24
|
-
Gimmie::Proxy.new
|
25
|
-
|
26
|
-
Alternatively, configuration can be set as constructor arguments, e.g.
|
27
|
-
|
28
|
-
Gimmie::Proxy.new({
|
29
|
-
cookie_key: '_gm_key',
|
30
|
-
oauth_key: 'onetwothree',
|
31
|
-
oauth_secret: 'fourfivesix',
|
32
|
-
url_prefix: 'https://api.gimmieworld.com',
|
33
|
-
})
|
34
|
-
|
35
|
-
### Rack
|
36
|
-
|
37
|
-
Create a file `config.ru` with the following code
|
38
|
-
|
39
|
-
require 'gimmie'
|
40
|
-
run Gimmie::Proxy.new
|
41
|
-
|
42
|
-
Next, execute the command
|
43
|
-
|
44
|
-
rackup
|
45
|
-
|
46
|
-
This will run a web server on port 9292. You can test by sending a HTTP request, e.g.
|
47
|
-
|
48
|
-
curl -i 'http://localhost:9292/gimmieapi=/1/rewards.json'
|
49
|
-
|
50
|
-
If your `GIMMIE_URL_PREFIX` is `https://api.gimmieworld.com`, then an OAuth request will sent to `https://api.gimmieworld.com/1/rewards.json` and the response will be echoed back
|
51
|
-
|
52
|
-
### Rails
|
53
|
-
|
54
|
-
To add Gimmie Proxy into your existing Rails application, simply provide a route in your `config/routes.rb` file, e.g.
|
55
|
-
|
56
|
-
match "/gimmie_proxy" => Gimmie::Proxy.new
|
57
|
-
|
58
|
-
You can test by sending a HTTP request, e.g.
|
59
|
-
|
60
|
-
curl -i 'http://localhost:3000/gimmie_proxy?gimmieapi=/1/rewards.json?x=y'
|
61
|
-
|
62
|
-
NOTE: the mount path can be anything, Gimmie Proxy does not care; it only looks for the `gimmieapi=` string and ignore everything that comes before.
|
63
|
-
|
64
|
-
If your `GIMMIE_URL_PREFIX` is `https://api.gimmieworld.com`, then an OAuth request will sent to `https://api.gimmieworld.com/1/rewards.json?x=y` and the response will be echoed back
|
65
|
-
|
66
|
-
## What's this proxy for?
|
67
|
-
|
68
|
-
Talking to [Gimmie APIs](https://portal.gimmieworld.com/documentation/json) from the server-side should not be an issue for most developers since the technology stack consists of standards like `HTTP`, `OAuth` and `JSON`.
|
69
|
-
|
70
|
-
However, client apps that run on the browser would have problems securing their `OAuth` credentials. The solution is to run a reverse proxy on your own infrastructure and have the client apps talk (without OAuth) to the OAuth configured reverse proxy (which would relay the request to `api.gimmieworld.com` and echo the response back to the browser)
|
71
|
-
|
72
|
-
Meaning, a browser request to
|
73
|
-
|
74
|
-
* `http://www.yourserver.com/some/path?gimmieapi=/1/stores.json?hello=world` would be forwarded to
|
75
|
-
* `http://api.gimmieworld.com/1/stores.json?hello=world`
|
76
|
-
|
77
|
-
When referencing the [API documentation](https://portal.gimmieworld.com/documentation/json), simply replace the url prefix `http://api.gimmieworld.com` with your own reverse proxy url. Everything will still apply as-is.
|