ontraport 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/CHANGELOG.md +8 -0
- data/README.md +2 -1
- data/lib/ontraport.rb +30 -4
- data/lib/ontraport/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5a8cf44fe3618f8f1602534b291431965f211f6
|
4
|
+
data.tar.gz: a793e3656de92773a7c3fe15974d4c2add265932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9af44e0fc25e6bfd258add1640fd03f4400543e7332aa8d63ae586a5c201d12bb10c0cfaa2d61e906a0c993be02a9213ee4bd25f7544f0fde48ec881368308ce
|
7
|
+
data.tar.gz: e5853d0d1d3e34ec8632b5e9e1a75611d9170f7286ae49f299a1751600ae22857d5f221eed7e6c600d5a0cc14fc5d74a179715ff5bbf053572dea08e3637cbf4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Ruby API client for ONTRAPORT
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/ontraport)
|
3
4
|
[][repo]
|
4
5
|
[][rubydoc]
|
5
6
|
[](#license)
|
@@ -78,4 +79,4 @@ The project uses the MIT License. See LICENSE.md for details.
|
|
78
79
|
[issues]: https://github.com/hamzatayeb/ontraport-ruby/issues
|
79
80
|
[rubydoc]: http://rubydoc.info/gems/ontraport
|
80
81
|
[repo]: http://github.com/hamzatayeb/ontraport-ruby
|
81
|
-
[ontra-objects-api]: https://api.ontraport.com/doc/#!/objects/
|
82
|
+
[ontra-objects-api]: https://api.ontraport.com/doc/#!/objects/
|
data/lib/ontraport.rb
CHANGED
@@ -44,7 +44,7 @@ module Ontraport
|
|
44
44
|
@objects_meta_cache = nil
|
45
45
|
end
|
46
46
|
|
47
|
-
# @!group
|
47
|
+
# @!group "Objects" Methods
|
48
48
|
|
49
49
|
# Retrieve a single object of the specified type.
|
50
50
|
#
|
@@ -74,8 +74,20 @@ module Ontraport
|
|
74
74
|
objects_call :get, object_type, endpoint: '/objects', data: params
|
75
75
|
end
|
76
76
|
|
77
|
-
#
|
78
|
-
#
|
77
|
+
# Create an object with the given data
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# Ontraport.create :contact, { email: 'foo@bar.com', firstname: 'Foo' }
|
81
|
+
# #=> #<Ontraport::Response @data=...>
|
82
|
+
#
|
83
|
+
# @see https://api.ontraport.com/doc/#!/objects/createObject API docs
|
84
|
+
#
|
85
|
+
# @param object_type [Symbol] the type of object
|
86
|
+
# @param params [Hash] input data
|
87
|
+
# @return [Response]
|
88
|
+
def self.create object_type, params
|
89
|
+
objects_call :post, object_type, endpoint: '/objects', data: params
|
90
|
+
end
|
79
91
|
|
80
92
|
# Create an object with the given data, or merge if the unique field matches another row.
|
81
93
|
#
|
@@ -139,6 +151,19 @@ module Ontraport
|
|
139
151
|
objects_call :delete, object_type, endpoint: '/objects/tag', data: params
|
140
152
|
end
|
141
153
|
|
154
|
+
# @!endgroup
|
155
|
+
# @!group "Transactions" Methods
|
156
|
+
|
157
|
+
# Get full information about an order
|
158
|
+
#
|
159
|
+
# @see https://api.ontraport.com/doc/#!/transactions/getOrder API docs
|
160
|
+
#
|
161
|
+
# @param order_id [Integer] Id of the order
|
162
|
+
# @return [Response]
|
163
|
+
def self.get_order order_id
|
164
|
+
request_with_authentication :get, endpoint: '/transaction/order', data: { id: order_id }
|
165
|
+
end
|
166
|
+
|
142
167
|
# @!endgroup
|
143
168
|
|
144
169
|
private
|
@@ -154,7 +179,8 @@ module Ontraport
|
|
154
179
|
response = HTTParty.send *args, **kwargs
|
155
180
|
|
156
181
|
unless response.code.eql? 200
|
157
|
-
|
182
|
+
error = "#{response.code} #{response.msg}"
|
183
|
+
raise APIError.new(response.body.present? ? "#{error} - #{response.body}" : error)
|
158
184
|
end
|
159
185
|
|
160
186
|
Response.new **response.parsed_response.symbolize_keys
|
data/lib/ontraport/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ontraport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hamza Tayeb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -55,9 +55,9 @@ require_paths:
|
|
55
55
|
- lib
|
56
56
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2'
|
61
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
63
|
- - ">="
|