Class: Io::Flow::V0::Models::ShopifyGrant

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ShopifyGrant



19012
19013
19014
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19012

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19010
19011
19012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19010

def value
  @value
end

Class Method Details

.ALLObject



19032
19033
19034
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19032

def ShopifyGrant.ALL
  @@all ||= [ShopifyGrant.customer, ShopifyGrant.discount, ShopifyGrant.gift_card, ShopifyGrant.metafield, ShopifyGrant.order]
end

.apply(value) ⇒ Object

Returns the instance of ShopifyGrant for this value, creating a new instance for an unknown value



19017
19018
19019
19020
19021
19022
19023
19024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19017

def ShopifyGrant.apply(value)
  if value.instance_of?(ShopifyGrant)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || ShopifyGrant.new(value))
  end
end

.customerObject

Access to /admin/customers.json



19037
19038
19039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19037

def ShopifyGrant.customer
  @@_customer ||= ShopifyGrant.new('customer')
end

.discountObject

Access to /admin/price_rules/:id/discount_codes.json



19042
19043
19044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19042

def ShopifyGrant.discount
  @@_discount ||= ShopifyGrant.new('discount')
end

.from_string(value) ⇒ Object

Returns the instance of ShopifyGrant for this value, or nil if not found



19027
19028
19029
19030
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19027

def ShopifyGrant.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  ShopifyGrant.ALL.find { |v| v.value == value }
end

.gift_cardObject

Access to /admin/gift_cards.json



19047
19048
19049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19047

def ShopifyGrant.gift_card
  @@_gift_card ||= ShopifyGrant.new('gift_card')
end

.metafieldObject

Access to /admin/variants/:id/metafields.json



19052
19053
19054
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19052

def ShopifyGrant.metafield
  @@_metafield ||= ShopifyGrant.new('metafield')
end

.orderObject

Access to /admin/orders/:id/metafields.json



19057
19058
19059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19057

def ShopifyGrant.order
  @@_order ||= ShopifyGrant.new('order')
end

Instance Method Details

#to_hashObject



19061
19062
19063
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19061

def to_hash
  value
end