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.



19921
19922
19923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19921

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19919
19920
19921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19919

def value
  @value
end

Class Method Details

.ALLObject



19941
19942
19943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19941

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



19926
19927
19928
19929
19930
19931
19932
19933
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19926

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



19946
19947
19948
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19946

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

.discountObject

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



19951
19952
19953
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19951

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



19936
19937
19938
19939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19936

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



19956
19957
19958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19956

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

.metafieldObject

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



19961
19962
19963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19961

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

.orderObject

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



19966
19967
19968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19966

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

Instance Method Details

#to_hashObject



19970
19971
19972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19970

def to_hash
  value
end