ontraport_api 0.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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +110 -0
- data/Rakefile +10 -0
- data/lib/ontraport_api/apis/contacts.rb +73 -0
- data/lib/ontraport_api/apis/forms.rb +18 -0
- data/lib/ontraport_api/apis/messages.rb +18 -0
- data/lib/ontraport_api/apis/products.rb +6 -0
- data/lib/ontraport_api/apis/sequences.rb +19 -0
- data/lib/ontraport_api/apis/tags.rb +24 -0
- data/lib/ontraport_api/apis/tasks.rb +23 -0
- data/lib/ontraport_api/apis/transactions.rb +78 -0
- data/lib/ontraport_api/client.rb +80 -0
- data/lib/ontraport_api/version.rb +3 -0
- data/lib/ontraport_api.rb +2 -0
- data/objectids.txt +31 -0
- data/ontraport_api.gemspec +28 -0
- data/test/ontraport_api/client_test.rb +14 -0
- data/test/test_helper.rb +3 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 100d1e11e295ba1f0d131d1242b238ff8903fbcd
|
4
|
+
data.tar.gz: e2fd3068a0f65bafea755d96a617208151f02cf6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38f94ba278200b750385c5c7103f74a8845e3b48bd7d7a79496b7b9c8eef5bb0a036c896f7490e4a241be99c17d5dc368f4ec5e76eb7a5b605c1c1a1686c5990
|
7
|
+
data.tar.gz: eb9e121e18c1bf6da429812dd3acf203bac6628f2f16b360448654089b5baac4d3374a864103741d412ee2fff8c048f50c50140b2141113d30d6b9eefccf955f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Jimmy Ngu
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# OntraportApi
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/ontraport_api)
|
4
|
+
|
5
|
+
A Ruby Client for Ontraport's REST JSON API
|
6
|
+
|
7
|
+
https://api.ontraport.com/doc/
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'ontraport_api'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install ontraport_api
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Basic example:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'ontraport_api'
|
31
|
+
|
32
|
+
client = OntraportApi::Client.new('app-id','app-key')
|
33
|
+
|
34
|
+
search_results = client.get_contacts({ condition: "email = 'me@jimmyngu.com'" })
|
35
|
+
puts search_results['data']
|
36
|
+
|
37
|
+
# Error handling
|
38
|
+
puts search_results['error'] # true if error
|
39
|
+
puts search_results['message'] # API response body when error
|
40
|
+
```
|
41
|
+
|
42
|
+
## Supported APIs
|
43
|
+
|
44
|
+
### Contacts
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
client.get_contact(id) # Get a Contact's Data
|
48
|
+
client.new_contact(contact_params) # Create new Contact
|
49
|
+
client.update_contact(id, contact_params) # Update Contact Details
|
50
|
+
client.contact_fields(format) # Fetch Contact Meta Fields
|
51
|
+
client.add_tags_to_contacts(tag_ids, contacts_criteria) # Add Tags to Selected Contacts
|
52
|
+
client.remove_tags_from_contacts(tag_ids, contacts_criteria) # Remove Tags from Selected Contacts
|
53
|
+
client.get_contacts(search_criteria) # Get List of Contacts based on Search Criteria
|
54
|
+
client.get_contacts_by_<field_name>(value) # Wildcard alias to client.get_contacts("<field_name> = 'value'")
|
55
|
+
```
|
56
|
+
|
57
|
+
### Tags (experimental)
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
client.get_tags(conditions) # Get Tags by condition
|
61
|
+
client.new_tag(tag_name) # Create new Tag with tag_name
|
62
|
+
client.get_tags_by_<field_name>(value) # Wildcard alias to client.get_tags("<field_name> = 'value'")
|
63
|
+
```
|
64
|
+
|
65
|
+
### Sequences (experimental)
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
client.get_sequences(conditions) # Get all sequences
|
69
|
+
client.get_sequences_by_<field_name>(value) # Wildcard alias to client.get_sequences("<field_name> = 'value'")
|
70
|
+
```
|
71
|
+
|
72
|
+
See https://api.ontraport.com/doc/ on details of parameters.
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
1. Fork it ( https://github.com/jimmynguyc/ontraport_api/fork )
|
77
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
78
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
79
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
80
|
+
5. Create a new Pull Request
|
81
|
+
|
82
|
+
|
83
|
+
## TODO Lists
|
84
|
+
|
85
|
+
- Forms API
|
86
|
+
- Transactions API
|
87
|
+
- Messages API
|
88
|
+
- Tasks API
|
89
|
+
- Products API
|
90
|
+
|
91
|
+
|
92
|
+
## Experimental / Missing Endpoints
|
93
|
+
|
94
|
+
Many element endpoints are experimental since the JSON API is so new and documentation is lacking in general. I'm working with the "objects" API endpoint mostly for those. Will update as they become available.
|
95
|
+
|
96
|
+
Otherwise, they're missing because I haven't got to them yet. Check the TODO list and let me know if I've missed anything.
|
97
|
+
|
98
|
+
|
99
|
+
## Release Notes
|
100
|
+
|
101
|
+
#### v0.0.4
|
102
|
+
- Add Tags API
|
103
|
+
- Wildcard field_name search
|
104
|
+
- Error handling with error message hash
|
105
|
+
|
106
|
+
#### v0.0.3
|
107
|
+
- Add Sequences API
|
108
|
+
|
109
|
+
#### v0.0.1
|
110
|
+
- Contacts API
|
data/Rakefile
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Contacts
|
4
|
+
CONTACTS_OBJECT_ID = 0
|
5
|
+
CONTACTS_API_METHODS_AND_PATHS = {
|
6
|
+
'get_contact' => [:get, '/object'],
|
7
|
+
'new_contact' => [:post, '/objects'],
|
8
|
+
'update_contact' => [:put, '/objects'],
|
9
|
+
'get_contacts' => [:get, '/objects'],
|
10
|
+
'contact_fields' => [:get, '/objects/meta'],
|
11
|
+
'add_tags_to_contacts' => [:put, '/objects/tag'],
|
12
|
+
'remove_tags_from_contacts' => [:delete, '/objects/tag']
|
13
|
+
}
|
14
|
+
|
15
|
+
def get_contact(id)
|
16
|
+
query_contacts({id: id})
|
17
|
+
end
|
18
|
+
|
19
|
+
def new_contact(payload = {})
|
20
|
+
query_contacts(payload)
|
21
|
+
end
|
22
|
+
|
23
|
+
def update_contact(id, payload = {})
|
24
|
+
query_contacts(payload.merge(id: id))
|
25
|
+
end
|
26
|
+
|
27
|
+
def contact_fields(format = {})
|
28
|
+
default_format = { format: 'byId' }
|
29
|
+
format = default_format.merge(format)
|
30
|
+
query_contacts(format)
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_tags_to_contacts(tag_ids, conditions = {})
|
34
|
+
conditions = { condition: conditions } if conditions.is_a? String
|
35
|
+
default_conditions = {
|
36
|
+
performAll: true
|
37
|
+
}
|
38
|
+
conditions = default_conditions.merge(conditions)
|
39
|
+
|
40
|
+
tag_ids = tag_ids.is_a?(Array) ? tag_ids.join(',') : tag_ids
|
41
|
+
query_contacts(conditions.merge({ add_list: tag_ids }))
|
42
|
+
end
|
43
|
+
|
44
|
+
def remove_tags_from_contacts(tag_ids, conditions = {})
|
45
|
+
conditions = { condition: conditions } if conditions.is_a? String
|
46
|
+
default_conditions = {
|
47
|
+
performAll: true
|
48
|
+
}
|
49
|
+
conditions = default_conditions.merge(conditions)
|
50
|
+
|
51
|
+
tag_ids = tag_ids.is_a?(Array) ? tag_ids.join(',') : tag_ids
|
52
|
+
query_contacts(conditions.merge({ remove_list: tag_ids }))
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_contacts(conditions = {})
|
56
|
+
conditions = { condition: conditions } if conditions.is_a? String
|
57
|
+
default_conditions = {
|
58
|
+
performAll: true,
|
59
|
+
sortDir: 'asc',
|
60
|
+
searchNotes: 'true'
|
61
|
+
}
|
62
|
+
payload = default_conditions.merge(conditions)
|
63
|
+
query_contacts(payload)
|
64
|
+
end
|
65
|
+
|
66
|
+
def query_contacts(payload)
|
67
|
+
method, path = CONTACTS_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
68
|
+
query(method, path, payload.merge({ objectID: CONTACTS_OBJECT_ID }))
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Forms
|
4
|
+
FORMS_API_METHODS_AND_PATHS = {
|
5
|
+
'get_form' => [:get, '/form']
|
6
|
+
}
|
7
|
+
|
8
|
+
def get_form(id)
|
9
|
+
query_forms({id: id})
|
10
|
+
end
|
11
|
+
|
12
|
+
def query_forms(payload)
|
13
|
+
method, path = FORMS_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
14
|
+
query(method, path, payload)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Messages
|
4
|
+
MESSAGES_API_METHODS_AND_PATHS = {
|
5
|
+
'get_message' => [:get, '/message']
|
6
|
+
}
|
7
|
+
|
8
|
+
def get_message(id)
|
9
|
+
query_messages({id: id})
|
10
|
+
end
|
11
|
+
|
12
|
+
def query_messages(payload)
|
13
|
+
method, path = MESSAGES_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
14
|
+
query(method, path, payload)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Sequences
|
4
|
+
SEQUENCES_OBJECT_ID = 5
|
5
|
+
SEQUENCES_API_METHODS_AND_PATHS = {
|
6
|
+
'get_sequences' => [:get, '/objects']
|
7
|
+
}
|
8
|
+
|
9
|
+
def get_sequences(condition = '')
|
10
|
+
query_sequences({ condition: condition })
|
11
|
+
end
|
12
|
+
|
13
|
+
def query_sequences(payload = {})
|
14
|
+
method, path = SEQUENCES_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
15
|
+
query(method, path, payload.merge({ objectID: SEQUENCES_OBJECT_ID }))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Tags
|
4
|
+
TAGS_OBJECT_ID = 14
|
5
|
+
TAGS_API_METHODS_AND_PATHS = {
|
6
|
+
'get_tags' => [:get, '/objects'],
|
7
|
+
'new_tag' => [:post, '/objects'],
|
8
|
+
}
|
9
|
+
|
10
|
+
def get_tags(condition = '')
|
11
|
+
query_tags({ condition: condition })
|
12
|
+
end
|
13
|
+
|
14
|
+
def new_tag(tag_name)
|
15
|
+
query_tags({ tag_name: tag_name })
|
16
|
+
end
|
17
|
+
|
18
|
+
def query_tags(payload = {})
|
19
|
+
method, path = TAGS_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
20
|
+
query(method, path, payload.merge({ objectID: TAGS_OBJECT_ID }))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Tasks
|
4
|
+
TASKS_API_METHODS_AND_PATHS = {
|
5
|
+
'cancel_task' => [:post, '/task/cancel'],
|
6
|
+
'complete_task' => [:post, '/task/complete']
|
7
|
+
}
|
8
|
+
|
9
|
+
def cancel_task(criteria = {})
|
10
|
+
query_tasks(criteria)
|
11
|
+
end
|
12
|
+
|
13
|
+
def complete_task(criteria = {}, data = {})
|
14
|
+
query_tasks({ criteria: criteria, data: data })
|
15
|
+
end
|
16
|
+
|
17
|
+
def query_tasks(payload)
|
18
|
+
method, path = TASKS_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
19
|
+
query(method, path, payload)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module OntraportApi
|
2
|
+
module APIs
|
3
|
+
module Transactions
|
4
|
+
TRANSACTIONS_API_METHODS_AND_PATHS = {
|
5
|
+
'new_transaction' => [:post, '/transaction/processManual'],
|
6
|
+
'refund_transactions' => [:put, '/transaction/refund'],
|
7
|
+
'convert_transactions_to_decline' => [:put, '/transaction/convertToDecline'],
|
8
|
+
'convert_transactions_to_collections' => [:put, '/transaction/convertToCollections'],
|
9
|
+
'void_transaction' => [:put, '/transaction/void'],
|
10
|
+
'void_purchase' => [:put, '/transaction/voidPurchase'],
|
11
|
+
'rerun_commission' => [:put, '/transaction/rerunCommission'],
|
12
|
+
'mark_paid' => [:put, '/transaction/markPaid'],
|
13
|
+
'rerun_transaction' => [:post, '/transaction/rerun'],
|
14
|
+
'write_off_transaction' => [:put, '/transaction/writeOff'],
|
15
|
+
'get_order' => [:get, '/transaction/order'],
|
16
|
+
'update_order' => [:put, '/transaction/order'],
|
17
|
+
'resend_invoice' => [:post, '/transaction/resendInvoice']
|
18
|
+
}
|
19
|
+
|
20
|
+
def new_transaction(transaction = {})
|
21
|
+
query_transactions(transaction)
|
22
|
+
end
|
23
|
+
|
24
|
+
def refund_transactions(criteria = {})
|
25
|
+
query_transactions(criteria)
|
26
|
+
end
|
27
|
+
|
28
|
+
def convert_transactions_to_decline(id)
|
29
|
+
query_transactions({ id: id })
|
30
|
+
end
|
31
|
+
|
32
|
+
def convert_transactions_to_collections(id)
|
33
|
+
query_transactions({ id: id })
|
34
|
+
end
|
35
|
+
|
36
|
+
def void_transaction(criteria = {})
|
37
|
+
query_transactions(criteria)
|
38
|
+
end
|
39
|
+
|
40
|
+
def void_purchase(id)
|
41
|
+
query_transactions({ id: id })
|
42
|
+
end
|
43
|
+
|
44
|
+
def rerun_commission(criteria = {})
|
45
|
+
query_transactions(criteria)
|
46
|
+
end
|
47
|
+
|
48
|
+
def mark_paid(id)
|
49
|
+
query_transactions({ id: id })
|
50
|
+
end
|
51
|
+
|
52
|
+
def rerun_transaction(criteria = {})
|
53
|
+
query_transactions(criteria)
|
54
|
+
end
|
55
|
+
|
56
|
+
def write_off_transaction(id)
|
57
|
+
query_transactions({ id: id })
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_order(id)
|
61
|
+
query_transactions({ id: id })
|
62
|
+
end
|
63
|
+
|
64
|
+
def update_order(payload = {})
|
65
|
+
query_transactions(payload)
|
66
|
+
end
|
67
|
+
|
68
|
+
def resend_invoice(payload = {})
|
69
|
+
query_transactions(payload)
|
70
|
+
end
|
71
|
+
|
72
|
+
def query_transactions(payload)
|
73
|
+
method, path = TRANSACTIONS_API_METHODS_AND_PATHS[caller[0][/`.*'/][1..-2]]
|
74
|
+
query(method, path, payload)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require_relative 'apis/contacts'
|
3
|
+
require_relative 'apis/forms'
|
4
|
+
require_relative 'apis/messages'
|
5
|
+
require_relative 'apis/products'
|
6
|
+
require_relative 'apis/sequences'
|
7
|
+
require_relative 'apis/tags'
|
8
|
+
require_relative 'apis/tasks'
|
9
|
+
require_relative 'apis/transactions'
|
10
|
+
|
11
|
+
module OntraportApi
|
12
|
+
class Client
|
13
|
+
include HTTParty
|
14
|
+
base_uri 'https://api.ontraport.com/1'
|
15
|
+
|
16
|
+
include APIs::Contacts
|
17
|
+
include APIs::Products
|
18
|
+
include APIs::Forms
|
19
|
+
include APIs::Messages
|
20
|
+
include APIs::Products
|
21
|
+
include APIs::Sequences
|
22
|
+
include APIs::Tags
|
23
|
+
include APIs::Tasks
|
24
|
+
include APIs::Transactions
|
25
|
+
|
26
|
+
class InvalidAppIdOrApiKey < StandardError
|
27
|
+
def to_s
|
28
|
+
"APP ID and API Key must not be blank"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class InvalidAPIMethodOrPath < StandardError
|
33
|
+
def to_s
|
34
|
+
"Invalid API Method or Path"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(app_id, api_key)
|
39
|
+
raise InvalidAppIdOrApiKey if [app_id, api_key].any? { |w| w !~ blank_regex }
|
40
|
+
@app_id = app_id
|
41
|
+
@api_key = api_key
|
42
|
+
end
|
43
|
+
|
44
|
+
def method_missing(method, *args, &block)
|
45
|
+
if method.to_s =~ /^get_[\w]+_by_[\w]+/
|
46
|
+
match, subject, keyword = method.to_s.match(/^get_(\w+)_by_(\w+)/).to_a
|
47
|
+
|
48
|
+
if !respond_to?("get_#{subject}".to_sym) || [subject, keyword].any? { |w| w !~ blank_regex }
|
49
|
+
return super
|
50
|
+
end
|
51
|
+
|
52
|
+
self.send("get_#{subject}", "#{keyword} = '#{args[0]}'")
|
53
|
+
else
|
54
|
+
super
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def query(method, path, payload = {})
|
61
|
+
raise InvalidAPIMethodOrPath if [method, path].any? { |w| w !~ blank_regex } || ![:get, :post, :put, :delete].include?(method)
|
62
|
+
response = self.class.send(method, path, query: payload, body: payload, headers: api_credentials_headers )
|
63
|
+
response.parsed_response
|
64
|
+
rescue JSON::ParserError => e
|
65
|
+
{
|
66
|
+
'error' => true,
|
67
|
+
'message' => response.body
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def api_credentials_headers
|
72
|
+
{ 'Api-Appid' => @app_id, 'Api-Key' => @api_key }
|
73
|
+
end
|
74
|
+
|
75
|
+
def blank_regex
|
76
|
+
/[^[:space:]]/
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
data/objectids.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
0 - contacts
|
2
|
+
1 - ?
|
3
|
+
2 - Users
|
4
|
+
3 - ?
|
5
|
+
4 - ?
|
6
|
+
5 - Sequences
|
7
|
+
6 - ?
|
8
|
+
7 - Messages
|
9
|
+
8 - ?
|
10
|
+
9 - Sequences Steps
|
11
|
+
10 - ?
|
12
|
+
11 - ?
|
13
|
+
12 - ?
|
14
|
+
13 - ?
|
15
|
+
14 - Tags
|
16
|
+
15 - ?
|
17
|
+
16 - Products
|
18
|
+
17 - ?
|
19
|
+
18 - ?
|
20
|
+
19 - ?
|
21
|
+
20 - ?
|
22
|
+
21 - 404
|
23
|
+
22 - ?
|
24
|
+
23 - ?
|
25
|
+
24 - ?
|
26
|
+
25 - ?
|
27
|
+
26 - ?
|
28
|
+
27 - ?
|
29
|
+
28 - ?
|
30
|
+
29 - ?
|
31
|
+
30 - ?
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ontraport_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ontraport_api'
|
8
|
+
spec.version = OntraportApi::VERSION
|
9
|
+
spec.authors = ['Jimmy Ngu']
|
10
|
+
spec.email = ['jimmynguyc@gmail.com']
|
11
|
+
spec.summary = %q{Ruby Client for Ontraport's JSON API}
|
12
|
+
spec.description = %q{Ruby client for Ontraport's JSON API}
|
13
|
+
spec.homepage = 'https://github.com/jimmynguyc/ontraport_api'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 1.9.3'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency "minitest", '~> 5.6'
|
26
|
+
|
27
|
+
spec.add_runtime_dependency 'httparty', '~> 0.13'
|
28
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'ontraport_api/client'
|
3
|
+
|
4
|
+
describe OntraportApi::Client do
|
5
|
+
|
6
|
+
describe 'Error handling' do
|
7
|
+
it 'when app_id or api_key blank' do
|
8
|
+
proc {
|
9
|
+
OntraportApi::Client.new(nil, nil)
|
10
|
+
}.must_raise OntraportApi::Client::InvalidAppIdOrApiKey
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ontraport_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jimmy Ngu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.13'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.13'
|
69
|
+
description: Ruby client for Ontraport's JSON API
|
70
|
+
email:
|
71
|
+
- jimmynguyc@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/ontraport_api.rb
|
82
|
+
- lib/ontraport_api/apis/contacts.rb
|
83
|
+
- lib/ontraport_api/apis/forms.rb
|
84
|
+
- lib/ontraport_api/apis/messages.rb
|
85
|
+
- lib/ontraport_api/apis/products.rb
|
86
|
+
- lib/ontraport_api/apis/sequences.rb
|
87
|
+
- lib/ontraport_api/apis/tags.rb
|
88
|
+
- lib/ontraport_api/apis/tasks.rb
|
89
|
+
- lib/ontraport_api/apis/transactions.rb
|
90
|
+
- lib/ontraport_api/client.rb
|
91
|
+
- lib/ontraport_api/version.rb
|
92
|
+
- objectids.txt
|
93
|
+
- ontraport_api.gemspec
|
94
|
+
- test/ontraport_api/client_test.rb
|
95
|
+
- test/test_helper.rb
|
96
|
+
homepage: https://github.com/jimmynguyc/ontraport_api
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.9.3
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.2.2
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: Ruby Client for Ontraport's JSON API
|
120
|
+
test_files:
|
121
|
+
- test/ontraport_api/client_test.rb
|
122
|
+
- test/test_helper.rb
|