Class: Io::Flow::V0::Models::ProductRestrictionResult

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

Overview

Restriction data pertaining to a product and its variants

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ProductRestrictionResult

Returns a new instance of ProductRestrictionResult.



60878
60879
60880
60881
60882
60883
60884
60885
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60878

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :product_id, :item_numbers, :prohibited_regions], 'ProductRestrictionResult')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @product_id = HttpClient::Preconditions.assert_class('product_id', opts.delete(:product_id), String)
  @item_numbers = HttpClient::Preconditions.assert_class('item_numbers', opts.delete(:item_numbers), Array).map { |v| HttpClient::Preconditions.assert_class('item_numbers', v, String) }
  @prohibited_regions = HttpClient::Preconditions.assert_class('prohibited_regions', opts.delete(:prohibited_regions), Array).map { |v| HttpClient::Preconditions.assert_class('prohibited_regions', v, String) }
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



60876
60877
60878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60876

def id
  @id
end

#item_numbersObject (readonly)

Returns the value of attribute item_numbers.



60876
60877
60878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60876

def item_numbers
  @item_numbers
end

#product_idObject (readonly)

Returns the value of attribute product_id.



60876
60877
60878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60876

def product_id
  @product_id
end

#prohibited_regionsObject (readonly)

Returns the value of attribute prohibited_regions.



60876
60877
60878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60876

def prohibited_regions
  @prohibited_regions
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



60891
60892
60893
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60891

def copy(incoming={})
  ProductRestrictionResult.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



60895
60896
60897
60898
60899
60900
60901
60902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60895

def to_hash
  {
    :id => id,
    :product_id => product_id,
    :item_numbers => item_numbers,
    :prohibited_regions => prohibited_regions
  }
end

#to_jsonObject



60887
60888
60889
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60887

def to_json
  JSON.dump(to_hash)
end