apidae 1.2.5 → 1.2.6
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 +4 -4
- data/app/models/apidae/obj.rb +11 -4
- data/app/models/apidae/selection.rb +2 -0
- data/config/initializers/constants.rb +6 -3
- data/lib/apidae/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b543869ff93b3f28bb112221a75f6453b893ea8
|
4
|
+
data.tar.gz: 59ad8e04d58263ae44fb6bc4ff97428592064e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 016145c8d3d73a03844b8c64cbf71df5b68a6c47becff87bdfff8e55d40bda4ed957f6c46192455a64ab8c10f58c42cc97436c04bacd44cf31915263919acd12
|
7
|
+
data.tar.gz: ebd5ae7ba7fa1b4447d61582d492e5e85d6c0ecbc3c5a52b5a0305ed09c0e075b95e3aeca68939e5b70c593baf1bc3dea4397107ba9ab5ba38ee0d8a5ec69675
|
data/app/models/apidae/obj.rb
CHANGED
@@ -7,6 +7,7 @@ module Apidae
|
|
7
7
|
|
8
8
|
attr_accessor :locale
|
9
9
|
attr_accessor :obj_version
|
10
|
+
attr_accessor :obj_versions
|
10
11
|
|
11
12
|
store_accessor :title_data, :title
|
12
13
|
store_accessor :owner_data, :owner_name, :owner_id
|
@@ -100,6 +101,7 @@ module Apidae
|
|
100
101
|
after_initialize do
|
101
102
|
@locale = DEFAULT_LOCALE
|
102
103
|
@obj_version = DEFAULT_VERSION
|
104
|
+
@obj_versions = {}
|
103
105
|
end
|
104
106
|
|
105
107
|
def root_obj
|
@@ -111,11 +113,15 @@ module Apidae
|
|
111
113
|
end
|
112
114
|
|
113
115
|
def in_version(v)
|
114
|
-
|
115
|
-
|
116
|
-
|
116
|
+
if v == DEFAULT_VERSION && root_obj_id.nil?
|
117
|
+
@obj_version = DEFAULT_VERSION
|
118
|
+
self
|
119
|
+
else
|
120
|
+
if @obj_versions[v].nil?
|
121
|
+
@obj_versions[v] = versions.where(version: v).first
|
122
|
+
end
|
123
|
+
@obj_versions[v]
|
117
124
|
end
|
118
|
-
@cached_versions[v]
|
119
125
|
end
|
120
126
|
|
121
127
|
def in_locale(l)
|
@@ -164,6 +170,7 @@ module Apidae
|
|
164
170
|
apidae_obj
|
165
171
|
end
|
166
172
|
|
173
|
+
# Note : overrides existing fields (not a merge)
|
167
174
|
def self.populate_fields(apidae_obj, object_data, locales)
|
168
175
|
type_fields = TYPES_DATA[object_data[:type]]
|
169
176
|
apidae_obj.last_update = DateTime.parse(object_data[:gestion][:dateModification]) unless object_data[:gestion].blank?
|
@@ -92,6 +92,7 @@ module Apidae
|
|
92
92
|
query_api(query_args, true, false)
|
93
93
|
end
|
94
94
|
|
95
|
+
# Note : WARNING - updated obj will only contain the provided fields
|
95
96
|
def add_or_refresh_obj(apidae_obj_id, fields = ["@all"])
|
96
97
|
if valid_api?
|
97
98
|
res = api_object(apidae_obj_id, fields)
|
@@ -102,6 +103,7 @@ module Apidae
|
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
106
|
+
# Note : WARNING - updated objs will only contain the provided fields
|
105
107
|
def add_or_refresh_objs(fields = ["@all"])
|
106
108
|
if valid_api?
|
107
109
|
res = api_objects({fields: fields})
|
@@ -24,8 +24,11 @@ module Apidae
|
|
24
24
|
ALL_VERSIONS = [STANDARD_VERSION, WINTER_VERSION, SUMMER_VERSION, CHALLENGED_VERSION, BUSINESS_VERSION,
|
25
25
|
GROUPS_VERSION, ACTIVITIES_VERSION]
|
26
26
|
|
27
|
-
LOCALIZED_FIELDS = [:title, :short_desc, :long_desc, :
|
28
|
-
:includes, :excludes, :extra, :booking_desc]
|
29
|
-
ALL_FIELDS = LOCALIZED_FIELDS + [:theme_desc, :private_desc, :capacity, :telephone, :email, :website,
|
27
|
+
LOCALIZED_FIELDS = [:title, :short_desc, :long_desc, :theme_desc, :pictures, :attachments,
|
28
|
+
:openings_desc, :rates_desc, :includes, :excludes, :extra, :booking_desc]
|
29
|
+
ALL_FIELDS = LOCALIZED_FIELDS + [:theme_desc, :private_desc, :capacity, :telephone, :email, :website,
|
30
|
+
:google, :facebook, :twitter, :yelp, :trip_advisor, :fax, :mobile_website, :shorty_url,
|
31
|
+
:openings, :rates, :services, :payment_methods, :categories, :themes, :labels, :chains,
|
32
|
+
:classification, :challenged, :environments, :languages, :products, :animals,
|
30
33
|
:equipments, :comfort, :activities, :promo, :internal, :linked]
|
31
34
|
end
|
data/lib/apidae/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apidae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|