Class: ShopifyAPI::User

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


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/shopify_api/rest/resources/2021_07/user.rb', line 12

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.


40
41
42
# File 'lib/shopify_api/rest/resources/2021_07/user.rb', line 40

def 
  @account_owner
end

#bioObject (readonly)

Returns the value of attribute bio.


42
43
44
# File 'lib/shopify_api/rest/resources/2021_07/user.rb', line 42

def bio
  @bio
end

#emailObject (readonly)

Returns the value of attribute email.


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

def email
  @email
end

#first_nameObject (readonly)

Returns the value of attribute first_name.


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

def first_name
  @first_name
end

#idObject (readonly)

Returns the value of attribute id.


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

def id
  @id
end

#imObject (readonly)

Returns the value of attribute im.


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

def im
  @im
end

#last_nameObject (readonly)

Returns the value of attribute last_name.


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

def last_name
  @last_name
end

#localeObject (readonly)

Returns the value of attribute locale.


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

def locale
  @locale
end

#permissionsObject (readonly)

Returns the value of attribute permissions.


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

def permissions
  @permissions
end

#phoneObject (readonly)

Returns the value of attribute phone.


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

def phone
  @phone
end

#receive_announcementsObject (readonly)

Returns the value of attribute receive_announcements.


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

def receive_announcements
  @receive_announcements
end

#screen_nameObject (readonly)

Returns the value of attribute screen_name.


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

def screen_name
  @screen_name
end

#urlObject (readonly)

Returns the value of attribute url.


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

def url
  @url
end

#user_typeObject (readonly)

Returns the value of attribute user_type.


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

def user_type
  @user_type
end

Class Method Details

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


95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/shopify_api/rest/resources/2021_07/user.rb', line 95

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


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

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


75
76
77
78
79
80
81
82
83
84
85
# File 'lib/shopify_api/rest/resources/2021_07/user.rb', line 75

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