Class: ShopifyAPI::Redirect

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

Instance Attribute Summary collapse

Attributes inherited from ShopifyAPI::Rest::Base

#errors, #original_state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ShopifyAPI::Rest::Base

base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, has_many?, has_one?, 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?, #save, #save!, #to_hash

Constructor Details

#initialize(session: ShopifyAPI::Context.active_session) ⇒ Redirect

Returns a new instance of Redirect.



16
17
18
19
20
21
22
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 16

def initialize(session: ShopifyAPI::Context.active_session)
  super(session: session)

  @id = T.let(nil, T.nilable(Integer))
  @path = T.let(nil, T.nilable(String))
  @target = T.let(nil, T.nilable(String))
end

Dynamic Method Handling

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



36
37
38
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 36

def id
  @id
end

#pathObject (readonly)

Returns the value of attribute path.



38
39
40
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 38

def path
  @path
end

#targetObject (readonly)

Returns the value of attribute target.



40
41
42
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 40

def target
  @target
end

Class Method Details

.all(limit: nil, since_id: nil, path: nil, target: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 93

def all(
  limit: nil,
  since_id: nil,
  path: nil,
  target: nil,
  fields: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {},
    params: {limit: limit, since_id: since_id, path: path, target: target, fields: fields}.merge(kwargs).compact,
  )

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

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



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 119

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

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



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 69

def delete(
  id:,
  session: ShopifyAPI::Context.active_session
)
  request(
    http_method: :delete,
    operation: :delete,
    session: session,
    ids: {id: id},
    params: {},
  )
end

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



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/shopify_api/rest/resources/2022_04/redirect.rb', line 50

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