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

Returns a new instance of ShopifyGrant.



15047
15048
15049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15047

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15045
15046
15047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15045

def value
  @value
end

Class Method Details

.ALLObject



15067
15068
15069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15067

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



15052
15053
15054
15055
15056
15057
15058
15059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15052

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



15072
15073
15074
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15072

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

.discountObject

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



15077
15078
15079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15077

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



15062
15063
15064
15065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15062

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



15082
15083
15084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15082

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

.metafieldObject

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



15087
15088
15089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15087

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

.orderObject

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



15092
15093
15094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15092

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

Instance Method Details

#to_hashObject



15096
15097
15098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15096

def to_hash
  value
end