Class: ShopifyAPI::Customer
- Inherits:
-
Rest::Base
- Object
- Rest::Base
- ShopifyAPI::Customer
- Extended by:
- T::Sig
- Defined in:
- lib/shopify_api/rest/resources/2021_07/customer.rb,
lib/shopify_api/rest/resources/2021_10/customer.rb,
lib/shopify_api/rest/resources/2022_01/customer.rb,
lib/shopify_api/rest/resources/2022_04/customer.rb
Instance Attribute Summary collapse
-
#accepts_marketing ⇒ Object
readonly
Returns the value of attribute accepts_marketing.
-
#accepts_marketing_updated_at ⇒ Object
readonly
Returns the value of attribute accepts_marketing_updated_at.
-
#addresses ⇒ Object
readonly
Returns the value of attribute addresses.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#default_address ⇒ Object
readonly
Returns the value of attribute default_address.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#email_marketing_consent ⇒ Object
readonly
Returns the value of attribute email_marketing_consent.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#last_order_id ⇒ Object
readonly
Returns the value of attribute last_order_id.
-
#last_order_name ⇒ Object
readonly
Returns the value of attribute last_order_name.
-
#marketing_opt_in_level ⇒ Object
readonly
Returns the value of attribute marketing_opt_in_level.
-
#metafield ⇒ Object
readonly
Returns the value of attribute metafield.
-
#multipass_identifier ⇒ Object
readonly
Returns the value of attribute multipass_identifier.
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#orders_count ⇒ Object
readonly
Returns the value of attribute orders_count.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
-
#sms_marketing_consent ⇒ Object
readonly
Returns the value of attribute sms_marketing_consent.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#tax_exempt ⇒ Object
readonly
Returns the value of attribute tax_exempt.
-
#tax_exemptions ⇒ Object
readonly
Returns the value of attribute tax_exemptions.
-
#total_spent ⇒ Object
readonly
Returns the value of attribute total_spent.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#verified_email ⇒ Object
readonly
Returns the value of attribute verified_email.
Attributes inherited from Rest::Base
Class Method Summary collapse
- .all(ids: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, limit: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .count(session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .find(id:, fields: nil, session: ShopifyAPI::Context.active_session) ⇒ Object
- .orders(id:, status: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .search(order: nil, query: nil, limit: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
Instance Method Summary collapse
- #account_activation_url(body: nil, **kwargs) ⇒ Object
-
#initialize(session: ShopifyAPI::Context.active_session) ⇒ Customer
constructor
A new instance of Customer.
- #send_invite(body: nil, **kwargs) ⇒ Object
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) ⇒ Customer
Returns a new instance of Customer.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 12 def initialize(session: ShopifyAPI::Context.active_session) super(session: session) @accepts_marketing = T.let(nil, T.nilable(T::Boolean)) @accepts_marketing_updated_at = T.let(nil, T.nilable(String)) @addresses = T.let(nil, T.nilable(T::Array[T.untyped])) @created_at = T.let(nil, T.nilable(String)) @currency = T.let(nil, T.nilable(String)) @default_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @email = T.let(nil, T.nilable(String)) @first_name = T.let(nil, T.nilable(String)) @id = T.let(nil, T.nilable(Integer)) @last_name = T.let(nil, T.nilable(String)) @last_order_id = T.let(nil, T.nilable(Integer)) @last_order_name = T.let(nil, T.nilable(String)) @marketing_opt_in_level = T.let(nil, T.nilable(String)) @metafield = T.let(nil, T.nilable(Metafield)) @multipass_identifier = T.let(nil, T.nilable(String)) @note = T.let(nil, T.nilable(String)) @orders_count = T.let(nil, T.nilable(Integer)) @phone = T.let(nil, T.nilable(String)) @state = T.let(nil, T.nilable(String)) @tags = T.let(nil, T.nilable(String)) @tax_exempt = T.let(nil, T.nilable(T::Boolean)) @tax_exemptions = T.let(nil, T.nilable(T::Array[T.untyped])) @total_spent = T.let(nil, T.nilable(String)) @updated_at = T.let(nil, T.nilable(String)) @verified_email = T.let(nil, T.nilable(T::Boolean)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base
Instance Attribute Details
#accepts_marketing ⇒ Object (readonly)
Returns the value of attribute accepts_marketing.
59 60 61 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 59 def accepts_marketing @accepts_marketing end |
#accepts_marketing_updated_at ⇒ Object (readonly)
Returns the value of attribute accepts_marketing_updated_at.
61 62 63 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 61 def accepts_marketing_updated_at @accepts_marketing_updated_at end |
#addresses ⇒ Object (readonly)
Returns the value of attribute addresses.
63 64 65 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 63 def addresses @addresses end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
65 66 67 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 65 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
67 68 69 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 67 def currency @currency end |
#default_address ⇒ Object (readonly)
Returns the value of attribute default_address.
69 70 71 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 69 def default_address @default_address end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
71 72 73 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 71 def email @email end |
#email_marketing_consent ⇒ Object (readonly)
Returns the value of attribute email_marketing_consent.
75 76 77 |
# File 'lib/shopify_api/rest/resources/2022_04/customer.rb', line 75 def @email_marketing_consent end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
73 74 75 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 73 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
75 76 77 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 75 def id @id end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
77 78 79 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 77 def last_name @last_name end |
#last_order_id ⇒ Object (readonly)
Returns the value of attribute last_order_id.
79 80 81 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 79 def last_order_id @last_order_id end |
#last_order_name ⇒ Object (readonly)
Returns the value of attribute last_order_name.
81 82 83 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 81 def last_order_name @last_order_name end |
#marketing_opt_in_level ⇒ Object (readonly)
Returns the value of attribute marketing_opt_in_level.
83 84 85 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 83 def marketing_opt_in_level @marketing_opt_in_level end |
#metafield ⇒ Object (readonly)
Returns the value of attribute metafield.
85 86 87 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 85 def @metafield end |
#multipass_identifier ⇒ Object (readonly)
Returns the value of attribute multipass_identifier.
87 88 89 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 87 def multipass_identifier @multipass_identifier end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
89 90 91 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 89 def note @note end |
#orders_count ⇒ Object (readonly)
Returns the value of attribute orders_count.
91 92 93 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 91 def orders_count @orders_count end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
93 94 95 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 93 def phone @phone end |
#sms_marketing_consent ⇒ Object (readonly)
Returns the value of attribute sms_marketing_consent.
96 97 98 |
# File 'lib/shopify_api/rest/resources/2021_10/customer.rb', line 96 def @sms_marketing_consent end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
95 96 97 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 95 def state @state end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
97 98 99 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 97 def @tags end |
#tax_exempt ⇒ Object (readonly)
Returns the value of attribute tax_exempt.
99 100 101 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 99 def tax_exempt @tax_exempt end |
#tax_exemptions ⇒ Object (readonly)
Returns the value of attribute tax_exemptions.
101 102 103 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 101 def tax_exemptions @tax_exemptions end |
#total_spent ⇒ Object (readonly)
Returns the value of attribute total_spent.
103 104 105 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 103 def total_spent @total_spent end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
105 106 107 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 105 def updated_at @updated_at end |
#verified_email ⇒ Object (readonly)
Returns the value of attribute verified_email.
107 108 109 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 107 def verified_email @verified_email end |
Class Method Details
.all(ids: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, limit: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 144 def all( ids: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, limit: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs ) response = base_find( session: session, ids: {}, params: {ids: ids, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, limit: limit, fields: fields}.merge(kwargs).compact, ) T.cast(response, T::Array[Customer]) end |
.count(session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 171 def count( session: ShopifyAPI::Context.active_session, **kwargs ) request( http_method: :get, operation: :count, session: session, ids: {}, params: {}.merge(kwargs).compact, body: {}, entity: nil, ) end |
.find(id:, fields: nil, session: ShopifyAPI::Context.active_session) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 117 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(Customer)) end |
.orders(id:, status: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 194 def orders( id:, status: nil, session: ShopifyAPI::Context.active_session, **kwargs ) request( http_method: :get, operation: :orders, session: session, ids: {id: id}, params: {status: status}.merge(kwargs).compact, body: {}, entity: nil, ) end |
.search(order: nil, query: nil, limit: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 221 def search( order: nil, query: nil, limit: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs ) request( http_method: :get, operation: :search, session: session, ids: {}, params: {order: order, query: query, limit: limit, fields: fields}.merge(kwargs).compact, body: {}, entity: nil, ) end |
Instance Method Details
#account_activation_url(body: nil, **kwargs) ⇒ Object
248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 248 def account_activation_url( body: nil, **kwargs ) self.class.request( http_method: :post, operation: :account_activation_url, session: @session, ids: {id: @id}, params: {}.merge(kwargs).compact, body: body, entity: self, ) end |
#send_invite(body: nil, **kwargs) ⇒ Object
269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/shopify_api/rest/resources/2021_07/customer.rb', line 269 def send_invite( body: nil, **kwargs ) self.class.request( http_method: :post, operation: :send_invite, session: @session, ids: {id: @id}, params: {}.merge(kwargs).compact, body: body, entity: self, ) end |