tangocard 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +4 -6
- data/lib/tangocard/raas.rb +11 -8
- data/lib/tangocard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmM1NTFkZDNkODRmYjcwMWVhMjE2ZDgyNzk1YTlmMGY3OGI3YzU3Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODg1MzZjZWI4ODhhYTAxNzY4YjkwZTc1Yjg1OTA3ZWM5YzhkOGRiNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWRjMjcyMDM2ZWIzNjM4YTFlZDIzMjlkNWNmYmU3MzJmOWQwYTJjN2Q5ZDY4
|
10
|
+
MGQxZDQwMWY1M2I4OGRiMzY4MmJmZDg1YWRjZDMzNmZjN2Q0MDVkZDYxNTE2
|
11
|
+
NDAzM2YyM2Q3NjY5NjcyNDY2MGNjZDQ4MDllZDRkNThmMWU5Njk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzViZDExMGU1OGViY2NiZmY3ZTQ1MjQzODEwOTRhNzk1NjExMTZmYWQ0ZDg5
|
14
|
+
MGEzZGIzOTFhNDE5M2Q3NjY3ZDM0YjY0N2FkODJjYTQwYTI5NWZiMmQwZGJl
|
15
|
+
ODE5YzQyN2JkMTA4YjZmODVjYTYxOTlmNjE1M2MyM2RjNmEwZjM=
|
data/README.md
CHANGED
@@ -16,8 +16,6 @@ objects to wrap the JSON endpoints of the RaaS API.
|
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
19
|
-
### Rails 3
|
20
|
-
|
21
19
|
Add the `tangocard` gem to your `Gemfile`:
|
22
20
|
|
23
21
|
```
|
@@ -42,8 +40,8 @@ There are three required configuration parameters:
|
|
42
40
|
|
43
41
|
There are also three optional configuration parameters:
|
44
42
|
|
45
|
-
* `default_brands` - An array of strings for the brands you want to retrieve with Tangocard::Brand.default_brands
|
46
|
-
* `local_images` - An array of local image names/URIs that you want to display instead of the default Tango Card-provided `image_url`.
|
43
|
+
* `default_brands` - An array of strings for the brands you want to retrieve with `Tangocard::Brand.default_brands`. The strings should match the unique brand `description` fields exactly.
|
44
|
+
* `local_images` - An array of local image names/URIs that you want to display instead of the default Tango Card-provided `image_url`. `image_url` is sometimes blank, so this can be handy in those cases.
|
47
45
|
* `sku_blacklist` - Reward SKUs that are blacklisted, ie. should never be returned as a purchasable reward.
|
48
46
|
|
49
47
|
## Getting Started
|
@@ -51,10 +49,10 @@ There are also three optional configuration parameters:
|
|
51
49
|
This gem provides two tools:
|
52
50
|
|
53
51
|
1. A simple wrapper for the Tango Card RaaS API, consisting of two classes: `Tangocard::Raas` and `Tangocard::Response`.
|
54
|
-
2. Models for each of the Tango Card objects:
|
52
|
+
2. Models for each of the Tango Card objects: `Tangocard::Account`, `Tangocard::Brand`, `Tangocard::Reward`, and `Tangocard::Order`. These provide a greater level of abstraction and ease of use.
|
55
53
|
|
56
54
|
## Notes and Credits
|
57
55
|
|
58
56
|
This project is developed and maintained by Smartly, Inc. - makers of http://bonus.ly.
|
59
57
|
|
60
|
-
This project uses the MIT-LICENSE.
|
58
|
+
This project uses the MIT-LICENSE.
|
data/lib/tangocard/raas.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class Tangocard::Raas
|
2
2
|
include HTTParty
|
3
|
-
base_uri Tangocard.configuration.base_uri
|
4
3
|
|
5
4
|
# Create a new account. Returns Tangocard::Response object.
|
6
5
|
#
|
@@ -11,7 +10,7 @@ class Tangocard::Raas
|
|
11
10
|
# Arguments:
|
12
11
|
# params: (Hash - see https://github.com/tangocarddev/RaaS#create-a-new-platform-account for details)
|
13
12
|
def self.create_account(params)
|
14
|
-
Tangocard::Response.new(post('
|
13
|
+
Tangocard::Response.new(post(endpoint + 'accounts', {:body => params.to_json}.merge(basic_auth_param)))
|
15
14
|
end
|
16
15
|
|
17
16
|
# Gets account details. Returns Tangocard::Response object.
|
@@ -23,7 +22,7 @@ class Tangocard::Raas
|
|
23
22
|
# Arguments:
|
24
23
|
# params: (Hash - see https://github.com/tangocarddev/RaaS#get-the-information-for-a-specific-platform-account for details)
|
25
24
|
def self.show_account(params)
|
26
|
-
Tangocard::Response.new(get("/
|
25
|
+
Tangocard::Response.new(get(endpoint + "/accounts/#{params['customer']}/#{params['identifier']}", basic_auth_param))
|
27
26
|
end
|
28
27
|
|
29
28
|
# Funds an account. Returns Tangocard::Response object.
|
@@ -35,7 +34,7 @@ class Tangocard::Raas
|
|
35
34
|
# Arguments:
|
36
35
|
# params: (Hash - see https://github.com/tangocarddev/RaaS#fund-a-platforms-account for details)
|
37
36
|
def self.fund_account(params)
|
38
|
-
Tangocard::Response.new(post('/
|
37
|
+
Tangocard::Response.new(post(endpoint + '/funds', {:body => params.to_json}.merge(basic_auth_param)))
|
39
38
|
end
|
40
39
|
|
41
40
|
# Retrieve all rewards. Returns Tangocard::Response object.
|
@@ -47,7 +46,7 @@ class Tangocard::Raas
|
|
47
46
|
# Arguments:
|
48
47
|
# none
|
49
48
|
def self.rewards_index
|
50
|
-
Tangocard::Response.new(get('/
|
49
|
+
Tangocard::Response.new(get(endpoint + '/rewards', basic_auth_param))
|
51
50
|
end
|
52
51
|
|
53
52
|
# Create an order. Returns Tangocard::Response object.
|
@@ -59,7 +58,7 @@ class Tangocard::Raas
|
|
59
58
|
# Arguments:
|
60
59
|
# params: (Hash - see https://github.com/tangocarddev/RaaS#place-an-order for details)
|
61
60
|
def self.create_order(params)
|
62
|
-
Tangocard::Response.new(post('/
|
61
|
+
Tangocard::Response.new(post(endpoint + '/orders', {:body => params.to_json}.merge(basic_auth_param)))
|
63
62
|
end
|
64
63
|
|
65
64
|
# Get order details. Returns Tangocard::Response object.
|
@@ -71,7 +70,7 @@ class Tangocard::Raas
|
|
71
70
|
# Arguments:
|
72
71
|
# params: (Hash - see https://github.com/tangocarddev/RaaS#retrieve-a-historical-order for details)
|
73
72
|
def self.show_order(params)
|
74
|
-
Tangocard::Response.new(get("/
|
73
|
+
Tangocard::Response.new(get(endpoint + "/orders/#{params['order_id']}", basic_auth_param))
|
75
74
|
end
|
76
75
|
|
77
76
|
# Retrieve a list of historical orders. Returns Tangocard::Response object.
|
@@ -91,7 +90,7 @@ class Tangocard::Raas
|
|
91
90
|
query_string += "#{k}=#{params[k]}"
|
92
91
|
end
|
93
92
|
end
|
94
|
-
Tangocard::Response.new(get("/
|
93
|
+
Tangocard::Response.new(get(endpoint + "/orders#{query_string}", basic_auth_param))
|
95
94
|
end
|
96
95
|
|
97
96
|
private
|
@@ -99,4 +98,8 @@ class Tangocard::Raas
|
|
99
98
|
def self.basic_auth_param
|
100
99
|
{:basic_auth => {:username => Tangocard.configuration.name, :password => Tangocard.configuration.key}}
|
101
100
|
end
|
101
|
+
|
102
|
+
def self.endpoint
|
103
|
+
Tangocard.configuration.base_uri + '/raas/v1'
|
104
|
+
end
|
102
105
|
end
|
data/lib/tangocard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tangocard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raphael Crawford-Marks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|