flowcommerce 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clients/flow_catalog_v0_client.rb +499 -53
- data/lib/clients/flow_common_v0_client.rb +389 -74
- metadata +2 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
# Generated by apidoc - http://www.apidoc.me
|
2
|
-
# Service version: 0.0.
|
3
|
-
# apidoc:0.11.
|
2
|
+
# Service version: 0.0.19
|
3
|
+
# apidoc:0.11.27 http://www.apidoc.me/flow/common/0.0.19/ruby_client
|
4
4
|
|
5
5
|
require 'cgi'
|
6
6
|
require 'net/http'
|
@@ -13,6 +13,8 @@ require 'rubygems'
|
|
13
13
|
require 'json'
|
14
14
|
require 'bigdecimal'
|
15
15
|
|
16
|
+
# The Flow Commerce REST API provides full access to the global ecommerce
|
17
|
+
# platform.
|
16
18
|
module Io
|
17
19
|
module Flow
|
18
20
|
module Common
|
@@ -22,9 +24,10 @@ module Io
|
|
22
24
|
|
23
25
|
module Constants
|
24
26
|
|
27
|
+
BASE_URL = 'https://api.flow.io' unless defined?(Constants::BASE_URL)
|
25
28
|
NAMESPACE = 'io.flow.common.v0' unless defined?(Constants::NAMESPACE)
|
26
|
-
USER_AGENT = 'apidoc:0.11.
|
27
|
-
VERSION = '0.0.
|
29
|
+
USER_AGENT = 'apidoc:0.11.27 http://www.apidoc.me/flow/common/0.0.19/ruby_client' unless defined?(Constants::USER_AGENT)
|
30
|
+
VERSION = '0.0.19' unless defined?(Constants::VERSION)
|
28
31
|
VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
|
29
32
|
|
30
33
|
end
|
@@ -39,6 +42,11 @@ module Io
|
|
39
42
|
HttpClient::Preconditions.check_state(url.match(/http.+/i), "URL[%s] must start with http" % url)
|
40
43
|
end
|
41
44
|
|
45
|
+
# Creates an instance of the client using the base url specified in the API spec.
|
46
|
+
def Client.at_base_url(opts={})
|
47
|
+
Client.new(Constants::BASE_URL, opts)
|
48
|
+
end
|
49
|
+
|
42
50
|
def request(path=nil)
|
43
51
|
HttpClient::Preconditions.assert_class_or_nil('path', path, String)
|
44
52
|
request = HttpClient::Request.new(URI.parse(@url + path.to_s)).with_header('User-Agent', Constants::USER_AGENT).with_header('X-Apidoc-Version', Constants::VERSION).with_header('X-Apidoc-Version-Major', Constants::VERSION_MAJOR)
|
@@ -54,17 +62,82 @@ module Io
|
|
54
62
|
request
|
55
63
|
end
|
56
64
|
|
57
|
-
|
65
|
+
def healthchecks
|
66
|
+
@healthchecks ||= ::Io::Flow::Common::V0::Clients::Healthchecks.new(self)
|
67
|
+
end
|
58
68
|
end
|
59
69
|
|
60
70
|
module Clients
|
61
71
|
|
72
|
+
class Healthchecks
|
62
73
|
|
74
|
+
def initialize(client)
|
75
|
+
@client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::Common::V0::Client)
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_healthcheck
|
79
|
+
r = @client.request("/_internal_/healthcheck").get
|
80
|
+
::Io::Flow::Common::V0::Models::Healthcheck.new(r)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
63
84
|
|
64
85
|
end
|
65
86
|
|
66
87
|
module Models
|
67
88
|
|
89
|
+
class ExpandableLocation
|
90
|
+
|
91
|
+
module Types
|
92
|
+
LOCATION = 'location' unless defined?(LOCATION)
|
93
|
+
LOCATION_REFERENCE = 'location_reference' unless defined?(LOCATION_REFERENCE)
|
94
|
+
end
|
95
|
+
|
96
|
+
def initialize(incoming={})
|
97
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
98
|
+
HttpClient::Preconditions.require_keys(opts, [:name], 'ExpandableLocation')
|
99
|
+
@name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
|
100
|
+
end
|
101
|
+
|
102
|
+
def to_hash
|
103
|
+
subtype_to_hash.merge(:discriminator => @name)
|
104
|
+
end
|
105
|
+
|
106
|
+
def ExpandableLocation.from_json(hash)
|
107
|
+
HttpClient::Preconditions.assert_class('hash', hash, Hash)
|
108
|
+
case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
|
109
|
+
when Types::LOCATION; Location.new(hash)
|
110
|
+
when Types::LOCATION_REFERENCE; LocationReference.new(hash)
|
111
|
+
else ExpandableLocationUndefinedType.new(:name => union_type_name)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
class ExpandableLocationUndefinedType < ExpandableLocation
|
118
|
+
|
119
|
+
attr_reader :name
|
120
|
+
|
121
|
+
def initialize(incoming={})
|
122
|
+
super(:name => 'undefined_type')
|
123
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
124
|
+
@name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
|
125
|
+
end
|
126
|
+
|
127
|
+
def subtype_to_hash
|
128
|
+
raise 'Unable to serialize undefined type to json'
|
129
|
+
end
|
130
|
+
|
131
|
+
def copy(incoming={})
|
132
|
+
raise 'Operation not supported for undefined type'
|
133
|
+
end
|
134
|
+
|
135
|
+
def to_hash
|
136
|
+
raise 'Operation not supported for undefined type'
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
|
68
141
|
class ExpandableOrganization
|
69
142
|
|
70
143
|
module Types
|
@@ -194,22 +267,17 @@ module Io
|
|
194
267
|
end
|
195
268
|
|
196
269
|
def Calendar.ALL
|
197
|
-
@@all ||= [Calendar.weekdays, Calendar.everyday
|
270
|
+
@@all ||= [Calendar.weekdays, Calendar.everyday]
|
198
271
|
end
|
199
272
|
|
200
273
|
# Mon - Fri
|
201
274
|
def Calendar.weekdays
|
202
|
-
@@_weekdays ||= Calendar.new('
|
275
|
+
@@_weekdays ||= Calendar.new('weekdays')
|
203
276
|
end
|
204
277
|
|
205
278
|
# 7 days per week
|
206
279
|
def Calendar.everyday
|
207
|
-
@@_everyday ||= Calendar.new('
|
208
|
-
end
|
209
|
-
|
210
|
-
# We do not yet know the calendar
|
211
|
-
def Calendar.unknown
|
212
|
-
@@_unknown ||= Calendar.new('Unknown')
|
280
|
+
@@_everyday ||= Calendar.new('everyday')
|
213
281
|
end
|
214
282
|
|
215
283
|
def to_hash
|
@@ -302,6 +370,134 @@ module Io
|
|
302
370
|
|
303
371
|
end
|
304
372
|
|
373
|
+
class DimensionType
|
374
|
+
|
375
|
+
attr_reader :value
|
376
|
+
|
377
|
+
def initialize(value)
|
378
|
+
@value = HttpClient::Preconditions.assert_class('value', value, String)
|
379
|
+
end
|
380
|
+
|
381
|
+
# Returns the instance of DimensionType for this value, creating a new instance for an unknown value
|
382
|
+
def DimensionType.apply(value)
|
383
|
+
if value.instance_of?(DimensionType)
|
384
|
+
value
|
385
|
+
else
|
386
|
+
HttpClient::Preconditions.assert_class_or_nil('value', value, String)
|
387
|
+
value.nil? ? nil : (from_string(value) || DimensionType.new(value))
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
# Returns the instance of DimensionType for this value, or nil if not found
|
392
|
+
def DimensionType.from_string(value)
|
393
|
+
HttpClient::Preconditions.assert_class('value', value, String)
|
394
|
+
DimensionType.ALL.find { |v| v.value == value }
|
395
|
+
end
|
396
|
+
|
397
|
+
def DimensionType.ALL
|
398
|
+
@@all ||= [DimensionType.product, DimensionType.package]
|
399
|
+
end
|
400
|
+
|
401
|
+
# The standalone dimensions of an item.
|
402
|
+
def DimensionType.product
|
403
|
+
@@_product ||= DimensionType.new('product')
|
404
|
+
end
|
405
|
+
|
406
|
+
# The boxed dimensions of an item.
|
407
|
+
def DimensionType.package
|
408
|
+
@@_package ||= DimensionType.new('package')
|
409
|
+
end
|
410
|
+
|
411
|
+
def to_hash
|
412
|
+
value
|
413
|
+
end
|
414
|
+
|
415
|
+
end
|
416
|
+
|
417
|
+
class ExceptionType
|
418
|
+
|
419
|
+
attr_reader :value
|
420
|
+
|
421
|
+
def initialize(value)
|
422
|
+
@value = HttpClient::Preconditions.assert_class('value', value, String)
|
423
|
+
end
|
424
|
+
|
425
|
+
# Returns the instance of ExceptionType for this value, creating a new instance for an unknown value
|
426
|
+
def ExceptionType.apply(value)
|
427
|
+
if value.instance_of?(ExceptionType)
|
428
|
+
value
|
429
|
+
else
|
430
|
+
HttpClient::Preconditions.assert_class_or_nil('value', value, String)
|
431
|
+
value.nil? ? nil : (from_string(value) || ExceptionType.new(value))
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
# Returns the instance of ExceptionType for this value, or nil if not found
|
436
|
+
def ExceptionType.from_string(value)
|
437
|
+
HttpClient::Preconditions.assert_class('value', value, String)
|
438
|
+
ExceptionType.ALL.find { |v| v.value == value }
|
439
|
+
end
|
440
|
+
|
441
|
+
def ExceptionType.ALL
|
442
|
+
@@all ||= [ExceptionType.open, ExceptionType.closed]
|
443
|
+
end
|
444
|
+
|
445
|
+
def ExceptionType.open
|
446
|
+
@@_open ||= ExceptionType.new('open')
|
447
|
+
end
|
448
|
+
|
449
|
+
def ExceptionType.closed
|
450
|
+
@@_closed ||= ExceptionType.new('closed')
|
451
|
+
end
|
452
|
+
|
453
|
+
def to_hash
|
454
|
+
value
|
455
|
+
end
|
456
|
+
|
457
|
+
end
|
458
|
+
|
459
|
+
class HolidayCalendar
|
460
|
+
|
461
|
+
attr_reader :value
|
462
|
+
|
463
|
+
def initialize(value)
|
464
|
+
@value = HttpClient::Preconditions.assert_class('value', value, String)
|
465
|
+
end
|
466
|
+
|
467
|
+
# Returns the instance of HolidayCalendar for this value, creating a new instance for an unknown value
|
468
|
+
def HolidayCalendar.apply(value)
|
469
|
+
if value.instance_of?(HolidayCalendar)
|
470
|
+
value
|
471
|
+
else
|
472
|
+
HttpClient::Preconditions.assert_class_or_nil('value', value, String)
|
473
|
+
value.nil? ? nil : (from_string(value) || HolidayCalendar.new(value))
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
# Returns the instance of HolidayCalendar for this value, or nil if not found
|
478
|
+
def HolidayCalendar.from_string(value)
|
479
|
+
HttpClient::Preconditions.assert_class('value', value, String)
|
480
|
+
HolidayCalendar.ALL.find { |v| v.value == value }
|
481
|
+
end
|
482
|
+
|
483
|
+
def HolidayCalendar.ALL
|
484
|
+
@@all ||= [HolidayCalendar.us_bank_holidays, HolidayCalendar.jewish_holidays]
|
485
|
+
end
|
486
|
+
|
487
|
+
def HolidayCalendar.us_bank_holidays
|
488
|
+
@@_us_bank_holidays ||= HolidayCalendar.new('us_bank_holidays')
|
489
|
+
end
|
490
|
+
|
491
|
+
def HolidayCalendar.jewish_holidays
|
492
|
+
@@_jewish_holidays ||= HolidayCalendar.new('jewish_holidays')
|
493
|
+
end
|
494
|
+
|
495
|
+
def to_hash
|
496
|
+
value
|
497
|
+
end
|
498
|
+
|
499
|
+
end
|
500
|
+
|
305
501
|
class ScheduleExceptionStatus
|
306
502
|
|
307
503
|
attr_reader :value
|
@@ -344,6 +540,48 @@ module Io
|
|
344
540
|
|
345
541
|
end
|
346
542
|
|
543
|
+
class SortDirection
|
544
|
+
|
545
|
+
attr_reader :value
|
546
|
+
|
547
|
+
def initialize(value)
|
548
|
+
@value = HttpClient::Preconditions.assert_class('value', value, String)
|
549
|
+
end
|
550
|
+
|
551
|
+
# Returns the instance of SortDirection for this value, creating a new instance for an unknown value
|
552
|
+
def SortDirection.apply(value)
|
553
|
+
if value.instance_of?(SortDirection)
|
554
|
+
value
|
555
|
+
else
|
556
|
+
HttpClient::Preconditions.assert_class_or_nil('value', value, String)
|
557
|
+
value.nil? ? nil : (from_string(value) || SortDirection.new(value))
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
# Returns the instance of SortDirection for this value, or nil if not found
|
562
|
+
def SortDirection.from_string(value)
|
563
|
+
HttpClient::Preconditions.assert_class('value', value, String)
|
564
|
+
SortDirection.ALL.find { |v| v.value == value }
|
565
|
+
end
|
566
|
+
|
567
|
+
def SortDirection.ALL
|
568
|
+
@@all ||= [SortDirection.ascending, SortDirection.descending]
|
569
|
+
end
|
570
|
+
|
571
|
+
def SortDirection.ascending
|
572
|
+
@@_ascending ||= SortDirection.new('ascending')
|
573
|
+
end
|
574
|
+
|
575
|
+
def SortDirection.descending
|
576
|
+
@@_descending ||= SortDirection.new('descending')
|
577
|
+
end
|
578
|
+
|
579
|
+
def to_hash
|
580
|
+
value
|
581
|
+
end
|
582
|
+
|
583
|
+
end
|
584
|
+
|
347
585
|
class UnitOfMeasurement
|
348
586
|
|
349
587
|
attr_reader :value
|
@@ -560,43 +798,6 @@ module Io
|
|
560
798
|
|
561
799
|
end
|
562
800
|
|
563
|
-
# Defines structured fields for address to be used in user/form input. Either
|
564
|
-
# text or the structured input needs to be present.
|
565
|
-
class Address
|
566
|
-
|
567
|
-
attr_reader :text, :streets, :city, :province, :postal_code, :country
|
568
|
-
|
569
|
-
def initialize(incoming={})
|
570
|
-
opts = HttpClient::Helper.symbolize_keys(incoming)
|
571
|
-
@text = (x = opts.delete(:text); x.nil? ? nil : HttpClient::Preconditions.assert_class('text', x, String))
|
572
|
-
@streets = (x = opts.delete(:streets); x.nil? ? nil : HttpClient::Preconditions.assert_class('streets', x, Array).map { |v| HttpClient::Preconditions.assert_class('streets', v, String) })
|
573
|
-
@city = (x = opts.delete(:city); x.nil? ? nil : HttpClient::Preconditions.assert_class('city', x, String))
|
574
|
-
@province = (x = opts.delete(:province); x.nil? ? nil : HttpClient::Preconditions.assert_class('province', x, String))
|
575
|
-
@postal_code = (x = opts.delete(:postal_code); x.nil? ? nil : HttpClient::Preconditions.assert_class('postal_code', x, String))
|
576
|
-
@country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
|
577
|
-
end
|
578
|
-
|
579
|
-
def to_json
|
580
|
-
JSON.dump(to_hash)
|
581
|
-
end
|
582
|
-
|
583
|
-
def copy(incoming={})
|
584
|
-
Address.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
585
|
-
end
|
586
|
-
|
587
|
-
def to_hash
|
588
|
-
{
|
589
|
-
:text => text,
|
590
|
-
:streets => streets.nil? ? nil : streets,
|
591
|
-
:city => city,
|
592
|
-
:province => province,
|
593
|
-
:postal_code => postal_code,
|
594
|
-
:country => country
|
595
|
-
}
|
596
|
-
end
|
597
|
-
|
598
|
-
end
|
599
|
-
|
600
801
|
# Defines structured fields for a contact person. Typically used for specifying
|
601
802
|
# contact person for an account, shipment, or organization representative
|
602
803
|
class Contact
|
@@ -659,13 +860,16 @@ module Io
|
|
659
860
|
|
660
861
|
class Dimension
|
661
862
|
|
662
|
-
attr_reader :
|
863
|
+
attr_reader :type, :depth, :length, :weight, :width
|
663
864
|
|
664
865
|
def initialize(incoming={})
|
665
866
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
666
|
-
HttpClient::Preconditions.require_keys(opts, [:
|
667
|
-
@
|
668
|
-
@
|
867
|
+
HttpClient::Preconditions.require_keys(opts, [:type], 'Dimension')
|
868
|
+
@type = (x = opts.delete(:type); x.is_a?(::Io::Flow::Common::V0::Models::DimensionType) ? x : ::Io::Flow::Common::V0::Models::DimensionType.apply(x))
|
869
|
+
@depth = (x = opts.delete(:depth); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
|
870
|
+
@length = (x = opts.delete(:length); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
|
871
|
+
@weight = (x = opts.delete(:weight); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
|
872
|
+
@width = (x = opts.delete(:width); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Measurement) ? x : ::Io::Flow::Common::V0::Models::Measurement.new(x)))
|
669
873
|
end
|
670
874
|
|
671
875
|
def to_json
|
@@ -678,8 +882,11 @@ module Io
|
|
678
882
|
|
679
883
|
def to_hash
|
680
884
|
{
|
681
|
-
:
|
682
|
-
:
|
885
|
+
:type => type.value,
|
886
|
+
:depth => depth.nil? ? nil : depth.to_hash,
|
887
|
+
:length => length.nil? ? nil : length.to_hash,
|
888
|
+
:weight => weight.nil? ? nil : weight.to_hash,
|
889
|
+
:width => width.nil? ? nil : width.to_hash
|
683
890
|
}
|
684
891
|
end
|
685
892
|
|
@@ -713,6 +920,70 @@ module Io
|
|
713
920
|
|
714
921
|
end
|
715
922
|
|
923
|
+
# Represents an exception to the schedule of a location.
|
924
|
+
class Exception
|
925
|
+
|
926
|
+
attr_reader :type, :datetime_range
|
927
|
+
|
928
|
+
def initialize(incoming={})
|
929
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
930
|
+
HttpClient::Preconditions.require_keys(opts, [:type, :datetime_range], 'Exception')
|
931
|
+
@type = (x = opts.delete(:type); x.is_a?(::Io::Flow::Common::V0::Models::ExceptionType) ? x : ::Io::Flow::Common::V0::Models::ExceptionType.apply(x))
|
932
|
+
@datetime_range = (x = opts.delete(:datetime_range); x.is_a?(::Io::Flow::Common::V0::Models::DatetimeRange) ? x : ::Io::Flow::Common::V0::Models::DatetimeRange.new(x))
|
933
|
+
end
|
934
|
+
|
935
|
+
def to_json
|
936
|
+
JSON.dump(to_hash)
|
937
|
+
end
|
938
|
+
|
939
|
+
def copy(incoming={})
|
940
|
+
Exception.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
941
|
+
end
|
942
|
+
|
943
|
+
def to_hash
|
944
|
+
{
|
945
|
+
:type => type.value,
|
946
|
+
:datetime_range => datetime_range.to_hash
|
947
|
+
}
|
948
|
+
end
|
949
|
+
|
950
|
+
end
|
951
|
+
|
952
|
+
# Some important fields related to experiences used in various APIs
|
953
|
+
class ExperienceSummary
|
954
|
+
|
955
|
+
attr_reader :id, :key, :name, :currency, :country
|
956
|
+
|
957
|
+
def initialize(incoming={})
|
958
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
959
|
+
HttpClient::Preconditions.require_keys(opts, [:id, :key, :name], 'ExperienceSummary')
|
960
|
+
@id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
|
961
|
+
@key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
|
962
|
+
@name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
|
963
|
+
@currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
|
964
|
+
@country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
|
965
|
+
end
|
966
|
+
|
967
|
+
def to_json
|
968
|
+
JSON.dump(to_hash)
|
969
|
+
end
|
970
|
+
|
971
|
+
def copy(incoming={})
|
972
|
+
ExperienceSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
973
|
+
end
|
974
|
+
|
975
|
+
def to_hash
|
976
|
+
{
|
977
|
+
:id => id,
|
978
|
+
:key => key,
|
979
|
+
:name => name,
|
980
|
+
:currency => currency,
|
981
|
+
:country => country
|
982
|
+
}
|
983
|
+
end
|
984
|
+
|
985
|
+
end
|
986
|
+
|
716
987
|
class Healthcheck
|
717
988
|
|
718
989
|
attr_reader :status
|
@@ -739,17 +1010,56 @@ module Io
|
|
739
1010
|
|
740
1011
|
end
|
741
1012
|
|
742
|
-
#
|
743
|
-
#
|
744
|
-
|
745
|
-
|
1013
|
+
# Defines structured fields for address to be used in user/form input. Either
|
1014
|
+
# text or the structured input needs to be present.
|
1015
|
+
class Location < ExpandableLocation
|
1016
|
+
|
1017
|
+
attr_reader :text, :streets, :city, :province, :postal, :country, :latitude, :longitude
|
1018
|
+
|
1019
|
+
def initialize(incoming={})
|
1020
|
+
super(:name => ExpandableLocation::Types::LOCATION)
|
1021
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
1022
|
+
@text = (x = opts.delete(:text); x.nil? ? nil : HttpClient::Preconditions.assert_class('text', x, String))
|
1023
|
+
@streets = (x = opts.delete(:streets); x.nil? ? nil : HttpClient::Preconditions.assert_class('streets', x, Array).map { |v| HttpClient::Preconditions.assert_class('streets', v, String) })
|
1024
|
+
@city = (x = opts.delete(:city); x.nil? ? nil : HttpClient::Preconditions.assert_class('city', x, String))
|
1025
|
+
@province = (x = opts.delete(:province); x.nil? ? nil : HttpClient::Preconditions.assert_class('province', x, String))
|
1026
|
+
@postal = (x = opts.delete(:postal); x.nil? ? nil : HttpClient::Preconditions.assert_class('postal', x, String))
|
1027
|
+
@country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
|
1028
|
+
@latitude = (x = opts.delete(:latitude); x.nil? ? nil : HttpClient::Preconditions.assert_class('latitude', x, String))
|
1029
|
+
@longitude = (x = opts.delete(:longitude); x.nil? ? nil : HttpClient::Preconditions.assert_class('longitude', x, String))
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
def to_json
|
1033
|
+
JSON.dump(to_hash)
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
def copy(incoming={})
|
1037
|
+
Location.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
def subtype_to_hash
|
1041
|
+
{
|
1042
|
+
:text => text,
|
1043
|
+
:streets => streets.nil? ? nil : streets,
|
1044
|
+
:city => city,
|
1045
|
+
:province => province,
|
1046
|
+
:postal => postal,
|
1047
|
+
:country => country,
|
1048
|
+
:latitude => latitude,
|
1049
|
+
:longitude => longitude
|
1050
|
+
}
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
class LocationReference < ExpandableLocation
|
746
1056
|
|
747
|
-
attr_reader :
|
1057
|
+
attr_reader :text
|
748
1058
|
|
749
1059
|
def initialize(incoming={})
|
1060
|
+
super(:name => ExpandableLocation::Types::LOCATION_REFERENCE)
|
750
1061
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
751
|
-
HttpClient::Preconditions.
|
752
|
-
@value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), String)
|
1062
|
+
@text = (x = opts.delete(:text); x.nil? ? nil : HttpClient::Preconditions.assert_class('text', x, String))
|
753
1063
|
end
|
754
1064
|
|
755
1065
|
def to_json
|
@@ -757,12 +1067,12 @@ module Io
|
|
757
1067
|
end
|
758
1068
|
|
759
1069
|
def copy(incoming={})
|
760
|
-
|
1070
|
+
LocationReference.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
761
1071
|
end
|
762
1072
|
|
763
|
-
def
|
1073
|
+
def subtype_to_hash
|
764
1074
|
{
|
765
|
-
:
|
1075
|
+
:text => text
|
766
1076
|
}
|
767
1077
|
end
|
768
1078
|
|
@@ -908,15 +1218,18 @@ module Io
|
|
908
1218
|
|
909
1219
|
end
|
910
1220
|
|
911
|
-
|
1221
|
+
# Represents operating calendar and holidays of a location
|
1222
|
+
class Schedule
|
912
1223
|
|
913
|
-
attr_reader :
|
1224
|
+
attr_reader :calendar, :holiday, :exception, :cutoff
|
914
1225
|
|
915
1226
|
def initialize(incoming={})
|
916
1227
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
917
|
-
HttpClient::Preconditions.require_keys(opts, [:
|
918
|
-
@
|
919
|
-
@
|
1228
|
+
HttpClient::Preconditions.require_keys(opts, [:holiday, :exception], 'Schedule')
|
1229
|
+
@calendar = (x = opts.delete(:calendar); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::Common::V0::Models::Calendar) ? x : ::Io::Flow::Common::V0::Models::Calendar.apply(x)))
|
1230
|
+
@holiday = (x = opts.delete(:holiday); x.is_a?(::Io::Flow::Common::V0::Models::HolidayCalendar) ? x : ::Io::Flow::Common::V0::Models::HolidayCalendar.apply(x))
|
1231
|
+
@exception = HttpClient::Preconditions.assert_class('exception', opts.delete(:exception), Array).map { |v| (x = v; x.is_a?(::Io::Flow::Common::V0::Models::Exception) ? x : ::Io::Flow::Common::V0::Models::Exception.new(x)) }
|
1232
|
+
@cutoff = (x = opts.delete(:cutoff); x.nil? ? nil : HttpClient::Preconditions.assert_class('cutoff', x, String))
|
920
1233
|
end
|
921
1234
|
|
922
1235
|
def to_json
|
@@ -924,13 +1237,15 @@ module Io
|
|
924
1237
|
end
|
925
1238
|
|
926
1239
|
def copy(incoming={})
|
927
|
-
|
1240
|
+
Schedule.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
928
1241
|
end
|
929
1242
|
|
930
1243
|
def to_hash
|
931
1244
|
{
|
932
|
-
:
|
933
|
-
:
|
1245
|
+
:calendar => calendar.nil? ? nil : calendar.value,
|
1246
|
+
:holiday => holiday.value,
|
1247
|
+
:exception => exception.map { |o| o.to_hash },
|
1248
|
+
:cutoff => cutoff
|
934
1249
|
}
|
935
1250
|
end
|
936
1251
|
|