Class: ShopifyAPI::ApiVersion
- Inherits:
-
Object
- Object
- ShopifyAPI::ApiVersion
show all
- Extended by:
- DefinedVersions
- Includes:
- Comparable
- Defined in:
- lib/shopify_api/api_version.rb
Defined Under Namespace
Classes: ApiVersionNotSetError, InvalidVersion, NullVersion, Release, UnknownVersion, Unstable
Class Method Summary
collapse
Instance Method Summary
collapse
define_known_versions
Class Method Details
.clear_defined_versions ⇒ Object
27
28
29
|
# File 'lib/shopify_api/api_version.rb', line 27
def self.clear_defined_versions
@versions = {}
end
|
.coerce_to_version(version_or_name) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/shopify_api/api_version.rb', line 12
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_version(version) ⇒ Object
21
22
23
24
25
|
# File 'lib/shopify_api/api_version.rb', line 21
def self.define_version(version)
@versions ||= {}
@versions[version.name] = version
end
|
.latest_stable_version ⇒ Object
31
32
33
|
# File 'lib/shopify_api/api_version.rb', line 31
def self.latest_stable_version
@versions.values.select(&:stable?).sort.last
end
|
Instance Method Details
#<=>(other) ⇒ Object
52
53
54
|
# File 'lib/shopify_api/api_version.rb', line 52
def <=>(other)
numeric_version <=> other.numeric_version
end
|
#==(other) ⇒ Object
44
45
46
|
# File 'lib/shopify_api/api_version.rb', line 44
def ==(other)
other.class == self.class && to_s == other.to_s
end
|
#construct_api_path(_path) ⇒ Object
60
61
62
|
# File 'lib/shopify_api/api_version.rb', line 60
def construct_api_path(_path)
raise NotImplementedError
end
|
#construct_graphql_path ⇒ Object
64
65
66
|
# File 'lib/shopify_api/api_version.rb', line 64
def construct_graphql_path
raise NotImplementedError
end
|
#hash ⇒ Object
48
49
50
|
# File 'lib/shopify_api/api_version.rb', line 48
def hash
@version_name.hash
end
|
#inspect ⇒ Object
40
41
42
|
# File 'lib/shopify_api/api_version.rb', line 40
def inspect
@version_name
end
|
#stable? ⇒ Boolean
56
57
58
|
# File 'lib/shopify_api/api_version.rb', line 56
def stable?
false
end
|
#to_s ⇒ Object
Also known as:
name
35
36
37
|
# File 'lib/shopify_api/api_version.rb', line 35
def to_s
@version_name
end
|