ontraport 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7358c600511194ddb7861ee40a01c4a1af0142a
4
- data.tar.gz: 14239382de51a239eeb3ddc3e0fffb05eb3f46a9
3
+ metadata.gz: d5a8cf44fe3618f8f1602534b291431965f211f6
4
+ data.tar.gz: a793e3656de92773a7c3fe15974d4c2add265932
5
5
  SHA512:
6
- metadata.gz: 182ea22428b4cbf84f1d4c3d42919330ebb9c65df4812329b9f509fb6e01da13b42465cbf1822c1de3d4196c9611f3be8168f84e02e4f835310e7f729c8c8ac4
7
- data.tar.gz: 1fb7a36797f0d34e07c31959f7c72370d3983ddb62eddbf4cafcde7299ef3d93036f322503dafcc7424ca686676e6ddf90aa4273b3b6ed501457e575d81454d6
6
+ metadata.gz: 9af44e0fc25e6bfd258add1640fd03f4400543e7332aa8d63ae586a5c201d12bb10c0cfaa2d61e906a0c993be02a9213ee4bd25f7544f0fde48ec881368308ce
7
+ data.tar.gz: e5853d0d1d3e34ec8632b5e9e1a75611d9170f7286ae49f299a1751600ae22857d5f221eed7e6c600d5a0cc14fc5d74a179715ff5bbf053572dea08e3637cbf4
@@ -1,3 +1,11 @@
1
+ # Unreleased
2
+
3
+ # 0.1.2 - April 14, 2016
4
+
5
+ - Add support for Objects `create` method
6
+ - Better formatting for `APIError` exceptions
7
+ - Add Transactions `get_order` method
8
+
1
9
  # 0.1.1 - February 6, 2016
2
10
 
3
11
  - Update documentation
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Ruby API client for ONTRAPORT
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/ontraport.svg)](https://badge.fury.io/rb/ontraport)
3
4
  [![GitHub](https://img.shields.io/badge/github-ontraport--ruby-blue.svg)][repo]
4
5
  [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)][rubydoc]
5
6
  [![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#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/
@@ -44,7 +44,7 @@ module Ontraport
44
44
  @objects_meta_cache = nil
45
45
  end
46
46
 
47
- # @!group Accessor methods
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
- # @!endgroup
78
- # @!group Modifier methods
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
- raise APIError.new response.body
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
@@ -1,3 +1,3 @@
1
1
  module Ontraport
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
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.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-02-06 00:00:00.000000000 Z
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: '0'
60
+ version: '2'
61
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - ">="