app_manager 1.4.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c08b2b7330d0590d3de81bd25db16817ddca044984dd3761be00d073ff92b85
4
- data.tar.gz: eea3b459b131b5da995ed2b067fae91fe2499b03f14f4cf3f286d856986ee868
3
+ metadata.gz: ea9ce4e7004657d741da345f7a7d8e40167620f1895660cd99ed7855613a6348
4
+ data.tar.gz: 3b75a5e87d5583da14f8f37fbb19d6bedb30f976e4e04cb91a05329e5b7ab198
5
5
  SHA512:
6
- metadata.gz: 4d5092dd2ccab3b389eda6f93bb826c66a41f8a6508e8a926d9ebc018b073cf732cbd7b400eb7fde0a6b30bce632651891d93207a2cbdb52c35965ae3ce443d5
7
- data.tar.gz: d6d93a43535968f4135a8704988b09091b5e2880a534dcb4f8b171a71388d564a782d1911139528782ad0ef536920f1a8be295adef77522105e5f5e3aff1a2cd
6
+ metadata.gz: 89778c807c975ae3ac24dcac50a5842ad10ef07302da95bb16e9707e68c5a2c7a0eb637d93273c842a6cf6a5b3e3ae90f04c871694497a8788af55fde1c3d835
7
+ data.tar.gz: c3a0f1a3918154d250741ab92c3fb335f6178468c05abc3709afb839b3990e534c0f9ee2901d894e390080c2ceafb1e707592a4c31cbcc0ae24452bbdc7cbc2d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.4.1)
4
+ app_manager (1.4.3)
5
5
  activerecord-import (~> 1.4)
6
6
  httparty
7
7
  kaminari (>= 0.16.3)
@@ -63,7 +63,7 @@ GEM
63
63
  activerecord (7.0.4)
64
64
  activemodel (= 7.0.4)
65
65
  activesupport (= 7.0.4)
66
- activerecord-import (1.4.0)
66
+ activerecord-import (1.4.1)
67
67
  activerecord (>= 4.2)
68
68
  activestorage (7.0.4)
69
69
  actionpack (= 7.0.4)
@@ -86,7 +86,7 @@ module AppManager
86
86
  plans = plans.values if !plans.nil?
87
87
  shopify_plans = params[:shopify_plans] || nil
88
88
  shopify_plans = shopify_plans.values if !shopify_plans.nil?
89
- items_per_page = 25
89
+ items_per_page = params[:itemsPerPage] || 25
90
90
  @shopify_email = AppManager.configuration.field_names['shopify_email']
91
91
  @shopify_plan_name_field = AppManager.configuration.field_names['shopify_plan']
92
92
  if params[:search]
@@ -100,20 +100,21 @@ module AppManager
100
100
  data = data.where(@shopify_plan_name_field => shopify_plans) if !shopify_plans.nil?
101
101
  data = data.page(params[:page]).per(items_per_page)
102
102
  end
103
+ all_user_count = model.count
103
104
  users = {
104
105
  "current_page" => data && data.current_page ? data.current_page : 0,
105
106
  "data" => data ? data.collect { |st| @field_names.map { |key, value| [key, "#{st[value]}"] }.to_h } : [],
106
107
  "first_page_url" => "#{app_url}/api/app-manager/users?page=1",
107
- "from" => data && data.total_pages ? 1 : 0,
108
+ "from" => data && data.total_pages ? data.current_page == 1 ? 1 : ((data.current_page-1)*items_per_page)+1 : 0,
108
109
  "last_page" => data && data.total_pages ? data.total_pages : 0,
109
110
  "last_page_url" => data && data.total_pages ? "#{app_url}/api/app-manager/users?page=#{data.total_pages}" : nil,
110
111
  "links" => '',
111
112
  "next_page_url" => data && data.next_page ? "#{app_url}/api/app-manager/users?page=#{data.next_page}" : nil,
112
113
  "path" => "#{app_url}/api/app-manager/users",
113
- "per_page" => 1,
114
+ "per_page" => items_per_page,
114
115
  "prev_page_url" => data && data.prev_page ? "#{app_url}/api/app-manager/users?page=#{data.prev_page}" : nil,
115
- "to" => data && data.total_pages ? data.total_pages : 0,
116
- "total" => data && data.total_pages ? data.total_pages : 0,
116
+ "to" => data && data.total_pages ? data.current_page == data.total_pages ? all_user_count : ((data && data.current_page ? data.current_page : 0)*data.size) : 0,
117
+ "total" => all_user_count,
117
118
  }
118
119
  render json: users
119
120
 
@@ -119,7 +119,8 @@ module AppManager
119
119
  if apps.any?
120
120
  apps_data = []
121
121
  apps.each do |app|
122
- apps_data << AppManager::App.new(id: app['id'], name: app['name'], slug: app['slug'], url: app['url'], image: app['image'], api_token: app['api_token'], slack: app['slack'], created_at: app['created_at'], updated_at: app['updated_at'])
122
+ # apps_data << AppManager::App.new(id: app['id'], name: app['name'], slug: app['slug'], url: app['url'], image: app['image'], api_token: app['api_token'], slack: app['slack'], created_at: app['created_at'], updated_at: app['updated_at'])
123
+ apps_data << AppManager::App.new(name: app['name'], slug: app['slug'], url: app['url'], image: app['image'], api_token: app['api_token'], slack: app['slack'], created_at: app['created_at'], updated_at: app['updated_at'])
123
124
  end
124
125
  AppManager::Charge.bulk_import apps_data
125
126
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.4.1"
4
+ VERSION = "1.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hulkapps
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty