mc2p-ruby 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 +7 -0
- data/README.md +125 -0
- data/bin/mc2p +3 -0
- data/lib/base.rb +331 -0
- data/lib/errors.rb +37 -0
- data/lib/mc2p.rb +125 -0
- data/lib/mixins.rb +377 -0
- data/lib/notification.rb +73 -0
- data/lib/objects.rb +135 -0
- data/lib/request.rb +87 -0
- data/lib/resources.rb +108 -0
- metadata +69 -0
data/lib/resources.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
module MC2P
|
2
|
+
# Product resource
|
3
|
+
class ProductResource < CRUDResource
|
4
|
+
end
|
5
|
+
|
6
|
+
# Plan resource
|
7
|
+
class PlanResource < CRUDResource
|
8
|
+
end
|
9
|
+
|
10
|
+
# Tax resource
|
11
|
+
class TaxResource < CRUDResource
|
12
|
+
end
|
13
|
+
|
14
|
+
# Shipping resource
|
15
|
+
class ShippingResource < CRUDResource
|
16
|
+
end
|
17
|
+
|
18
|
+
# Coupon resource
|
19
|
+
class CouponResource < CRUDResource
|
20
|
+
end
|
21
|
+
|
22
|
+
# Transaction resource
|
23
|
+
class TransactionResource < CRResource
|
24
|
+
end
|
25
|
+
|
26
|
+
# Subscription resource
|
27
|
+
class SubscriptionResource < CRResource
|
28
|
+
end
|
29
|
+
|
30
|
+
# Sale resource
|
31
|
+
class SaleResource < ReadOnlyResource
|
32
|
+
# Initializes a resource
|
33
|
+
# Params:
|
34
|
+
# +api_request+:: Api request used to make all the requests to the API
|
35
|
+
# +path+:: Path used to make all the requests to the API
|
36
|
+
# +object_item_class+:: Object item class used to return values
|
37
|
+
def initialize(api_request, path, object_item_class)
|
38
|
+
super(api_request, path, object_item_class)
|
39
|
+
@rcv_resource_mixin = RefundCaptureVoidResourceMixin.new(api_request, path,
|
40
|
+
object_item_class,
|
41
|
+
@paginator_class)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Params:
|
45
|
+
# +resource_id+:: id to request
|
46
|
+
# +data+:: data to send
|
47
|
+
# Returns: response dictionary
|
48
|
+
def refund(resource_id, data = nil)
|
49
|
+
@rcv_resource_mixin.refund(resource_id, data)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Params:
|
53
|
+
# +resource_id+:: id to request
|
54
|
+
# +data+:: data to send
|
55
|
+
# Returns: response dictionary
|
56
|
+
def capture(resource_id, data = nil)
|
57
|
+
@rcv_resource_mixin.capture(resource_id, data)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Params:
|
61
|
+
# +resource_id+:: id to request
|
62
|
+
# +data+:: data to send
|
63
|
+
# Returns: response dictionary
|
64
|
+
def void(resource_id, data = nil)
|
65
|
+
@rcv_resource_mixin.void(resource_id, data)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Currency resource
|
70
|
+
class CurrencyResource < ReadOnlyResource
|
71
|
+
end
|
72
|
+
|
73
|
+
# Gateway resource
|
74
|
+
class GatewayResource < ReadOnlyResource
|
75
|
+
end
|
76
|
+
|
77
|
+
# PayData resource
|
78
|
+
class PayDataResource < DetailOnlyResource
|
79
|
+
# Initializes a resource
|
80
|
+
# Params:
|
81
|
+
# +api_request+:: Api request used to make all the requests to the API
|
82
|
+
# +path+:: Path used to make all the requests to the API
|
83
|
+
# +object_item_class+:: Object item class used to return values
|
84
|
+
def initialize(api_request, path, object_item_class)
|
85
|
+
super(api_request, path, object_item_class)
|
86
|
+
@cs_resource_mixin = CardShareResourceMixin.new(api_request, path,
|
87
|
+
object_item_class,
|
88
|
+
@paginator_class)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Params:
|
92
|
+
# +resource_id+:: id to request
|
93
|
+
# +gateway_code+:: gateway_code to send
|
94
|
+
# +data+:: data to send
|
95
|
+
# Returns: response dictionary
|
96
|
+
def card(resource_id, gateway_code, data = nil)
|
97
|
+
@cs_resource_mixin.card(resource_id, gateway_code, data)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Params:
|
101
|
+
# +resource_id+:: id to request
|
102
|
+
# +data+:: data to send
|
103
|
+
# Returns: response dictionary
|
104
|
+
def share(resource_id, data = nil)
|
105
|
+
@cs_resource_mixin.share(resource_id, data)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mc2p-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MyChoice2Pay
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: unirest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: Gem for the MyChoice2Pay API.
|
28
|
+
email:
|
29
|
+
- hola@mychoice2pay.com
|
30
|
+
executables:
|
31
|
+
- mc2p
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- README.md
|
36
|
+
- bin/mc2p
|
37
|
+
- lib/base.rb
|
38
|
+
- lib/errors.rb
|
39
|
+
- lib/mc2p.rb
|
40
|
+
- lib/mixins.rb
|
41
|
+
- lib/notification.rb
|
42
|
+
- lib/objects.rb
|
43
|
+
- lib/request.rb
|
44
|
+
- lib/resources.rb
|
45
|
+
homepage: https://www.mychoice2pay.com
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.6.13
|
66
|
+
signing_key:
|
67
|
+
specification_version: 4
|
68
|
+
summary: MyChoice2Pay Ruby Gem
|
69
|
+
test_files: []
|