processout 2.20.0 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +52 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Dockerfile +7 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/Makefile +4 -0
  9. data/README.md +12 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/lib/processout/activity.rb +206 -0
  14. data/lib/processout/addon.rb +401 -0
  15. data/lib/processout/alternative_merchant_certificate.rb +115 -0
  16. data/lib/processout/api_request.rb +295 -0
  17. data/lib/processout/api_version.rb +92 -0
  18. data/lib/processout/apple_pay_alternative_merchant_certificates.rb +121 -0
  19. data/lib/processout/balance.rb +92 -0
  20. data/lib/processout/balances.rb +111 -0
  21. data/lib/processout/card.rb +503 -0
  22. data/lib/processout/card_information.rb +164 -0
  23. data/lib/processout/coupon.rb +352 -0
  24. data/lib/processout/customer.rb +755 -0
  25. data/lib/processout/customer_action.rb +81 -0
  26. data/lib/processout/discount.rb +360 -0
  27. data/lib/processout/dunning_action.rb +81 -0
  28. data/lib/processout/errors/authentication_error.rb +9 -0
  29. data/lib/processout/errors/generic_error.rb +9 -0
  30. data/lib/processout/errors/internal_error.rb +9 -0
  31. data/lib/processout/errors/notfound_error.rb +9 -0
  32. data/lib/processout/errors/validation_error.rb +9 -0
  33. data/lib/processout/event.rb +237 -0
  34. data/lib/processout/gateway.rb +210 -0
  35. data/lib/processout/gateway_configuration.rb +346 -0
  36. data/lib/processout/gateway_request.rb +26 -0
  37. data/lib/processout/invoice.rb +985 -0
  38. data/lib/processout/invoice_detail.rb +235 -0
  39. data/lib/processout/invoice_device.rb +92 -0
  40. data/lib/processout/invoice_external_fraud_tools.rb +70 -0
  41. data/lib/processout/invoice_risk.rb +81 -0
  42. data/lib/processout/invoice_shipping.rb +202 -0
  43. data/lib/processout/invoice_tax.rb +81 -0
  44. data/lib/processout/networking/request.rb +102 -0
  45. data/lib/processout/networking/response.rb +67 -0
  46. data/lib/processout/payment_data_network_authentication.rb +70 -0
  47. data/lib/processout/payment_data_three_ds_authentication.rb +70 -0
  48. data/lib/processout/payment_data_three_ds_request.rb +103 -0
  49. data/lib/processout/payout.rb +379 -0
  50. data/lib/processout/payout_item.rb +238 -0
  51. data/lib/processout/plan.rb +368 -0
  52. data/lib/processout/product.rb +368 -0
  53. data/lib/processout/project.rb +353 -0
  54. data/lib/processout/refund.rb +277 -0
  55. data/lib/processout/subscription.rb +910 -0
  56. data/lib/processout/three_ds.rb +158 -0
  57. data/lib/processout/token.rb +493 -0
  58. data/lib/processout/transaction.rb +905 -0
  59. data/lib/processout/transaction_operation.rb +418 -0
  60. data/lib/processout/version.rb +3 -0
  61. data/lib/processout/webhook.rb +237 -0
  62. data/lib/processout/webhook_endpoint.rb +149 -0
  63. data/lib/processout.rb +263 -0
  64. data/processout.gemspec +26 -0
  65. metadata +66 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c45fa72aa84c97f7f9d75c298290e25ca7933c7833bd86e9cbb59e5afed4ee04
4
- data.tar.gz: 2ad45b0d2041bbdbdcc076a7d629f343b2c43d78222bd11d1c38d3d8d9226541
3
+ metadata.gz: babbd1a63d63b0ebe94c58fa14f863fc265e32f47865d53f62372650051fd0ba
4
+ data.tar.gz: 2c1bfcde039845be58a8388098ba6b617eecc8a1e9faf4941ff797c069a9b1b8
5
5
  SHA512:
6
- metadata.gz: 4d45cfc3defdd0e6536afa55e93e36fd509f4d1778efcccd77ae3db851f93e09e9b698af0e9bdd608aaec7defb201e2159f14d62ca18acfcb13dfe69daa4224b
7
- data.tar.gz: ad8da37eb1b4c07b48974da2c9421f749d8675d665c33e473dcfc3fe4f2006be70eca89f87532868bd6f4abfc6cfc6c2c6c6d61bcd737694268abd8cedea2161
6
+ metadata.gz: e6799ebd461d8c11b1ffe2bc2c8da3f99b1dad389528926cd2242eff65609d772e437c42c8e228d11cbd19ae0bc299d5869b9c2872468a79a0c1ff5ee42a5d1c
7
+ data.tar.gz: da18466d912d8548b13c0e47dabd295def6e326a92697d16c140bab9417b7a9ac5f36034a93af27933f73d3ab991aab63ccf7b28c566170296fe1452138efe60
data/.gitignore ADDED
@@ -0,0 +1,52 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ deploy.sh
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.1
5
+ before_install: gem install bundler -v 1.13.6
data/Dockerfile ADDED
@@ -0,0 +1,7 @@
1
+ FROM ruby:2
2
+
3
+ RUN gem install rspec
4
+
5
+ WORKDIR /ruby
6
+
7
+ COPY . .
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in processout.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 ProcessOut
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,4 @@
1
+ .PHONY: test
2
+ test:
3
+ docker build -t fountain-ruby .
4
+ docker run -ti --rm fountain-ruby rspec
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ ProcessOut Ruby
2
+ ==============
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/processout.svg)](https://badge.fury.io/rb/processout)
5
+
6
+ This package provides bindings to the ProcessOut API.
7
+
8
+ Dependencies
9
+ ------------
10
+
11
+ * Ruby >= 1.9.0
12
+ * json >= 1.0
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "processout"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,206 @@
1
+ # The content of this file was automatically generated
2
+
3
+ require "cgi"
4
+ require "json"
5
+ require "processout/networking/request"
6
+ require "processout/networking/response"
7
+
8
+ module ProcessOut
9
+ class Activity
10
+
11
+ attr_reader :id
12
+ attr_reader :project
13
+ attr_reader :project_id
14
+ attr_reader :title
15
+ attr_reader :content
16
+ attr_reader :level
17
+ attr_reader :created_at
18
+
19
+
20
+ def id=(val)
21
+ @id = val
22
+ end
23
+
24
+ def project=(val)
25
+ if val.nil?
26
+ @project = val
27
+ return
28
+ end
29
+
30
+ if val.instance_of? Project
31
+ @project = val
32
+ else
33
+ obj = Project.new(@client)
34
+ obj.fill_with_data(val)
35
+ @project = obj
36
+ end
37
+
38
+ end
39
+
40
+ def project_id=(val)
41
+ @project_id = val
42
+ end
43
+
44
+ def title=(val)
45
+ @title = val
46
+ end
47
+
48
+ def content=(val)
49
+ @content = val
50
+ end
51
+
52
+ def level=(val)
53
+ @level = val
54
+ end
55
+
56
+ def created_at=(val)
57
+ @created_at = val
58
+ end
59
+
60
+
61
+ # Initializes the Activity object
62
+ # Params:
63
+ # +client+:: +ProcessOut+ client instance
64
+ # +data+:: data that can be used to fill the object
65
+ def initialize(client, data = {})
66
+ @client = client
67
+
68
+ self.id = data.fetch(:id, nil)
69
+ self.project = data.fetch(:project, nil)
70
+ self.project_id = data.fetch(:project_id, nil)
71
+ self.title = data.fetch(:title, nil)
72
+ self.content = data.fetch(:content, nil)
73
+ self.level = data.fetch(:level, nil)
74
+ self.created_at = data.fetch(:created_at, nil)
75
+
76
+ end
77
+
78
+ # Create a new Activity using the current client
79
+ def new(data = {})
80
+ Activity.new(@client, data)
81
+ end
82
+
83
+ # Overrides the JSON marshaller to only send the fields we want
84
+ def to_json(options)
85
+ {
86
+ "id": self.id,
87
+ "project": self.project,
88
+ "project_id": self.project_id,
89
+ "title": self.title,
90
+ "content": self.content,
91
+ "level": self.level,
92
+ "created_at": self.created_at,
93
+ }.to_json
94
+ end
95
+
96
+ # Fills the object with data coming from the API
97
+ # Params:
98
+ # +data+:: +Hash+ of data coming from the API
99
+ def fill_with_data(data)
100
+ if data.nil?
101
+ return self
102
+ end
103
+ if data.include? "id"
104
+ self.id = data["id"]
105
+ end
106
+ if data.include? "project"
107
+ self.project = data["project"]
108
+ end
109
+ if data.include? "project_id"
110
+ self.project_id = data["project_id"]
111
+ end
112
+ if data.include? "title"
113
+ self.title = data["title"]
114
+ end
115
+ if data.include? "content"
116
+ self.content = data["content"]
117
+ end
118
+ if data.include? "level"
119
+ self.level = data["level"]
120
+ end
121
+ if data.include? "created_at"
122
+ self.created_at = data["created_at"]
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Prefills the object with the data passed as parameters
129
+ # Params:
130
+ # +data+:: +Hash+ of data
131
+ def prefill(data)
132
+ if data.nil?
133
+ return self
134
+ end
135
+ self.id = data.fetch(:id, self.id)
136
+ self.project = data.fetch(:project, self.project)
137
+ self.project_id = data.fetch(:project_id, self.project_id)
138
+ self.title = data.fetch(:title, self.title)
139
+ self.content = data.fetch(:content, self.content)
140
+ self.level = data.fetch(:level, self.level)
141
+ self.created_at = data.fetch(:created_at, self.created_at)
142
+
143
+ self
144
+ end
145
+
146
+ # Get all the project activities.
147
+ # Params:
148
+ # +options+:: +Hash+ of options
149
+ def all(options = {})
150
+ self.prefill(options)
151
+
152
+ request = Request.new(@client)
153
+ path = "/activities"
154
+ data = {
155
+
156
+ }
157
+
158
+ response = Response.new(request.get(path, data, options))
159
+ return_values = Array.new
160
+
161
+ a = Array.new
162
+ body = response.body
163
+ for v in body['activities']
164
+ tmp = Activity.new(@client)
165
+ tmp.fill_with_data(v)
166
+ a.push(tmp)
167
+ end
168
+
169
+ return_values.push(a)
170
+
171
+
172
+
173
+ return_values[0]
174
+ end
175
+
176
+ # Find a specific activity and fetch its data.
177
+ # Params:
178
+ # +activity_id+:: ID of the activity
179
+ # +options+:: +Hash+ of options
180
+ def find(activity_id, options = {})
181
+ self.prefill(options)
182
+
183
+ request = Request.new(@client)
184
+ path = "/activities/" + CGI.escape(activity_id) + ""
185
+ data = {
186
+
187
+ }
188
+
189
+ response = Response.new(request.get(path, data, options))
190
+ return_values = Array.new
191
+
192
+ body = response.body
193
+ body = body["activity"]
194
+
195
+
196
+ obj = Activity.new(@client)
197
+ return_values.push(obj.fill_with_data(body))
198
+
199
+
200
+
201
+ return_values[0]
202
+ end
203
+
204
+
205
+ end
206
+ end