ruby-jet 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/jet/client.rb +11 -0
- data/lib/jet/client/refunds.rb +28 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b776e58c4f1f8ff67d115d1faf916253c7c1d87e
|
4
|
+
data.tar.gz: 97ccd9e38ebed1dc3aa2c84d082640fe71e873d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4fd1c3bc72a799ab7f6fe8435fad24bf424f795d4aa7cdc2f0411bb33da15d43d56959ec51bf44efb1091e9a99ea56407fafd1c6ffa1564f263fe59e5ceb0f5
|
7
|
+
data.tar.gz: dd0f80375686e4e466869dda828655e751bf6df3d8e99f4c6e5d9f23df12a897f4c55b87b47833597db110bb10979f0b76b157a61a9d1c1cafb3483f0a4ebfa5
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Ruby Jet
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/jasonwells/ruby-jet.svg)](https://travis-ci.org/jasonwells/ruby-jet)
|
4
|
+
[![CircleCI](https://circleci.com/gh/jasonwells/ruby-jet.svg?style=shield)](https://circleci.com/gh/jasonwells/ruby-jet)
|
4
5
|
[![Dependency Status](https://gemnasium.com/jasonwells/ruby-jet.svg)](https://gemnasium.com/jasonwells/ruby-jet)
|
5
6
|
[![Code Climate](https://codeclimate.com/github/jasonwells/ruby-jet/badges/gpa.svg)](https://codeclimate.com/github/jasonwells/ruby-jet)
|
6
7
|
[![Test Coverage](https://codeclimate.com/github/jasonwells/ruby-jet/badges/coverage.svg)](https://codeclimate.com/github/jasonwells/ruby-jet/coverage)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/ruby-jet.svg)](https://badge.fury.io/rb/ruby-jet)
|
7
9
|
|
8
10
|
[Jet API](https://developer.jet.com/) service calls implemented in Ruby.
|
data/lib/jet/client.rb
CHANGED
@@ -47,6 +47,12 @@ class Jet::Client
|
|
47
47
|
decode_json(response.body) if response.code == 200
|
48
48
|
end
|
49
49
|
|
50
|
+
def rest_post_with_token(path, body = {})
|
51
|
+
headers = token
|
52
|
+
response = RestClient.post("#{API_URL}#{path}", body.to_json, headers)
|
53
|
+
decode_json(response.body) if response.code == 201
|
54
|
+
end
|
55
|
+
|
50
56
|
def orders
|
51
57
|
Orders.new(self)
|
52
58
|
end
|
@@ -66,6 +72,10 @@ class Jet::Client
|
|
66
72
|
def files
|
67
73
|
Files.new(self)
|
68
74
|
end
|
75
|
+
|
76
|
+
def refunds
|
77
|
+
Refunds.new(self)
|
78
|
+
end
|
69
79
|
end
|
70
80
|
|
71
81
|
require 'jet/client/orders'
|
@@ -73,3 +83,4 @@ require 'jet/client/returns'
|
|
73
83
|
require 'jet/client/products'
|
74
84
|
require 'jet/client/taxonomy'
|
75
85
|
require 'jet/client/files'
|
86
|
+
require 'jet/client/refunds'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
class Jet::Client::Refunds
|
4
|
+
|
5
|
+
STATUSES = {
|
6
|
+
created: 'created',
|
7
|
+
processing: 'processing',
|
8
|
+
accepted: 'accepted',
|
9
|
+
rejected: 'rejected',
|
10
|
+
}
|
11
|
+
|
12
|
+
def initialize(client)
|
13
|
+
@client = client
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_merchant_initiated_refund(order_id, alt_refund_id, body = {})
|
17
|
+
@client.rest_post_with_token("/refunds/#{order_id}/#{alt_refund_id}", body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def check_refund_state(refund_authorization_id)
|
21
|
+
@client.rest_get_with_token("/refunds/state/#{refund_authorization_id}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_for_created_refunds(status)
|
25
|
+
query_status = STATUSES[status]
|
26
|
+
@client.rest_get_with_token("/refunds/#{query_status}")
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Wells
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/jet/client/files.rb
|
54
54
|
- lib/jet/client/orders.rb
|
55
55
|
- lib/jet/client/products.rb
|
56
|
+
- lib/jet/client/refunds.rb
|
56
57
|
- lib/jet/client/returns.rb
|
57
58
|
- lib/jet/client/taxonomy.rb
|
58
59
|
homepage: https://github.com/jasonwells/ruby-jet
|