Class: ShopifyAPI::Location

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/location.rb,
lib/shopify_api/rest/resources/2022_07/location.rb,
lib/shopify_api/rest/resources/2022_10/location.rb,
lib/shopify_api/rest/resources/2023_01/location.rb,
lib/shopify_api/rest/resources/2023_04/location.rb,
lib/shopify_api/rest/resources/2023_07/location.rb,
lib/shopify_api/rest/resources/2023_10/location.rb,
lib/shopify_api/rest/resources/2024_01/location.rb,
lib/shopify_api/rest/resources/2024_04/location.rb,
lib/shopify_api/rest/resources/2024_07/location.rb,
lib/shopify_api/rest/resources/2024_10/location.rb

Instance Attribute Summary collapse

Attributes inherited from Rest::Base

#errors, #original_state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rest::Base

api_call_limit, base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, get_path_ids, has_many?, has_one?, inherited, json_body_name, json_response_body_names, #method_missing, next_page?, next_page_info, prev_page?, prev_page_info, primary_key, read_only_attributes, request, #respond_to_missing?, retry_request_after, #save, #save!, #to_hash

Constructor Details

#initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) ⇒ Location

Returns a new instance of Location.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 19

def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)

  @active = T.let(nil, T.nilable(T::Boolean))
  @address1 = T.let(nil, T.nilable(String))
  @address2 = T.let(nil, T.nilable(String))
  @city = T.let(nil, T.nilable(String))
  @country = T.let(nil, T.nilable(String))
  @country_code = T.let(nil, T.nilable(String))
  @created_at = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @legacy = T.let(nil, T.nilable(T::Boolean))
  @localized_country_name = T.let(nil, T.nilable(String))
  @localized_province_name = T.let(nil, T.nilable(String))
  @name = T.let(nil, T.nilable(String))
  @phone = T.let(nil, T.nilable(String))
  @province = T.let(nil, T.nilable(String))
  @province_code = T.let(nil, T.nilable(String))
  @updated_at = T.let(nil, T.nilable(String))
  @zip = T.let(nil, T.nilable(String))

  super(session: session, from_hash: from_hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



52
53
54
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 52

def active
  @active
end

#address1Object (readonly)

Returns the value of attribute address1.



54
55
56
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 54

def address1
  @address1
end

#address2Object (readonly)

Returns the value of attribute address2.



56
57
58
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 56

def address2
  @address2
end

#cityObject (readonly)

Returns the value of attribute city.



58
59
60
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 58

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



60
61
62
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 60

def country
  @country
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



62
63
64
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 62

def country_code
  @country_code
end

#created_atObject (readonly)

Returns the value of attribute created_at.



64
65
66
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 64

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



66
67
68
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 66

def id
  @id
end

#legacyObject (readonly)

Returns the value of attribute legacy.



68
69
70
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 68

def legacy
  @legacy
end

#localized_country_nameObject (readonly)

Returns the value of attribute localized_country_name.



70
71
72
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 70

def localized_country_name
  @localized_country_name
end

#localized_province_nameObject (readonly)

Returns the value of attribute localized_province_name.



72
73
74
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 72

def localized_province_name
  @localized_province_name
end

#nameObject (readonly)

Returns the value of attribute name.



74
75
76
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 74

def name
  @name
end

#phoneObject (readonly)

Returns the value of attribute phone.



76
77
78
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 76

def phone
  @phone
end

#provinceObject (readonly)

Returns the value of attribute province.



78
79
80
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 78

def province
  @province
end

#province_codeObject (readonly)

Returns the value of attribute province_code.



80
81
82
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 80

def province_code
  @province_code
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



82
83
84
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 82

def updated_at
  @updated_at
end

#zipObject (readonly)

Returns the value of attribute zip.



84
85
86
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 84

def zip
  @zip
end

Class Method Details

.all(session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 111

def all(
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {},
    params: {}.merge(kwargs).compact,
  )

  T.cast(response, T::Array[Location])
end

.count(session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 130

def count(
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :count,
    session: session,
    ids: {},
    params: {}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end

.find(id:, session: ShopifyAPI::Context.active_session) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 93

def find(
  id:,
  session: ShopifyAPI::Context.active_session
)
  result = base_find(
    session: session,
    ids: {id: id},
    params: {},
  )
  T.cast(result[0], T.nilable(Location))
end

.inventory_levels(id:, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/shopify_api/rest/resources/2022_04/location.rb', line 152

def inventory_levels(
  id:,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :inventory_levels,
    session: session,
    ids: {id: id},
    params: {}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end