Class: ShopifyAPI::ShippingZone

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

Returns a new instance of ShippingZone.


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/shopify_api/rest/resources/2021_07/shipping_zone.rb', line 12

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

  @carrier_shipping_rate_providers = T.let(nil, T.untyped)
  @countries = T.let(nil, T.nilable(T::Array[T.untyped]))
  @id = T.let(nil, T.nilable(Integer))
  @location_group_id = T.let(nil, T.nilable(Integer))
  @name = T.let(nil, T.nilable(String))
  @price_based_shipping_rates = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @profile_id = T.let(nil, T.nilable(Integer))
  @provinces = T.let(nil, T.nilable(T::Array[T.untyped]))
  @weight_based_shipping_rates = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base

Instance Attribute Details

#carrier_shipping_rate_providersObject (readonly)

Returns the value of attribute carrier_shipping_rate_providers.


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

def carrier_shipping_rate_providers
  @carrier_shipping_rate_providers
end

#countriesObject (readonly)

Returns the value of attribute countries.


38
39
40
# File 'lib/shopify_api/rest/resources/2021_07/shipping_zone.rb', line 38

def countries
  @countries
end

#idObject (readonly)

Returns the value of attribute id.


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

def id
  @id
end

#location_group_idObject (readonly)

Returns the value of attribute location_group_id.


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

def location_group_id
  @location_group_id
end

#nameObject (readonly)

Returns the value of attribute name.


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

def name
  @name
end

#price_based_shipping_ratesObject (readonly)

Returns the value of attribute price_based_shipping_rates.


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

def price_based_shipping_rates
  @price_based_shipping_rates
end

#profile_idObject (readonly)

Returns the value of attribute profile_id.


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

def profile_id
  @profile_id
end

#provincesObject (readonly)

Returns the value of attribute provinces.


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

def provinces
  @provinces
end

#weight_based_shipping_ratesObject (readonly)

Returns the value of attribute weight_based_shipping_rates.


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

def weight_based_shipping_rates
  @weight_based_shipping_rates
end

Class Method Details

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


62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/shopify_api/rest/resources/2021_07/shipping_zone.rb', line 62

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

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