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

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

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) ⇒ User

Returns a new instance of User.



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

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

  @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))
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.



44
45
46
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 44

def 
  @account_owner
end

#bioObject (readonly)

Returns the value of attribute bio.



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

def bio
  @bio
end

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#imObject (readonly)

Returns the value of attribute im.



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

def im
  @im
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#localeObject (readonly)

Returns the value of attribute locale.



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

def locale
  @locale
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



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

def permissions
  @permissions
end

#phoneObject (readonly)

Returns the value of attribute phone.



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

def phone
  @phone
end

#receive_announcementsObject (readonly)

Returns the value of attribute receive_announcements.



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

def receive_announcements
  @receive_announcements
end

#screen_nameObject (readonly)

Returns the value of attribute screen_name.



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

def screen_name
  @screen_name
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#user_typeObject (readonly)

Returns the value of attribute user_type.



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

def user_type
  @user_type
end

Class Method Details

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 99

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



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

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



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/shopify_api/rest/resources/2022_04/user.rb', line 79

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