iron_bank 4.2.0 → 4.4.3
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 +5 -5
- data/.env.example +1 -0
- data/.gitignore +3 -0
- data/.reek.yml +1 -0
- data/Gemfile.lock +5 -5
- data/bin/console +1 -0
- data/lib/iron_bank.rb +1 -0
- data/lib/iron_bank/collection.rb +1 -0
- data/lib/iron_bank/configuration.rb +3 -0
- data/lib/iron_bank/endpoint.rb +1 -1
- data/lib/iron_bank/resources/rate_plan_charge.rb +18 -1
- data/lib/iron_bank/user.rb +94 -0
- data/lib/iron_bank/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83c23241ccd3c9228badb707b4f12c031f3d338d
|
4
|
+
data.tar.gz: 142aa1b442282003b63012e58d418c8d6dce6ca0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010ba8a30e6918ea5d13c6df9bba5860811c4fd14d940a2a1eee89a3c2028029aa1af33771b9eec14b969deef3b68019ec725b95f902af7f27054de510111053
|
7
|
+
data.tar.gz: d3ba4a439cbf0b307d6cd178f1f0c7a82de78545c47c65212f61759f690c135cd2ef62a150b501c0f7efa6b70f9c99567da4dfc5ba4797db774aef45d35bd35b
|
data/.env.example
CHANGED
data/.gitignore
CHANGED
data/.reek.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iron_bank (4.
|
4
|
+
iron_bank (4.4.3)
|
5
5
|
faraday (~> 0)
|
6
6
|
faraday_middleware (~> 0)
|
7
7
|
nokogiri (~> 1)
|
@@ -35,9 +35,9 @@ GEM
|
|
35
35
|
equalizer (0.0.11)
|
36
36
|
factory_bot (5.0.2)
|
37
37
|
activesupport (>= 4.2.0)
|
38
|
-
faraday (0.
|
38
|
+
faraday (0.17.3)
|
39
39
|
multipart-post (>= 1.2, < 3)
|
40
|
-
faraday_middleware (0.
|
40
|
+
faraday_middleware (0.14.0)
|
41
41
|
faraday (>= 0.7.4, < 1.0)
|
42
42
|
i18n (1.6.0)
|
43
43
|
concurrent-ruby (~> 1.0)
|
@@ -49,7 +49,7 @@ GEM
|
|
49
49
|
mini_portile2 (2.4.0)
|
50
50
|
minitest (5.11.3)
|
51
51
|
multipart-post (2.1.1)
|
52
|
-
nokogiri (1.10.
|
52
|
+
nokogiri (1.10.10)
|
53
53
|
mini_portile2 (~> 2.4.0)
|
54
54
|
parallel (1.17.0)
|
55
55
|
parser (2.6.3.0)
|
@@ -130,4 +130,4 @@ DEPENDENCIES
|
|
130
130
|
timecop (~> 0.9)
|
131
131
|
|
132
132
|
BUNDLED WITH
|
133
|
-
2.
|
133
|
+
2.1.4
|
data/bin/console
CHANGED
@@ -12,6 +12,7 @@ IronBank.configure do |config|
|
|
12
12
|
config.auth_type = ENV.fetch("ZUORA_AUTH_TYPE", "token")
|
13
13
|
config.domain = ENV["ZUORA_DOMAIN"]
|
14
14
|
config.excluded_fields_file = ENV["ZUORA_EXCLUDED_FIELDS_FILE"]
|
15
|
+
config.users_file = ENV["ZUORA_USERS_FILE"]
|
15
16
|
end
|
16
17
|
|
17
18
|
Pry.start
|
data/lib/iron_bank.rb
CHANGED
data/lib/iron_bank/collection.rb
CHANGED
@@ -34,6 +34,9 @@ module IronBank
|
|
34
34
|
# Directory where the local records are exported.
|
35
35
|
attr_reader :export_directory
|
36
36
|
|
37
|
+
# File path for Zuora users export
|
38
|
+
attr_accessor :users_file
|
39
|
+
|
37
40
|
def initialize
|
38
41
|
@schema_directory = "./config/schema"
|
39
42
|
@export_directory = "./config/export"
|
data/lib/iron_bank/endpoint.rb
CHANGED
@@ -7,7 +7,7 @@ module IronBank
|
|
7
7
|
private_class_method :new
|
8
8
|
|
9
9
|
PRODUCTION = /\Arest\.zuora\.com\z/i.freeze
|
10
|
-
SERVICES = /\
|
10
|
+
SERVICES = /\A(rest)?services(\d+)\.zuora\.com(:\d+)?\z/i.freeze
|
11
11
|
APISANDBOX = /\Arest.apisandbox.zuora\.com\z/i.freeze
|
12
12
|
|
13
13
|
def self.base_url(domain = "")
|
@@ -5,12 +5,14 @@ module IronBank
|
|
5
5
|
# A rate plan charge belongs to a subscription rate plan.
|
6
6
|
#
|
7
7
|
class RatePlanCharge < Resource
|
8
|
+
extend Gem::Deprecate
|
9
|
+
|
8
10
|
def self.excluded_fields
|
9
11
|
super + single_resource_query_fields
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.single_resource_query_fields
|
13
|
-
%w[RolloverBalance]
|
15
|
+
%w[RolloverBalance Price]
|
14
16
|
end
|
15
17
|
|
16
18
|
with_schema
|
@@ -25,6 +27,21 @@ module IronBank
|
|
25
27
|
def rollover_balance
|
26
28
|
remote[:rollover_balance] || reload.remote[:rollover_balance]
|
27
29
|
end
|
30
|
+
|
31
|
+
# NOTE: #price was only available when (1) the pricing model for the
|
32
|
+
# charge is either "Flat Fee" or "Per Unit" AND (2) the charge was
|
33
|
+
# queried through ZOQL, i.e, using `IronBank::Charge#where` method.
|
34
|
+
#
|
35
|
+
# Testing Zuora REST API (using the `IronBank::Charge#find` method)
|
36
|
+
# shows that Zuora does not return a `price` attribute in their
|
37
|
+
# response. This means we consider #price to be a remain from the
|
38
|
+
# SOAP ZOQL query operation. We are deprecating this method without
|
39
|
+
# replacement. Instead, users should be fetching the `#tiers` for
|
40
|
+
# the current charge and get the price information from there.
|
41
|
+
def price
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
deprecate :price, :none, 2020, 1
|
28
45
|
end
|
29
46
|
end
|
30
47
|
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module IronBank
|
4
|
+
# A Zuora user, only available if the user data has been exported and provided
|
5
|
+
# to IronBank through the `users_file` configuration option.
|
6
|
+
#
|
7
|
+
# Cf. https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users#Export_User_Data_to_a_CSV_File
|
8
|
+
#
|
9
|
+
class User
|
10
|
+
extend IronBank::Local
|
11
|
+
extend SingleForwardable
|
12
|
+
|
13
|
+
def_delegators "IronBank.configuration", :users_file
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def store
|
17
|
+
return {} unless users_file
|
18
|
+
|
19
|
+
@store ||= begin
|
20
|
+
if File.exist?(users_file)
|
21
|
+
load_records
|
22
|
+
else
|
23
|
+
IronBank.logger.warn "File does not exist: #{users_file}"
|
24
|
+
{}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def load_records
|
30
|
+
CSV.foreach(users_file, headers: true).with_object({}) do |row, store|
|
31
|
+
store[row["User ID"]] = new(row.to_h.compact)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def all
|
36
|
+
store.values
|
37
|
+
end
|
38
|
+
|
39
|
+
def find(user_id)
|
40
|
+
store[user_id] || raise(IronBank::NotFoundError, "user id: #{user_id}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
US_DATE_FORMAT = "%m/%d/%Y"
|
45
|
+
|
46
|
+
FIELDS = [
|
47
|
+
"User ID",
|
48
|
+
"User Name",
|
49
|
+
"First Name",
|
50
|
+
"Last Name",
|
51
|
+
"Status",
|
52
|
+
"Work Email",
|
53
|
+
"Created On",
|
54
|
+
"Zuora Billing Role",
|
55
|
+
"Zuora Payment Role",
|
56
|
+
"Zuora Commerce Role",
|
57
|
+
"Zuora Platform Role",
|
58
|
+
"Zuora Finance Role",
|
59
|
+
"Zuora Reporting Role",
|
60
|
+
"Zuora Insights Role",
|
61
|
+
"Last Login"
|
62
|
+
].freeze
|
63
|
+
|
64
|
+
FIELDS.each do |field|
|
65
|
+
method_name = IronBank::Utils.underscore(field.tr(" ", ""))
|
66
|
+
|
67
|
+
define_method(method_name) do
|
68
|
+
attributes[field]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
attr_reader :attributes
|
73
|
+
|
74
|
+
alias id user_id
|
75
|
+
|
76
|
+
def initialize(attributes)
|
77
|
+
@attributes = attributes
|
78
|
+
end
|
79
|
+
|
80
|
+
def inspect
|
81
|
+
ruby_id = "#{self.class.name}:0x#{(object_id << 1).to_s(16)} id=\"#{id}\""
|
82
|
+
|
83
|
+
"#<#{ruby_id} user_name=\"#{user_name}\">"
|
84
|
+
end
|
85
|
+
|
86
|
+
def last_login
|
87
|
+
@last_login ||= Date.strptime(attributes["Last Login"], US_DATE_FORMAT)
|
88
|
+
end
|
89
|
+
|
90
|
+
def created_on
|
91
|
+
@created_on ||= Date.strptime(attributes["Created On"], US_DATE_FORMAT)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
data/lib/iron_bank/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Pham
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bump
|
@@ -330,6 +330,7 @@ files:
|
|
330
330
|
- lib/iron_bank/resources/taxation_item.rb
|
331
331
|
- lib/iron_bank/resources/usage.rb
|
332
332
|
- lib/iron_bank/schema.rb
|
333
|
+
- lib/iron_bank/user.rb
|
333
334
|
- lib/iron_bank/utils.rb
|
334
335
|
- lib/iron_bank/version.rb
|
335
336
|
homepage: https://github.com/zendesk/iron_bank
|
@@ -351,7 +352,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
351
352
|
- !ruby/object:Gem::Version
|
352
353
|
version: '0'
|
353
354
|
requirements: []
|
354
|
-
|
355
|
+
rubyforge_project:
|
356
|
+
rubygems_version: 2.6.14.4
|
355
357
|
signing_key:
|
356
358
|
specification_version: 4
|
357
359
|
summary: An opinionated Ruby interface to the Zuora API.
|