Class: ShopifyAPI::ApiVersion
- Inherits:
-
Object
- Object
- ShopifyAPI::ApiVersion
show all
- Includes:
- Comparable
- Defined in:
- lib/shopify_api/api_version.rb
Defined Under Namespace
Classes: InvalidVersion, Release, UnknownVersion, Unstable
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.clear_defined_versions ⇒ Object
24
25
26
|
# File 'lib/shopify_api/api_version.rb', line 24
def self.clear_defined_versions
@versions = {}
end
|
.coerce_to_version(version_or_name) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/shopify_api/api_version.rb', line 9
def self.coerce_to_version(version_or_name)
return version_or_name if version_or_name.is_a?(ApiVersion)
@versions ||= {}
@versions.fetch(version_or_name.to_s) do
raise UnknownVersion, "#{version_or_name} is not in the defined version set: #{@versions.keys.join(', ')}"
end
end
|
.define_known_versions ⇒ Object
28
29
30
31
|
# File 'lib/shopify_api/api_version.rb', line 28
def self.define_known_versions
define_version(Unstable.new)
define_version(Release.new('2019-04'))
end
|
.define_version(version) ⇒ Object
18
19
20
21
22
|
# File 'lib/shopify_api/api_version.rb', line 18
def self.define_version(version)
@versions ||= {}
@versions[version.name] = version
end
|
.latest_stable_version ⇒ Object
33
34
35
|
# File 'lib/shopify_api/api_version.rb', line 33
def self.latest_stable_version
@versions.values.select(&:stable?).sort.last
end
|
Instance Method Details
#<=>(other) ⇒ Object
54
55
56
|
# File 'lib/shopify_api/api_version.rb', line 54
def <=>(other)
numeric_version <=> other.numeric_version
end
|
#==(other) ⇒ Object
46
47
48
|
# File 'lib/shopify_api/api_version.rb', line 46
def ==(other)
other.class == self.class && to_s == other.to_s
end
|
#construct_api_path(_path) ⇒ Object
62
63
64
|
# File 'lib/shopify_api/api_version.rb', line 62
def construct_api_path(_path)
raise NotImplementedError
end
|
#construct_graphql_path ⇒ Object
66
67
68
|
# File 'lib/shopify_api/api_version.rb', line 66
def construct_graphql_path
raise NotImplementedError
end
|
#hash ⇒ Object
50
51
52
|
# File 'lib/shopify_api/api_version.rb', line 50
def hash
@version_name.hash
end
|
#inspect ⇒ Object
42
43
44
|
# File 'lib/shopify_api/api_version.rb', line 42
def inspect
@version_name
end
|
#stable? ⇒ Boolean
58
59
60
|
# File 'lib/shopify_api/api_version.rb', line 58
def stable?
false
end
|
#to_s ⇒ Object
Also known as:
name
37
38
39
|
# File 'lib/shopify_api/api_version.rb', line 37
def to_s
@version_name
end
|