zuora_connect 1.1.9 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2762ab43644f638ead4fe47256aa01ad2f04a93c
4
- data.tar.gz: f5015069c7bc31289b277b110fe06e56f1755a4a
3
+ metadata.gz: b62b01cd2bb9f65f20e0e3d0f1bd4e7000b61f0a
4
+ data.tar.gz: 50385b92782f7cd990a3f76f5d48de2d228ba86a
5
5
  SHA512:
6
- metadata.gz: 29300013a0577dfef84c996a7025c89aa24da913d4ec04cf9f112ed440041f9d83a4976a2eb277229002c83c1ede8108d8e9fedec98bfad903148674cf1767ad
7
- data.tar.gz: 115e88e314d84db9c95981580665b0d64e39b146ac8ae2093c7fed3ebc98ca3f7d1d9445cc242011528c1b1cd374ca10f8502793713ffcfe0a47154a9730412f
6
+ metadata.gz: d18c12bde7618f56838b684eb4354e32fd7dd196d40942793695df488e68f3a13a9aa094e27d21295ed93bbb5560541e7bc854ce437cff19b1580d1e2a6c7fd5
7
+ data.tar.gz: ebca7f26c823bd1fcaf604da0396b78eadbb144f90f6d0699397cb42f886d128b6e2372cc1165f471d67f343cd287c4e9e9fbe37f6b853c22826944dfb63e2db
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "1.1.9"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
@@ -144,8 +144,6 @@ files:
144
144
  - db/migrate/20161024162319_add_tokens_to_app_instance.rb
145
145
  - db/migrate/20161024220705_add_token_to_app_instance.rb
146
146
  - db/migrate/20170131211919_add_sessions_table.rb
147
- - lib/generators/datatable/USAGE
148
- - lib/generators/datatable/datatable_generator.rb
149
147
  - lib/tasks/zuora_connect_tasks.rake
150
148
  - lib/zuora_connect.rb
151
149
  - lib/zuora_connect/configuration.rb
@@ -1,8 +0,0 @@
1
- Description:
2
- Explain the generator
3
-
4
- Example:
5
- rails generate datatable Thing
6
-
7
- This will create:
8
- what/will/it/create
@@ -1,92 +0,0 @@
1
- class DatatableGenerator < Rails::Generators::NamedBase
2
-
3
- def create_datatable_file
4
- columns = "#{class_name}".constantize.send("column_names")
5
- column_data = []
6
- columns.each do |col|
7
- column_data << "\"#{plural_name}__#{col}\" => #{plural_name.singularize}.#{col}"
8
- end
9
-
10
- create_file "app/datatables/#{file_name}_datatable.rb", <<-FILE
11
- class #{class_name}Datatable
12
- delegate :controller, :url_for, :render, :params, :image_tag, :h, :link_to, :api_call_path, :number_to_currency, to: :@view
13
-
14
- def initialize(view)
15
- @view = view
16
- @total_#{plural_name} = #{class_name}.count(:all)
17
- @#{plural_name} = #{class_name}.select(select_string).where(search_string, search: "%\#{params[:sSearch].to_s.downcase}%").order("\#{sort_column} \#{sort_direction}")
18
- @filtered_total = @#{plural_name}.size
19
- @#{plural_name} = @#{plural_name}.page(page).per_page(per_page)
20
- end
21
-
22
- def as_json(options = {})
23
- {
24
- sEcho: params[:sEcho].to_i,
25
- iTotalDisplayRecords: @filtered_total,
26
- aaData: data,
27
- iTotalRecords: @total_#{plural_name},
28
- }
29
- end
30
-
31
- private
32
- def data
33
- @#{plural_name}.map do |#{plural_name.singularize}|
34
- {
35
- DT_RowId: #{plural_name.singularize}.id.to_s,
36
- DT_RowClass: nil,
37
- DT_RowAttr: { },
38
- #{column_data.join(",\n\t\t\t\t")},
39
- #{plural_name}_actions: actions(#{plural_name.singularize}),
40
- }
41
- end
42
- end
43
-
44
- def actions(#{plural_name.singularize})
45
- render(:partial=>"#{plural_name}/actions.html.erb", locals: { #{plural_name.singularize}: #{plural_name.singularize}} , :formats => [:html]) if params[:table_view_mode] == 'table'
46
- end
47
-
48
- def display_time(time)
49
- return !time.to_s.blank? ? Time.parse(time.to_s).strftime("%m/%d/%y %I:%M:%S %p") : ''
50
- end
51
-
52
- def page
53
- params[:iDisplayStart].to_i/per_page + 1
54
- end
55
-
56
- def per_page
57
- params[:iDisplayLength].to_i > 0 ? params[:iDisplayLength].to_i : 10
58
- end
59
-
60
- def sort_column
61
- col = [*0..params[:iColumns].to_i-1].map{|i| params["mDataProp_\#{i}"].gsub("__", ".") if params["bSortable_\#{i}"] != 'false' }[params[:iSortCol_0].to_i]
62
- if !col.blank?
63
- object, field = col.split('.')
64
- if !field.blank? && !object.blank?
65
- map = {"#{class_name}" => #{class_name}}
66
- field_type = map[object.classify].column_for_attribute(field).type
67
- return [:string, :text].include?(field_type) ? "lower(\#{col})" : col
68
- else
69
- return col
70
- end
71
- else
72
- return "#{plural_name}.id"
73
- end
74
- end
75
-
76
- def sort_direction
77
- params[:sSortDir_0] == "asc" ? "asc" : "desc"
78
- end
79
-
80
- def search_string
81
- "to_char(#{plural_name}.id, '999999999') LIKE :search "
82
- end
83
-
84
- def select_string
85
- "#{plural_name}.*"
86
- end
87
- end
88
- FILE
89
- end
90
-
91
-
92
- end