Class: ShopifyAPI::Redirect

Inherits:
ShopifyAPI::Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2021_07/redirect.rb,
lib/shopify_api/rest/resources/2021_10/redirect.rb,
lib/shopify_api/rest/resources/2022_01/redirect.rb,
lib/shopify_api/rest/resources/2022_04/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, #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.


12
13
14
15
16
17
18
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 12

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.


32
33
34
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 32

def id
  @id
end

#pathObject (readonly)

Returns the value of attribute path.


34
35
36
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 34

def path
  @path
end

#targetObject (readonly)

Returns the value of attribute target.


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

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


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 89

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


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 115

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


65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 65

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


46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/shopify_api/rest/resources/2021_07/redirect.rb', line 46

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