button 2.0.0 → 2.1.0
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/CHANGELOG.md +3 -0
- data/README.md +19 -0
- data/lib/button/client.rb +3 -1
- data/lib/button/resources/customers.rb +21 -0
- data/lib/button/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9c3c195c22e1c66ab773872b2e581f64d2f8ba
|
4
|
+
data.tar.gz: 25e56b4381a65df330ca1fa640d9b949fe16999d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e84daef595db0ddf8fcf6c1f71f9347a487a37cbbff57664e5b8df1f6d35dad060088313945ea50d6b9838b7dabf68d093820a53be97abf039d727c04a9c5770
|
7
|
+
data.tar.gz: 7198f6f31795f34485bd727b320dfc251a27cf71d64077d7cf64ff6efe086a363e399b14e4eb93a045ad753f7a217eea53464c3e3d91f267a13a4ce63ab77d28
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -80,6 +80,7 @@ The supported options are as follows:
|
|
80
80
|
We currently expose the following resources to manage:
|
81
81
|
|
82
82
|
* [`Accounts`](#accounts)
|
83
|
+
* [`Customers`](#customers)
|
83
84
|
* [`Merchants`](#merchants)
|
84
85
|
* [`Orders`](#orders)
|
85
86
|
|
@@ -127,6 +128,24 @@ while !cursor.nil? do
|
|
127
128
|
end
|
128
129
|
```
|
129
130
|
|
131
|
+
### Customers
|
132
|
+
|
133
|
+
##### Create
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
require 'button'
|
137
|
+
|
138
|
+
client = Button::Client.new('sk-XXX')
|
139
|
+
|
140
|
+
response = client.customers.create({
|
141
|
+
id: 'internal-customer-id',
|
142
|
+
email_sha256: 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3'
|
143
|
+
})
|
144
|
+
|
145
|
+
puts response
|
146
|
+
# => Button::Response(id: internal-customer-id, email_sha256: a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3)
|
147
|
+
```
|
148
|
+
|
130
149
|
### Merchants
|
131
150
|
|
132
151
|
##### all
|
data/lib/button/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'button/resources/accounts'
|
2
|
+
require 'button/resources/customers'
|
2
3
|
require 'button/resources/merchants'
|
3
4
|
require 'button/resources/orders'
|
4
5
|
require 'button/errors'
|
@@ -26,6 +27,7 @@ module Button
|
|
26
27
|
config_with_defaults = merge_defaults(config)
|
27
28
|
|
28
29
|
@accounts = Accounts.new(api_key, config_with_defaults)
|
30
|
+
@customers = Customers.new(api_key, config_with_defaults)
|
29
31
|
@merchants = Merchants.new(api_key, config_with_defaults)
|
30
32
|
@orders = Orders.new(api_key, config_with_defaults)
|
31
33
|
end
|
@@ -41,7 +43,7 @@ module Button
|
|
41
43
|
}
|
42
44
|
end
|
43
45
|
|
44
|
-
attr_reader :accounts, :merchants, :orders
|
46
|
+
attr_reader :accounts, :customers, :merchants, :orders
|
45
47
|
private :merge_defaults
|
46
48
|
end
|
47
49
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'button/resources/resource'
|
2
|
+
|
3
|
+
module Button
|
4
|
+
# https://www.usebutton.com/developers/api-reference/
|
5
|
+
#
|
6
|
+
class Customers < Resource
|
7
|
+
def path(customer_id = nil)
|
8
|
+
return "/v1/customers/#{customer_id}" if customer_id
|
9
|
+
'/v1/customers'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Create a Customer
|
13
|
+
#
|
14
|
+
# @param [Hash] customer the customer to create
|
15
|
+
# @return [Button::Response] the API response
|
16
|
+
#
|
17
|
+
def create(customer)
|
18
|
+
api_post(path, customer)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/button/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: button
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Button
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Button is a contextual acquisition channel and closed-loop attribution
|
14
14
|
and affiliation system for mobile commerce.
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/button/client.rb
|
26
26
|
- lib/button/errors.rb
|
27
27
|
- lib/button/resources/accounts.rb
|
28
|
+
- lib/button/resources/customers.rb
|
28
29
|
- lib/button/resources/merchants.rb
|
29
30
|
- lib/button/resources/orders.rb
|
30
31
|
- lib/button/resources/resource.rb
|