hola_milind_patel 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hola_milind_patel.rb +65 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf8711f17c33e0e11dac69af32cec2273423821d
4
- data.tar.gz: d36768bba8292fa410f01ea94d7ec919d14acafa
3
+ metadata.gz: 132d4afba34d046db42cb3f0dbc051cea09ca687
4
+ data.tar.gz: 3c0a93551b0c82c783e2dd6a98897c047f60cb60
5
5
  SHA512:
6
- metadata.gz: 40888140282dadfe1ddef20fe427174cfe7e68555557a45e3ec4b32e87893759d42b855f726281a7fdf91578316e1647a4e0967a6789f053a328b3da0b7c7398
7
- data.tar.gz: 5bef14716c308efc447404e59ff2ceda1a48bbe0694e1a030afece95b4228c72851c805366a4de46a9f8228d8ee319db50f819c69db7d38388dd0397727dd684
6
+ metadata.gz: 5d688f9e1449eb6e18015f43dfb7be7e76f13cb0c18b25f5d1eef16ae25fbf40d3829dfdb1a9ab026f3101e6ffaadfb3a9300c98479b4af1293e8580fb22bc78
7
+ data.tar.gz: 155b3d5846616a26edf402abcc4ab1c4c1d8921aee62eb3e2f4d2f9cde75502c4c9df5f6fecc68f77fb0c866e134711be0288f51bbd96ecdbb2ad6b63f5975c2
@@ -1,9 +1,73 @@
1
1
  require 'mobility'
2
2
  module HolaMilindPatel
3
3
  extend Mobility
4
+ def self.getData(model,data,language,strict)
5
+ puts "============================================================"
6
+ puts "Function getData Called"
7
+ puts "============================================================"
8
+ if language == "all"
9
+ centers = data.as_json
10
+ centers.map do |center|
11
+ c1 = model.camelcase.constantize.find(center['id'])
12
+ c1.as_json.each do |key,value|
13
+ if (c1.send("#{key}_backend") rescue "false") != "false"
14
+ concat_attribute = key + "_backend"
15
+ c1.send(concat_attribute.parameterize.underscore.to_sym).locales.each do |locale|
16
+ center["#{key}_#{locale}"] = c1.send("#{key}_backend").read(locale)
17
+ end
18
+ end
19
+ end
20
+ center
21
+ end
22
+ else
23
+ Mobility.locale = language
24
+ centers = data.as_json
25
+ if strict == "true"
26
+ centers.map do |center|
27
+ center.as_json.each do |key,value|
28
+ record = model.camelcase.constantize.find(center['id'])
29
+ if (record.send("#{key}_backend") rescue "false") != "false"
30
+ center[key] = record.send(key.parameterize.underscore.to_sym,fallback: false)
31
+ end
32
+ end
33
+ center
34
+ end
35
+ end
36
+ end
37
+ return centers
38
+ end
39
+ def self.getShowData(model,data,language,strict)
40
+ puts "============================================================"
41
+ puts "Function getShowData Called"
42
+ puts "============================================================"
43
+ if language == "all"
44
+ center = data
45
+ c = center.as_json
46
+ center.short_title_backend.locales.each do |locale|
47
+ center.as_json.each do |key,value|
48
+ if (center.send("#{key}_backend") rescue "false") != "false"
49
+ c["#{key}_#{locale}"] = center.send("#{key}_backend").read(locale)
50
+ end
51
+ end
52
+ end
53
+ return c
54
+ else
55
+ Mobility.locale = language
56
+ center = data
57
+ if strict == "true"
58
+ center.as_json.each do |key,value|
59
+ record = model.camelcase.constantize.find(center['id'])
60
+ if (record.send("#{key}_backend") rescue "false") != "false"
61
+ center[key] = record.send(key.parameterize.underscore.to_sym,fallback: false)
62
+ end
63
+ end
64
+ end
65
+ return center
66
+ end
67
+ end
4
68
  def self.hi
5
69
  puts "===================="
6
- puts "Hello world!"
70
+ puts "Hello Milind! Your Gem is working!!"
7
71
  puts "===================="
8
72
  end
9
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hola_milind_patel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Milind Patel