Class: ShopifyAPI::User

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/user.rb,
lib/shopify_api/rest/resources/2022_07/user.rb,
lib/shopify_api/rest/resources/2022_10/user.rb,
lib/shopify_api/rest/resources/2023_01/user.rb,
lib/shopify_api/rest/resources/2023_04/user.rb,
lib/shopify_api/rest/resources/2023_07/user.rb,
lib/shopify_api/rest/resources/2023_10/user.rb,
lib/shopify_api/rest/resources/2024_01/user.rb,
lib/shopify_api/rest/resources/2024_04/user.rb,
lib/shopify_api/rest/resources/2024_07/user.rb,
lib/shopify_api/rest/resources/2024_10/user.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) ⇒ User

Returns a new instance of User.



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

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

  @account_owner = T.let(nil, T.nilable(T::Boolean))
  @bio = T.let(nil, T.nilable(String))
  @email = T.let(nil, T.nilable(String))
  @first_name = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @im = T.let(nil, T.nilable(String))
  @last_name = T.let(nil, T.nilable(String))
  @locale = T.let(nil, T.nilable(String))
  @permissions = T.let(nil, T.nilable(T::Array[T.untyped]))
  @phone = T.let(nil, T.nilable(String))
  @receive_announcements = T.let(nil, T.nilable(Integer))
  @screen_name = T.let(nil, T.nilable(String))
  @url = T.let(nil, T.nilable(String))
  @user_type = 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

#account_ownerObject (readonly)

Returns the value of attribute account_owner.



48
49
50
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 48

def 
  @account_owner
end

#bioObject (readonly)

Returns the value of attribute bio.



50
51
52
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 50

def bio
  @bio
end

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#imObject (readonly)

Returns the value of attribute im.



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

def im
  @im
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#localeObject (readonly)

Returns the value of attribute locale.



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

def locale
  @locale
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



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

def permissions
  @permissions
end

#phoneObject (readonly)

Returns the value of attribute phone.



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

def phone
  @phone
end

#receive_announcementsObject (readonly)

Returns the value of attribute receive_announcements.



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

def receive_announcements
  @receive_announcements
end

#screen_nameObject (readonly)

Returns the value of attribute screen_name.



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

def screen_name
  @screen_name
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#user_typeObject (readonly)

Returns the value of attribute user_type.



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

def user_type
  @user_type
end

Class Method Details

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



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 103

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

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

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



124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 124

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

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



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 83

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