promisepay 0.0.4 → 0.0.5

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.
@@ -1,53 +1,53 @@
1
- module Promisepay
2
- # Resource for the Items API
3
- class ItemResource < BaseResource
4
- def model
5
- Promisepay::Item
6
- end
7
-
8
- # List all items for a marketplace
9
- #
10
- # @see http://docs.promisepay.com/v2.2/docs/items
11
- #
12
- # @param options [Hash] Optional options.
13
- # @option options [Integer] :limit Can ask for up to 200 items. default: 10
14
- # @option options [Integer] :offset Pagination help. default: 0
15
- #
16
- # @return [Array<Promisepay::Item>] List all items for a marketplace.
17
- def find_all(options = {})
18
- response = JSON.parse(@client.get('items', options).body)
19
- items = response.key?('items') ? response['items'] : []
20
- items.map { |attributes| Promisepay::Item.new(@client, attributes) }
21
- end
22
-
23
- # Get a single item for a marketplace
24
- #
25
- # @see http://docs.promisepay.com/v2.2/docs/itemsid
26
- #
27
- # @param id [String] Marketplace item ID.
28
- #
29
- # @return [Promisepay::Item]
30
- def find(id, type = :full)
31
- case type
32
- when :full
33
- response = JSON.parse(@client.get("items/#{id}").body)
34
- Promisepay::Item.new(@client, response['items'])
35
- when :status
36
- response = JSON.parse(@client.get("items/#{id}/status").body)
37
- Promisepay::Item.new(@client, response['items'])
38
- end
39
- end
40
-
41
- # Create an item for a marketplace
42
- #
43
- # @see http://docs.promisepay.com/v2.2/docs/items-1
44
- #
45
- # @param attributes [Hash] Item's attributes.
46
- #
47
- # @return [Promisepay::Item]
48
- def create(attributes)
49
- response = JSON.parse(@client.post('items', attributes).body)
50
- Promisepay::Item.new(@client, response['items'])
51
- end
52
- end
53
- end
1
+ module Promisepay
2
+ # Resource for the Items API
3
+ class ItemResource < BaseResource
4
+ def model
5
+ Promisepay::Item
6
+ end
7
+
8
+ # List all items for a marketplace
9
+ #
10
+ # @see http://docs.promisepay.com/v2.2/docs/items
11
+ #
12
+ # @param options [Hash] Optional options.
13
+ # @option options [Integer] :limit Can ask for up to 200 items. default: 10
14
+ # @option options [Integer] :offset Pagination help. default: 0
15
+ #
16
+ # @return [Array<Promisepay::Item>] List all items for a marketplace.
17
+ def find_all(options = {})
18
+ response = JSON.parse(@client.get('items', options).body)
19
+ items = response.key?('items') ? response['items'] : []
20
+ items.map { |attributes| Promisepay::Item.new(@client, attributes) }
21
+ end
22
+
23
+ # Get a single item for a marketplace
24
+ #
25
+ # @see http://docs.promisepay.com/v2.2/docs/itemsid
26
+ #
27
+ # @param id [String] Marketplace item ID.
28
+ #
29
+ # @return [Promisepay::Item]
30
+ def find(id, type = :full)
31
+ case type
32
+ when :full
33
+ response = JSON.parse(@client.get("items/#{id}").body)
34
+ Promisepay::Item.new(@client, response['items'])
35
+ when :status
36
+ response = JSON.parse(@client.get("items/#{id}/status").body)
37
+ Promisepay::Item.new(@client, response['items'])
38
+ end
39
+ end
40
+
41
+ # Create an item for a marketplace
42
+ #
43
+ # @see http://docs.promisepay.com/v2.2/docs/items-1
44
+ #
45
+ # @param attributes [Hash] Item's attributes.
46
+ #
47
+ # @return [Promisepay::Item]
48
+ def create(attributes)
49
+ response = JSON.parse(@client.post('items', attributes).body)
50
+ Promisepay::Item.new(@client, response['items'])
51
+ end
52
+ end
53
+ end
@@ -1,32 +1,32 @@
1
- module Promisepay
2
- # Resource for the PaypalAccounts API
3
- class PaypalAccountResource < AccountResource
4
- def model
5
- Promisepay::PaypalAccount
6
- end
7
-
8
- # Get paypal account for a user on a marketplace.
9
- #
10
- # @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid-1
11
- #
12
- # @param id [String] Paypal Account ID.
13
- #
14
- # @return [Promisepay::PaypalAccount]
15
- def find(id)
16
- response = JSON.parse(@client.get("paypal_accounts/#{id}").body)
17
- Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
18
- end
19
-
20
- # Create a Paypal account for a user on a marketplace.
21
- #
22
- # @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid-2
23
- #
24
- # @param attributes [Hash] Paypal Account's attributes.
25
- #
26
- # @return [Promisepay::PaypalAccount]
27
- def create(attributes)
28
- response = JSON.parse(@client.post('paypal_accounts', attributes).body)
29
- Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
30
- end
31
- end
32
- end
1
+ module Promisepay
2
+ # Resource for the PaypalAccounts API
3
+ class PaypalAccountResource < AccountResource
4
+ def model
5
+ Promisepay::PaypalAccount
6
+ end
7
+
8
+ # Get paypal account for a user on a marketplace.
9
+ #
10
+ # @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid-1
11
+ #
12
+ # @param id [String] Paypal Account ID.
13
+ #
14
+ # @return [Promisepay::PaypalAccount]
15
+ def find(id)
16
+ response = JSON.parse(@client.get("paypal_accounts/#{id}").body)
17
+ Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
18
+ end
19
+
20
+ # Create a Paypal account for a user on a marketplace.
21
+ #
22
+ # @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid-2
23
+ #
24
+ # @param attributes [Hash] Paypal Account's attributes.
25
+ #
26
+ # @return [Promisepay::PaypalAccount]
27
+ def create(attributes)
28
+ response = JSON.parse(@client.post('paypal_accounts', attributes).body)
29
+ Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
30
+ end
31
+ end
32
+ end
@@ -1,28 +1,22 @@
1
- module Promisepay
2
- # Resource for the Users API
3
- class TokenResource < BaseResource
4
- def model
5
- Promisepay::Token
6
- end
7
-
8
- # Create a new token for an item
9
- #
10
- # @see http://docs.promisepay.com/v2.2/docs/request_session_token
11
- #
12
- # @param attributes [Hash] Token's attributes.
13
- #
14
- # @return [Promisepay::Token]
15
- def create(type = :session, attributes)
16
- case type
17
- when :session
18
- if attributes && attributes[:fee_ids] && attributes[:fee_ids].is_a?(Array)
19
- attributes[:fee_ids] = attributes[:fee_ids].join(",")
20
- end
21
- attributes[:token_type] = 1
22
- response = JSON.parse(@client.post('token_auths', attributes).body)
23
- response
24
- end
25
- end
26
-
27
- end
28
- end
1
+ module Promisepay
2
+ # Resource for the Tokens API
3
+ class TokenResource < BaseResource
4
+ # Create a new token for an item
5
+ #
6
+ # @see http://docs.promisepay.com/v2.2/docs/request_session_token
7
+ #
8
+ # @param attributes [Hash] Token's attributes.
9
+ #
10
+ # @return [Hash]
11
+ def create(type = :session, attributes)
12
+ case type
13
+ when :session
14
+ if attributes && attributes[:fee_ids] && attributes[:fee_ids].is_a?(Array)
15
+ attributes[:fee_ids] = attributes[:fee_ids].join(',')
16
+ end
17
+ response = @client.get('request_session_token', attributes)
18
+ JSON.parse(response.body)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,35 +1,35 @@
1
- module Promisepay
2
- # Resource for the Transactions API
3
- class TransactionResource < BaseResource
4
- def model
5
- Promisepay::Transaction
6
- end
7
-
8
- # List all transactions for a marketplace
9
- #
10
- # @see http://docs.promisepay.com/v2.2/docs/transactions
11
- #
12
- # @param options [Hash] Optional options.
13
- # @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
14
- # @option options [Integer] :offset Pagination help. default: 0
15
- #
16
- # @return [Array<Promisepay::Transaction>] List all transactions for a marketplace.
17
- def find_all(options = {})
18
- response = JSON.parse(@client.get('transactions', options).body)
19
- transactions = response.key?('transactions') ? response['transactions'] : []
20
- transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }
21
- end
22
-
23
- # Get a single transaction for a marketplace
24
- #
25
- # @see http://docs.promisepay.com/v2.2/docs/transactionsid
26
- #
27
- # @param id [String] transaction ID.
28
- #
29
- # @return [Promisepay::Transaction]
30
- def find(id)
31
- response = JSON.parse(@client.get("transactions/#{id}").body)
32
- Promisepay::Transaction.new(@client, response['transactions'])
33
- end
34
- end
35
- end
1
+ module Promisepay
2
+ # Resource for the Transactions API
3
+ class TransactionResource < BaseResource
4
+ def model
5
+ Promisepay::Transaction
6
+ end
7
+
8
+ # List all transactions for a marketplace
9
+ #
10
+ # @see http://docs.promisepay.com/v2.2/docs/transactions
11
+ #
12
+ # @param options [Hash] Optional options.
13
+ # @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
14
+ # @option options [Integer] :offset Pagination help. default: 0
15
+ #
16
+ # @return [Array<Promisepay::Transaction>] List all transactions for a marketplace.
17
+ def find_all(options = {})
18
+ response = JSON.parse(@client.get('transactions', options).body)
19
+ transactions = response.key?('transactions') ? response['transactions'] : []
20
+ transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }
21
+ end
22
+
23
+ # Get a single transaction for a marketplace
24
+ #
25
+ # @see http://docs.promisepay.com/v2.2/docs/transactionsid
26
+ #
27
+ # @param id [String] transaction ID.
28
+ #
29
+ # @return [Promisepay::Transaction]
30
+ def find(id)
31
+ response = JSON.parse(@client.get("transactions/#{id}").body)
32
+ Promisepay::Transaction.new(@client, response['transactions'])
33
+ end
34
+ end
35
+ end
@@ -1,59 +1,59 @@
1
- module Promisepay
2
- # Resource for the Users API
3
- class UserResource < BaseResource
4
- def model
5
- Promisepay::User
6
- end
7
-
8
- # List all users for a marketplace
9
- #
10
- # @see http://docs.promisepay.com/v2.2/docs/users
11
- #
12
- # @param options [Hash] Optional options.
13
- # @option options [Integer] :limit Can ask for up to 200 users. default: 10
14
- # @option options [Integer] :offset Pagination help. default: 0
15
- #
16
- # @return [Array<Promisepay::User>] List all users for a marketplace.
17
- def find_all(options = {})
18
- response = JSON.parse(@client.get('users', options).body)
19
- users = response.key?('users') ? response['users'] : []
20
- users.map { |attributes| Promisepay::User.new(@client, attributes) }
21
- end
22
-
23
- # Get a single user
24
- #
25
- # @see http://docs.promisepay.com/v2.2/docs/usersid
26
- #
27
- # @param id [String] Marketplace user ID.
28
- #
29
- # @return [Promisepay::User]
30
- def find(id)
31
- response = JSON.parse(@client.get("users/#{id}").body)
32
- Promisepay::User.new(@client, response['users'])
33
- end
34
-
35
- # Create a new user for a marketplace
36
- #
37
- # @see http://docs.promisepay.com/v2.2/docs/users-1
38
- #
39
- # @param attributes [Hash] User's attributes.
40
- #
41
- # @return [Promisepay::User]
42
- def create(attributes)
43
- response = JSON.parse(@client.post('users', attributes).body)
44
- Promisepay::User.new(@client, response['users'])
45
- end
46
-
47
- # Update a user for a marketplace
48
- #
49
- # @see http://docs.promisepay.com/v2.2/docs/users-1
50
- #
51
- # @param attributes [Hash] User's attributes.
52
- #
53
- # @return [Promisepay::User]
54
- def update(attributes)
55
- response = JSON.parse(@client.patch('users', attributes).body)
56
- Promisepay::User.new(@client, response['users'])
57
- end
58
- end
59
- end
1
+ module Promisepay
2
+ # Resource for the Users API
3
+ class UserResource < BaseResource
4
+ def model
5
+ Promisepay::User
6
+ end
7
+
8
+ # List all users for a marketplace
9
+ #
10
+ # @see http://docs.promisepay.com/v2.2/docs/users
11
+ #
12
+ # @param options [Hash] Optional options.
13
+ # @option options [Integer] :limit Can ask for up to 200 users. default: 10
14
+ # @option options [Integer] :offset Pagination help. default: 0
15
+ #
16
+ # @return [Array<Promisepay::User>] List all users for a marketplace.
17
+ def find_all(options = {})
18
+ response = JSON.parse(@client.get('users', options).body)
19
+ users = response.key?('users') ? response['users'] : []
20
+ users.map { |attributes| Promisepay::User.new(@client, attributes) }
21
+ end
22
+
23
+ # Get a single user
24
+ #
25
+ # @see http://docs.promisepay.com/v2.2/docs/usersid
26
+ #
27
+ # @param id [String] Marketplace user ID.
28
+ #
29
+ # @return [Promisepay::User]
30
+ def find(id)
31
+ response = JSON.parse(@client.get("users/#{id}").body)
32
+ Promisepay::User.new(@client, response['users'])
33
+ end
34
+
35
+ # Create a new user for a marketplace
36
+ #
37
+ # @see http://docs.promisepay.com/v2.2/docs/users-1
38
+ #
39
+ # @param attributes [Hash] User's attributes.
40
+ #
41
+ # @return [Promisepay::User]
42
+ def create(attributes)
43
+ response = JSON.parse(@client.post('users', attributes).body)
44
+ Promisepay::User.new(@client, response['users'])
45
+ end
46
+
47
+ # Update a user for a marketplace
48
+ #
49
+ # @see http://docs.promisepay.com/v2.2/docs/users-1
50
+ #
51
+ # @param attributes [Hash] User's attributes.
52
+ #
53
+ # @return [Promisepay::User]
54
+ def update(attributes)
55
+ response = JSON.parse(@client.patch('users', attributes).body)
56
+ Promisepay::User.new(@client, response['users'])
57
+ end
58
+ end
59
+ end
@@ -1,4 +1,4 @@
1
- # Gem version
2
- module Promisepay
3
- VERSION = '0.0.4'
4
- end
1
+ # Gem version
2
+ module Promisepay
3
+ VERSION = '0.0.5'
4
+ end
data/promisepay.gemspec CHANGED
@@ -1,27 +1,27 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'promisepay/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'promisepay'
8
- spec.version = Promisepay::VERSION
9
- spec.authors = ['Romain Vigo Benia']
10
- spec.email = ['romain.vigobenia@gmail.com']
11
- spec.summary = 'Gem to wrap promisepay.com API.'
12
- spec.description = spec.summary
13
- spec.homepage = 'https://github.com/PromisePay/promisepay-ruby'
14
- spec.license = 'MIT'
15
-
16
- spec.files = %w(LICENSE.txt README.md Rakefile promisepay.gemspec)
17
- spec.files += Dir.glob('lib/**/*')
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_dependency 'faraday'
24
- spec.add_dependency 'json'
25
- spec.add_development_dependency 'bundler', '~> 1.7'
26
- spec.add_development_dependency 'rake', '~> 10.0'
27
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'promisepay/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'promisepay'
8
+ spec.version = Promisepay::VERSION
9
+ spec.authors = ['Romain Vigo Benia']
10
+ spec.email = ['romain.vigobenia@gmail.com']
11
+ spec.summary = 'Gem to wrap promisepay.com API.'
12
+ spec.description = spec.summary
13
+ spec.homepage = 'https://github.com/PromisePay/promisepay-ruby'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = %w(LICENSE.txt README.md Rakefile promisepay.gemspec)
17
+ spec.files += Dir.glob('lib/**/*')
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_dependency 'faraday'
24
+ spec.add_dependency 'json'
25
+ spec.add_development_dependency 'bundler', '~> 1.7'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ end