razorpay_integration 0.1.1 → 0.1.2
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/README.md +24 -7
- data/lib/razorpay_integration/customer.rb +31 -0
- data/lib/razorpay_integration/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de3365f96bea4118c35b3010301109885b0d70b8a76772c30494abce3a62c828
|
4
|
+
data.tar.gz: 6ca8846bcc64e5856cf0ced63f61a17c52326659a7d3794381ac6e934b78616c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7275dacb6de8cce8d869e8df381c628d1a2b0b35d4dca15e84b5d7af30898a9e83d1270dca87a6c94c6e6c0a5a2714804acbc03069f9e24252dce14e2e8dcf29
|
7
|
+
data.tar.gz: 31daa2c2b63cc88f10b0ec20b1c986b655366ce715705e644c37a4e9cee500d3c2ec23803a94fec2850bc423cafa88f6980680497df45a2272eb532e5fdc57bd
|
data/README.md
CHANGED
@@ -33,11 +33,31 @@ end
|
|
33
33
|
|
34
34
|
Here's how you can create a new customer:
|
35
35
|
|
36
|
+
**Create a new customer**
|
37
|
+
|
36
38
|
```ruby
|
37
39
|
customer = RazorpayIntegration::Customer.new
|
38
40
|
response = customer.create('Customer Name', 'Customer Contact', 'customer@email.com')
|
39
41
|
```
|
40
42
|
|
43
|
+
**Edit an existing customer**
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
response = customer.edit('customer_id', 'New Customer Name', 'New Customer Contact', 'new_customer@email.com')
|
47
|
+
```
|
48
|
+
|
49
|
+
**List customers**
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
response = customer.list(10, 0)
|
53
|
+
```
|
54
|
+
|
55
|
+
**Get a customer by ID**
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
response = customer.get('customer_id')
|
59
|
+
```
|
60
|
+
|
41
61
|
## Directory Structure
|
42
62
|
|
43
63
|
- **lib/:**
|
@@ -49,16 +69,13 @@ response = customer.create('Customer Name', 'Customer Contact', 'customer@email.
|
|
49
69
|
- **razorpay_integration/:**
|
50
70
|
Contains the classes that form the core functionality of the gem.
|
51
71
|
|
52
|
-
|
72
|
+
- **version.rb:**
|
53
73
|
Contains the version number of the gem.
|
54
|
-
|
55
|
-
- **configuration.rb:**
|
74
|
+
- **configuration.rb:**
|
56
75
|
Contains the Configuration class for configuring the gem.
|
57
|
-
|
58
|
-
- **base.rb:**
|
76
|
+
- **base.rb:**
|
59
77
|
Contains the Base class for making HTTP requests.
|
60
|
-
|
61
|
-
- **customer.rb:**
|
78
|
+
- **customer.rb:**
|
62
79
|
Contains the Customer class for creating customers.
|
63
80
|
|
64
81
|
## Contributing
|
@@ -24,5 +24,36 @@ module RazorpayIntegration
|
|
24
24
|
|
25
25
|
handle_response(response)
|
26
26
|
end
|
27
|
+
|
28
|
+
def edit(customer_id, name, contact, email)
|
29
|
+
end_point = "/customers/#{customer_id}"
|
30
|
+
|
31
|
+
body = {
|
32
|
+
name: name,
|
33
|
+
email: email,
|
34
|
+
contact: contact
|
35
|
+
}.to_json
|
36
|
+
|
37
|
+
response = HTTParty.put("#{BASE_URL}#{end_point}", options.merge(body: body))
|
38
|
+
|
39
|
+
handle_response(response)
|
40
|
+
end
|
41
|
+
|
42
|
+
def list(count = 10, skip = 0)
|
43
|
+
end_point = "/customers?count=#{count}&skip=#{skip}"
|
44
|
+
|
45
|
+
response = HTTParty.get("#{BASE_URL}#{end_point}", options)
|
46
|
+
|
47
|
+
handle_response(response)
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def get(customer_id)
|
52
|
+
end_point = "/customers/#{customer_id}"
|
53
|
+
|
54
|
+
response = HTTParty.get("#{BASE_URL}#{end_point}", options)
|
55
|
+
|
56
|
+
handle_response(response)
|
57
|
+
end
|
27
58
|
end
|
28
59
|
end
|